diff options
author | Zeno Albisser <zeno.albisser@digia.com> | 2013-06-06 17:29:45 +0200 |
---|---|---|
committer | Zeno Albisser <zeno.albisser@digia.com> | 2013-06-10 15:01:02 +0200 |
commit | 83a2bc6d446387d25fd10164e87627c9d49878eb (patch) | |
tree | 164f0c7cc5b4d8cb195afbf388f628e62eaa1b91 /lib/web_contents_delegate_qt.h | |
parent | 54ed434fe3ab34ca007bc58111d19196c686ecc0 (diff) |
Replace Shell with WebContentsDelegateQt.
Diffstat (limited to 'lib/web_contents_delegate_qt.h')
-rw-r--r-- | lib/web_contents_delegate_qt.h | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/lib/web_contents_delegate_qt.h b/lib/web_contents_delegate_qt.h new file mode 100644 index 000000000..92a85feaf --- /dev/null +++ b/lib/web_contents_delegate_qt.h @@ -0,0 +1,47 @@ +#ifndef WEB_CONTENTS_DELEGATE_QT +#define WEB_CONTENTS_DELEGATE_QT + +#include "content/public/browser/notification_observer.h" +#include "content/public/browser/web_contents_delegate.h" + +namespace content { + class BrowserContext; + class SiteInstance; +} + +class QWebContentsView; +class QQuickWebContentsView; + +class WebContentsDelegateQt : public content::WebContentsDelegate + , public content::NotificationObserver +{ +public: + static WebContentsDelegateQt* Create(content::WebContents*, const gfx::Size& initial_size, QWebContentsView*); + static WebContentsDelegateQt* Create(content::WebContents*, const gfx::Size& initial_size, QQuickWebContentsView*); + static WebContentsDelegateQt* CreateNewWindow(content::BrowserContext*, const GURL&, content::SiteInstance*, int routing_id, const gfx::Size& initial_size, QWebContentsView*); + static WebContentsDelegateQt* CreateNewWindow(content::BrowserContext*, const GURL&, content::SiteInstance*, int routing_id, const gfx::Size& initial_size, QQuickWebContentsView*); + content::WebContents* web_contents(); + void LoadURL(const GURL&); + void LoadURLForFrame(const GURL&, const std::string& frame_name); + void GoBackOrForward(int offset); + void Reload(); + void Stop(); + + virtual void Observe(int, const content::NotificationSource&, const content::NotificationDetails&); + +private: + static WebContentsDelegateQt* commonCreate(content::WebContents* web_contents, const gfx::Size& initial_size, WebContentsDelegateQt* delegate); + WebContentsDelegateQt(content::WebContents*, QWebContentsView*); + WebContentsDelegateQt(content::WebContents*, QQuickWebContentsView*); + void PlatformCreateWindow(int width, int height); + void PlatformSetContents(); + void PlatformResizeSubViews(); + + QWebContentsView* m_contentsView; + QQuickWebContentsView* m_quickContentsView; + scoped_ptr<content::WebContents> m_webContents; + + static std::vector<WebContentsDelegateQt*> m_windows; +}; + +#endif |