summaryrefslogtreecommitdiffstats
path: root/lib/content_browser_client_qt.cpp
diff options
context:
space:
mode:
authorJocelyn Turcotte <jocelyn.turcotte@digia.com>2013-06-06 18:46:47 +0200
committerJocelyn Turcotte <jocelyn.turcotte@digia.com>2013-06-06 18:52:28 +0200
commit5bf14cccfe86a8f87300d3e23432aeaa150cbf81 (patch)
treef65408cc6cbc619416b919d8db96c0734705c1ea /lib/content_browser_client_qt.cpp
parenta1c0740f25b8c519910786a47e64d2d4f71495d9 (diff)
Properly implement a QWidget and QtQuick API
This layers things properly to be able to implement the UI in the example application instead of directly in shell_qt.cpp. This is still using global variables to allow the Shell platform code to do callbacks to the API classes. This should go away once we properly implemented a WebContentsDelegate.
Diffstat (limited to 'lib/content_browser_client_qt.cpp')
-rw-r--r--lib/content_browser_client_qt.cpp31
1 files changed, 9 insertions, 22 deletions
diff --git a/lib/content_browser_client_qt.cpp b/lib/content_browser_client_qt.cpp
index 0470d6700..65ef0f75c 100644
--- a/lib/content_browser_client_qt.cpp
+++ b/lib/content_browser_client_qt.cpp
@@ -12,25 +12,9 @@
#include "content/public/browser/browser_main_parts.h"
#include "net/base/net_module.h"
#include "net/base/net_util.h"
-
#include "browser_context_qt.h"
#include "web_contents_view_qt.h"
-static GURL GetStartupURL() {
- CommandLine* command_line = CommandLine::ForCurrentProcess();
- const CommandLine::StringVector& args = command_line->GetArgs();
-
- if (args.empty())
- return GURL("http://www.google.com/");
-
- GURL url(args[0]);
- if (url.is_valid() && url.has_scheme())
- return url;
-
- return net::FilePathToFileURL(base::FilePath(args[0]));
-}
-
-
class BrowserMainPartsQt : public content::BrowserMainParts
{
public:
@@ -48,8 +32,6 @@ public:
m_browserContext.reset(new content::ShellBrowserContext(false));
m_offTheRecordBrowserContext.reset(new content::ShellBrowserContext(true));
- content::Shell::CreateNewWindow(m_browserContext.get(), GetStartupURL(), NULL, MSG_ROUTING_NONE, gfx::Size());
-
if (m_parameters.ui_task) {
m_parameters.ui_task->Run();
delete m_parameters.ui_task;
@@ -66,6 +48,10 @@ public:
m_offTheRecordBrowserContext.reset();
}
+ content::ShellBrowserContext* browser_context() const {
+ return m_browserContext.get();
+ }
+
private:
scoped_ptr<content::ShellBrowserContext> m_browserContext;
scoped_ptr<content::ShellBrowserContext> m_offTheRecordBrowserContext;
@@ -89,14 +75,15 @@ content::WebContentsViewPort* ContentBrowserClientQt::OverrideCreateWebContentsV
content::BrowserMainParts *ContentBrowserClientQt::CreateBrowserMainParts(const content::MainFunctionParams &parameters)
{
m_browserMainParts = new BrowserMainPartsQt(parameters);
- m_browser_context = new BrowserContextQt();
+ // FIXME: We don't seem to need it yet, the ShellBrowserContext was being used.
+ // m_browser_context = new BrowserContextQt();
return m_browserMainParts;
}
-BrowserContextQt* ContentBrowserClientQt::browser_context() {
-
- return m_browser_context;
+content::ShellBrowserContext* ContentBrowserClientQt::browser_context() {
+ return m_browserMainParts->browser_context();
+ // return m_browser_context;
}
net::URLRequestContextGetter* ContentBrowserClientQt::CreateRequestContext(content::BrowserContext* content_browser_context, content::ProtocolHandlerMap* protocol_handlers)