diff options
author | Simon Hausmann <simon.hausmann@digia.com> | 2013-04-29 16:50:05 +0200 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@digia.com> | 2013-04-29 16:50:05 +0200 |
commit | 75142b15b96805d458aab77c1f40e97cdb7192b1 (patch) | |
tree | d5d05e8a33df5c63a2982806173d469e48d97252 | |
parent | 660374e8ddfe2795f718642fc5e5f9b18d148488 (diff) |
Messing around some more
-rw-r--r-- | example/main.cpp | 2 | ||||
-rw-r--r-- | lib/blinqpage.cpp | 64 | ||||
-rw-r--r-- | patches/0001-My-local-fixes.patch | 60 |
3 files changed, 108 insertions, 18 deletions
diff --git a/example/main.cpp b/example/main.cpp index 3815848c1..bb932d959 100644 --- a/example/main.cpp +++ b/example/main.cpp @@ -8,7 +8,7 @@ int main(int argc, char **argv) QGuiApplication app(argc, argv); BlinqPage page(argc, argv); - page.window()->show(); +// page.window()->show(); return app.exec(); } diff --git a/lib/blinqpage.cpp b/lib/blinqpage.cpp index 48cc0a769..15b11e8e8 100644 --- a/lib/blinqpage.cpp +++ b/lib/blinqpage.cpp @@ -28,6 +28,9 @@ #include "content/shell/shell_main_delegate.h" #include "content/shell/shell_content_browser_client.h" #include "content/browser/web_contents/web_contents_impl.h" +#include "content/browser/renderer_host/render_view_host_factory.h" +#include "content/browser/renderer_host/render_view_host_impl.h" +#include "content/browser/renderer_host/render_widget_host_view_gtk.h" #include <QByteArray> #include <QWindow> @@ -126,26 +129,52 @@ inline net::URLRequestContext* ResourceContext::GetRequestContext() return context->GetRequestContext()->GetURLRequestContext(); } -class BrowserClient : public content::ShellContentBrowserClient +class RenderWidgetHostView : public content::RenderWidgetHostViewGtk { public: - virtual content::WebContentsViewPort* OverrideCreateWebContentsView(content::WebContents* web_contents, content::RenderViewHostDelegateView** render_view_host_delegate_view) + RenderWidgetHostView(content::RenderWidgetHost* widget) + : content::RenderWidgetHostViewGtk(widget) { - return 0; } }; -class MainDelegate : public content::ShellMainDelegate +class RenderViewHost : public content::RenderViewHostImpl { public: - virtual content::ContentBrowserClient* CreateContentBrowserClient() + RenderViewHost( + content::SiteInstance* instance, + content::RenderViewHostDelegate* delegate, + content::RenderWidgetHostDelegate* widget_delegate, + int routing_id, + bool swapped_out, + content::SessionStorageNamespace* session_storage_namespace) + : content::RenderViewHostImpl(instance, delegate, widget_delegate, routing_id, swapped_out, session_storage_namespace) { - browserClient.reset(new BrowserClient); - return browserClient.get(); - }; + SetView(new RenderWidgetHostView(this)); + } +}; -private: - scoped_ptr<BrowserClient> browserClient; +class ViewHostFactory : public content::RenderViewHostFactory +{ +public: + ViewHostFactory() + { + content::RenderViewHostFactory::RegisterFactory(this); + } + ~ViewHostFactory() + { + content::RenderViewHostFactory::UnregisterFactory(); + } + + virtual content::RenderViewHost *CreateRenderViewHost(content::SiteInstance *instance, + content::RenderViewHostDelegate *delegate, + content::RenderWidgetHostDelegate *widget_delegate, + int routing_id, + bool swapped_out, + content::SessionStorageNamespace *session_storage_namespace) + { + return new RenderViewHost(instance, delegate, widget_delegate, routing_id, swapped_out, session_storage_namespace); + } }; } @@ -163,8 +192,10 @@ BlinqPage::BlinqPage(int argc, char **argv) static content::ContentMainRunner *runner = 0; if (!runner) { + (void)new ViewHostFactory(); + runner = content::ContentMainRunner::Create(); - runner->Initialize(0, 0, new MainDelegate); + runner->Initialize(0, 0, new content::ShellMainDelegate); } initializeBlinkPaths(); @@ -184,13 +215,12 @@ BlinqPage::BlinqPage(int argc, char **argv) d->context.reset(static_cast<content::ShellContentBrowserClient*>(content::GetContentClient()->browser())->browser_context()); content::WebContents::CreateParams p(d->context.get()); - d->contents.reset(content::WebContents::Create(p)); - // d->contents->GetView()->GetNativeView()->Show(); +// d->contents.reset(content::WebContents::Create(p)); - d->contents->GetController().LoadURL(GURL(std::string("http://qt-project.org/")), - content::Referrer(), - content::PAGE_TRANSITION_TYPED, - std::string()); +// d->contents->GetController().LoadURL(GURL(std::string("http://qt-project.org/")), +// content::Referrer(), +// content::PAGE_TRANSITION_TYPED, +// std::string()); } BlinqPage::~BlinqPage() diff --git a/patches/0001-My-local-fixes.patch b/patches/0001-My-local-fixes.patch new file mode 100644 index 000000000..ff5e1308c --- /dev/null +++ b/patches/0001-My-local-fixes.patch @@ -0,0 +1,60 @@ +From 4ce3baa412e9799684c0b7379814384489c2ae5a Mon Sep 17 00:00:00 2001 +From: Simon Hausmann <simon.hausmann@digia.com> +Date: Mon, 29 Apr 2013 11:25:37 +0200 +Subject: [PATCH] My local fixes + +--- + content/browser/zygote_host/zygote_host_impl_linux.cc | 1 + + content/public/app/content_main_runner.h | 3 ++- + content/public/common/content_client.h | 2 +- + 3 files changed, 4 insertions(+), 2 deletions(-) + +diff --git a/content/browser/zygote_host/zygote_host_impl_linux.cc b/content/browser/zygote_host/zygote_host_impl_linux.cc +index 4e28c55..ddd3513 100644 +--- a/content/browser/zygote_host/zygote_host_impl_linux.cc ++++ b/content/browser/zygote_host/zygote_host_impl_linux.cc +@@ -70,6 +70,7 @@ void ZygoteHostImpl::Init(const std::string& sandbox_cmd) { + + base::FilePath chrome_path; + CHECK(PathService::Get(base::FILE_EXE, &chrome_path)); ++ chrome_path = CommandLine::ForCurrentProcess()->GetSwitchValuePath(switches::kBrowserSubprocessPath); + CommandLine cmd_line(chrome_path); + + cmd_line.AppendSwitchASCII(switches::kProcessType, switches::kZygoteProcess); +diff --git a/content/public/app/content_main_runner.h b/content/public/app/content_main_runner.h +index bed5ff2..992e0d0 100644 +--- a/content/public/app/content_main_runner.h ++++ b/content/public/app/content_main_runner.h +@@ -8,6 +8,7 @@ + #include <string> + + #include "build/build_config.h" ++#include "content/common/content_export.h" + + #if defined(OS_WIN) + #include <windows.h> +@@ -22,7 +23,7 @@ namespace content { + class ContentMainDelegate; + + // This class is responsible for content initialization, running and shutdown. +-class ContentMainRunner { ++class CONTENT_EXPORT ContentMainRunner { + public: + virtual ~ContentMainRunner() {} + +diff --git a/content/public/common/content_client.h b/content/public/common/content_client.h +index 198ecad..778fcac 100644 +--- a/content/public/common/content_client.h ++++ b/content/public/common/content_client.h +@@ -60,7 +60,7 @@ CONTENT_EXPORT void SetContentClient(ContentClient* client); + + #if defined(CONTENT_IMPLEMENTATION) + // Content's embedder API should only be used by content. +-ContentClient* GetContentClient(); ++CONTENT_EXPORT ContentClient* GetContentClient(); + #endif + + // Used for tests to override the relevant embedder interfaces. Each method +-- +1.8.1.2 + |