summaryrefslogtreecommitdiffstats
path: root/lib/content_browser_client_qt.cpp
diff options
context:
space:
mode:
authorAndras Becsi <andras.becsi@digia.com>2013-07-05 18:34:45 +0200
committerSimon Hausmann <simon.hausmann@digia.com>2013-07-09 13:45:41 +0200
commit1daab3653e56469868656b32fa87b7f9585ec577 (patch)
tree10a9cfe812347ed2582a7f68a7ffdc27726e81c0 /lib/content_browser_client_qt.cpp
parenta912e57e189847509efd75d8a4563ad8c7aa1079 (diff)
Get rid of the need to export content::GetContentClient()
ContentBrowserClientQt is a singleton which makes it possible to access it from WebContentsViewQt and removes the need for patching chromium. This is similar to how ShellContentBrowserClient is managed in the content shell. Change-Id: I67f35520935388888c7230806ad543a58b3211c3 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'lib/content_browser_client_qt.cpp')
-rw-r--r--lib/content_browser_client_qt.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/lib/content_browser_client_qt.cpp b/lib/content_browser_client_qt.cpp
index 2a56fdeab..e4fcb5acb 100644
--- a/lib/content_browser_client_qt.cpp
+++ b/lib/content_browser_client_qt.cpp
@@ -47,6 +47,12 @@
#include "browser_context_qt.h"
#include "web_contents_view_qt.h"
+namespace {
+
+ContentBrowserClientQt* gBrowserClient = 0; // Owned by ContentMainDelegateQt.
+
+} // namespace
+
class BrowserMainPartsQt : public content::BrowserMainParts
{
public:
@@ -101,6 +107,23 @@ content::WebContentsViewPort* ContentBrowserClientQt::OverrideCreateWebContentsV
return rv;
}
+ContentBrowserClientQt::ContentBrowserClientQt()
+ : m_browserMainParts(0)
+{
+ Q_ASSERT(!gBrowserClient);
+ gBrowserClient = this;
+}
+
+ContentBrowserClientQt::~ContentBrowserClientQt()
+{
+ gBrowserClient = 0;
+}
+
+ContentBrowserClientQt *ContentBrowserClientQt::Get()
+{
+ return gBrowserClient;
+}
+
content::BrowserMainParts *ContentBrowserClientQt::CreateBrowserMainParts(const content::MainFunctionParams &parameters)
{
m_browserMainParts = new BrowserMainPartsQt(parameters);