Embedding Gecko

Mark Finkle

Mozilla Corporation

Why Embed Gecko?

How do You Embed Gecko?

Embedding APIs

Problems with Embedding

Refactoring Embedding

MozApp


class MozApp
{
public:
  MozApp(profilePath);
  virtual ~MozApp();

  nsresult SetCharPref(name, value);
  nsresult SetBoolPref(name, value);
  nsresult SetIntPref(name, value);

  nsresult GetCharPref(name, value);
  nsresult GetBoolPref(name, value);
  nsresult GetIntPref(name, value);
};
        

MozView


class MozView
{
public:
  MozView();
  virtual ~MozView();

  nsresult CreateBrowser(nativeWindow, x, y, width, height, chromeFlags);

  nsresult SetPositionAndSize(x, y, width, height);

  nsresult LoadURI(uri);
  nsresult LoadData(baseURL, contentType, data, len);

  nsresult Stop();
  nsresult Reload();
  nsresult GoBack();
  nsresult GoForward();

  PRBool CanGoBack();
  PRBool CanGoForward();
  ...
};
        

MozView


class MozView
{
  ...
  nsresult SetFocus(focus);

  void Show();
  void Hide();

  void SetListener(newListener);
  MozViewListener* GetListener();

  void* GetParentWindow();
  void* GetNativeWindow();

  void SetParentView(parent);
  MozView* GetParentView();

  nsresult GetInterfaceRequestor(requestor);

  char* EvaluateJavaScript(script);
};
        

MozViewListener


class MozViewListener
{
public:
  MozViewListener();
  virtual ~MozViewListener();

  void SetMozView(mozView);

  virtual void SetTitle(newTitle);
  virtual void StatusChanged(newStatus, statusType);
  virtual void LocationChanged(newLocation);
  virtual PRBool OpenURI(newLocation);
  virtual void DocumentLoaded();

  virtual MozView* OpenWindow(flags);
  virtual void SizeTo(width, height);
  virtual void SetVisibility(visible);
  virtual void StartModal();
  virtual void ExitModal(result);
};
        

Frameworks Built on the New API

Roadmap

Resources

Questions?