From ff2e715a272fd1f24a8c35fecfd1afd6c588baa1 Mon Sep 17 00:00:00 2001 From: Zeno Albisser Date: Wed, 29 May 2013 23:27:13 +0200 Subject: Remove Qt specific m_window member from Shell. Unfortunately this requires some minor reinterpret_casts. --- lib/render_widget_host_view_qt.cpp | 1 - lib/shell_qt.cpp | 18 +-- ...de-some-Gtk-files-from-the-chromium-build.patch | 38 ++++++ ...atch-add-some-Qt-member-functions-to-Rend.patch | 150 --------------------- ...er_widget_host_view_gtk-and-web_contents_.patch | 25 ---- patches/patch-chromium.sh | 3 +- 6 files changed, 49 insertions(+), 186 deletions(-) create mode 100644 patches/0001-Exclude-some-Gtk-files-from-the-chromium-build.patch delete mode 100644 patches/0001-Temporary-patch-add-some-Qt-member-functions-to-Rend.patch delete mode 100644 patches/0001-remove-render_widget_host_view_gtk-and-web_contents_.patch diff --git a/lib/render_widget_host_view_qt.cpp b/lib/render_widget_host_view_qt.cpp index e52f4c5e2..7db0a6f5b 100644 --- a/lib/render_widget_host_view_qt.cpp +++ b/lib/render_widget_host_view_qt.cpp @@ -153,7 +153,6 @@ void RenderWidgetHostViewQt::SetBounds(const gfx::Rect& rect) gfx::NativeView RenderWidgetHostViewQt::GetNativeView() const { QT_NOT_YET_IMPLEMENTED - // return m_view; return gfx::NativeView(); } diff --git a/lib/shell_qt.cpp b/lib/shell_qt.cpp index 7ae7c8d04..c21bd487a 100644 --- a/lib/shell_qt.cpp +++ b/lib/shell_qt.cpp @@ -50,7 +50,7 @@ void Shell::PlatformSetAddressBarURL(const GURL& url) fprintf(stderr, "Set Address to: %s\n", url.spec().c_str()); - QLineEdit* addressLine = m_window->findChild("AddressLineEdit"); + QLineEdit* addressLine = reinterpret_cast(window_)->findChild("AddressLineEdit"); addressLine->setText(QString::fromStdString(url.spec())); } @@ -66,14 +66,16 @@ void Shell::PlatformCreateWindow(int width, int height) { if (headless_) return; - if (!m_window) { + if (!window_) { // Use oxygen as a fallback. if (QIcon::themeName().isEmpty()) QIcon::setThemeName("oxygen"); - m_window = new QWidget; - m_window->setGeometry(100,100, width, height); + QWidget* window = new QWidget; + window_ = reinterpret_cast(window); + + window->setGeometry(100,100, width, height); QVBoxLayout* layout = new QVBoxLayout; @@ -103,8 +105,8 @@ void Shell::PlatformCreateWindow(int width, int height) { layout->addLayout(addressBar); - m_window->setLayout(layout); - m_window->show(); + window->setLayout(layout); + window->show(); // SignalConnector will act as a proxy for the QObject signals received from // m_window. m_window will take ownership of the SignalConnector. @@ -112,7 +114,7 @@ void Shell::PlatformCreateWindow(int width, int height) { // for back/forward/reload buttons and for the address line edit. // Therefore the layout must be set and completed before the SignalConnector // is created. - SignalConnector* signalConnector = new SignalConnector(this, m_window); + SignalConnector* signalConnector = new SignalConnector(this, window); } } @@ -129,7 +131,7 @@ void Shell::PlatformSetContents() WebContentsViewQt* content_view = static_cast(web_contents_->GetView()); content_view->setWindowContainer(static_cast(new RasterWindowContainer)); - QVBoxLayout* layout = qobject_cast(m_window->layout()); + QVBoxLayout* layout = qobject_cast(reinterpret_cast(window_)->layout()); if (layout) layout->addLayout(static_cast(content_view->windowContainer())); } diff --git a/patches/0001-Exclude-some-Gtk-files-from-the-chromium-build.patch b/patches/0001-Exclude-some-Gtk-files-from-the-chromium-build.patch new file mode 100644 index 000000000..5edc125a6 --- /dev/null +++ b/patches/0001-Exclude-some-Gtk-files-from-the-chromium-build.patch @@ -0,0 +1,38 @@ +From d3fe2537f911599cdddb8ffc31bdcf8e2a0bad9d Mon Sep 17 00:00:00 2001 +From: Zeno Albisser +Date: Tue, 14 May 2013 10:52:58 +0200 +Subject: [PATCH] Exclude some Gtk files from the chromium build. + +--- + content/content_browser.gypi | 2 -- + content/content_shell.gypi | 1 - + 2 files changed, 3 deletions(-) + +diff --git a/content/content_browser.gypi b/content/content_browser.gypi +index 4627a4e..49eefe7 100644 +--- a/content/content_browser.gypi ++++ b/content/content_browser.gypi +@@ -831,8 +831,6 @@ + 'browser/renderer_host/render_widget_host_view_aura.h', + 'browser/renderer_host/render_widget_host_view_base.cc', + 'browser/renderer_host/render_widget_host_view_base.h', +- 'browser/renderer_host/render_widget_host_view_gtk.cc', +- 'browser/renderer_host/render_widget_host_view_gtk.h', + 'browser/renderer_host/render_widget_host_view_guest.cc', + 'browser/renderer_host/render_widget_host_view_guest.h', + 'browser/renderer_host/render_widget_host_view_mac_editcommand_helper.h', +diff --git a/content/content_shell.gypi b/content/content_shell.gypi +index 122e56b..e8271b6 100644 +--- a/content/content_shell.gypi ++++ b/content/content_shell.gypi +@@ -94,7 +94,6 @@ + 'shell/shell.h', + 'shell/shell_android.cc', + 'shell/shell_aura.cc', +- 'shell/shell_gtk.cc', + 'shell/shell_mac.mm', + 'shell/shell_win.cc', + 'shell/shell_application_mac.h', +-- +1.8.1.2 + diff --git a/patches/0001-Temporary-patch-add-some-Qt-member-functions-to-Rend.patch b/patches/0001-Temporary-patch-add-some-Qt-member-functions-to-Rend.patch deleted file mode 100644 index 3a68dcedb..000000000 --- a/patches/0001-Temporary-patch-add-some-Qt-member-functions-to-Rend.patch +++ /dev/null @@ -1,150 +0,0 @@ -From 30b08c80f4b17fada28703f2e15c98207875e771 Mon Sep 17 00:00:00 2001 -From: Zeno Albisser -Date: Tue, 14 May 2013 10:52:58 +0200 -Subject: [PATCH] Temporary patch: add some Qt member functions to - RenderWidgetHostView. - -This patch should be removed again, once we manage to avoid the use of -GetNativeView() or we manage to make gfx::NativeView a RasterWindow.w ---- - content/browser/renderer_host/render_widget_host_view_gtk.h | 1 + - content/browser/web_contents/web_contents_view_gtk.cc | 7 +++++++ - content/browser/web_contents/web_contents_view_gtk.h | 1 + - content/content_shell.gypi | 1 - - content/public/browser/render_widget_host_view.h | 3 +++ - content/public/browser/web_contents_view.h | 2 ++ - content/shell/shell.cc | 1 + - content/shell/shell.h | 2 ++ - 8 files changed, 17 insertions(+), 1 deletion(-) - -diff --git a/content/browser/renderer_host/render_widget_host_view_gtk.h b/content/browser/renderer_host/render_widget_host_view_gtk.h -index 46daaac..271ad19 100644 ---- a/content/browser/renderer_host/render_widget_host_view_gtk.h -+++ b/content/browser/renderer_host/render_widget_host_view_gtk.h -@@ -55,6 +55,7 @@ class CONTENT_EXPORT RenderWidgetHostViewGtk - virtual RenderWidgetHost* GetRenderWidgetHost() const OVERRIDE; - virtual void SetSize(const gfx::Size& size) OVERRIDE; - virtual void SetBounds(const gfx::Rect& rect) OVERRIDE; -+ virtual gfx::NativeView GetNativeViewGTK() const { return gfx::NativeView(); }; - virtual gfx::NativeView GetNativeView() const OVERRIDE; - virtual gfx::NativeViewId GetNativeViewId() const OVERRIDE; - virtual gfx::NativeViewAccessible GetNativeViewAccessible() OVERRIDE; -diff --git a/content/browser/web_contents/web_contents_view_gtk.cc b/content/browser/web_contents/web_contents_view_gtk.cc -index 9cb9212..8202258 100644 ---- a/content/browser/web_contents/web_contents_view_gtk.cc -+++ b/content/browser/web_contents/web_contents_view_gtk.cc -@@ -115,6 +115,13 @@ gfx::NativeView WebContentsViewGtk::GetNativeView() const { - return expanded_.get(); - } - -+RasterWindow* WebContentsViewGtk::GetNativeViewQt() const { -+ RenderWidgetHostView* rwhv = web_contents_->GetRenderWidgetHostView(); -+ if (!rwhv) -+ return NULL; -+ return rwhv->GetNativeViewQt(); -+} -+ - gfx::NativeView WebContentsViewGtk::GetContentNativeView() const { - RenderWidgetHostView* rwhv = web_contents_->GetRenderWidgetHostView(); - if (!rwhv) -diff --git a/content/browser/web_contents/web_contents_view_gtk.h b/content/browser/web_contents/web_contents_view_gtk.h -index a5a15a2..f4a5a93 100644 ---- a/content/browser/web_contents/web_contents_view_gtk.h -+++ b/content/browser/web_contents/web_contents_view_gtk.h -@@ -46,6 +46,7 @@ class CONTENT_EXPORT WebContentsViewGtk - // WebContentsView implementation -------------------------------------------- - - virtual gfx::NativeView GetNativeView() const OVERRIDE; -+ virtual RasterWindow* GetNativeViewQt() const OVERRIDE; - virtual gfx::NativeView GetContentNativeView() const OVERRIDE; - virtual gfx::NativeWindow GetTopLevelNativeWindow() const OVERRIDE; - virtual void GetContainerBounds(gfx::Rect* out) const OVERRIDE; -diff --git a/content/content_shell.gypi b/content/content_shell.gypi -index 1bf233b..fc6bf96 100644 ---- a/content/content_shell.gypi -+++ b/content/content_shell.gypi -@@ -82,7 +82,6 @@ - 'shell/shell.h', - 'shell/shell_android.cc', - 'shell/shell_aura.cc', -- 'shell/shell_gtk.cc', - 'shell/shell_mac.mm', - 'shell/shell_win.cc', - 'shell/shell_application_mac.h', -diff --git a/content/public/browser/render_widget_host_view.h b/content/public/browser/render_widget_host_view.h -index b881748..3eccb42 100644 ---- a/content/public/browser/render_widget_host_view.h -+++ b/content/public/browser/render_widget_host_view.h -@@ -18,6 +18,7 @@ - #endif - - class GURL; -+class RasterWindow; - - namespace gfx { - class Rect; -@@ -76,7 +77,9 @@ class CONTENT_EXPORT RenderWidgetHostView { - - // Retrieves the native view used to contain plugins and identify the - // renderer in IPC messages. -+ virtual gfx::NativeView GetNativeViewGTK() const { return 0; }; - virtual gfx::NativeView GetNativeView() const = 0; -+ virtual RasterWindow* GetNativeViewQt() const { return 0; } - virtual gfx::NativeViewId GetNativeViewId() const = 0; - virtual gfx::NativeViewAccessible GetNativeViewAccessible() = 0; - -diff --git a/content/public/browser/web_contents_view.h b/content/public/browser/web_contents_view.h -index d0a7309..9cfddb4 100644 ---- a/content/public/browser/web_contents_view.h -+++ b/content/public/browser/web_contents_view.h -@@ -15,6 +15,7 @@ - #include "ui/gfx/size.h" - - struct WebDropData; -+class RasterWindow; - - namespace content { - -@@ -27,6 +28,7 @@ class CONTENT_EXPORT WebContentsView { - - // Returns the native widget that contains the contents of the tab. - virtual gfx::NativeView GetNativeView() const = 0; -+ virtual RasterWindow* GetNativeViewQt() const { return 0; } - - // Returns the native widget with the main content of the tab (i.e. the main - // render view host, though there may be many popups in the tab as children of -diff --git a/content/shell/shell.cc b/content/shell/shell.cc -index 5eac7af..3e4bd60 100644 ---- a/content/shell/shell.cc -+++ b/content/shell/shell.cc -@@ -46,6 +46,7 @@ Shell::Shell(WebContents* web_contents) - : devtools_frontend_(NULL), - is_fullscreen_(false), - window_(NULL), -+ m_window(NULL), - url_edit_view_(NULL), - #if defined(OS_WIN) && !defined(USE_AURA) - default_edit_wnd_proc_(0), -diff --git a/content/shell/shell.h b/content/shell/shell.h -index 736bd3f..4d028cf 100644 ---- a/content/shell/shell.h -+++ b/content/shell/shell.h -@@ -37,6 +37,7 @@ class ViewsDelegate; - } - #endif - -+class QWidget; - class GURL; - namespace content { - -@@ -219,6 +220,7 @@ class Shell : public WebContentsDelegate, - bool is_fullscreen_; - - gfx::NativeWindow window_; -+ QWidget* m_window; - gfx::NativeEditView url_edit_view_; - - // Notification manager --- -1.8.1.2 - diff --git a/patches/0001-remove-render_widget_host_view_gtk-and-web_contents_.patch b/patches/0001-remove-render_widget_host_view_gtk-and-web_contents_.patch deleted file mode 100644 index 522b3fa29..000000000 --- a/patches/0001-remove-render_widget_host_view_gtk-and-web_contents_.patch +++ /dev/null @@ -1,25 +0,0 @@ -From 180ed0eb6e8bf0605116596836ab5cd8376387e5 Mon Sep 17 00:00:00 2001 -From: Zeno Albisser -Date: Thu, 23 May 2013 11:12:26 +0200 -Subject: [PATCH] remove render_widget_host_view_gtk and web_contents_view_gtk - ---- - content/content_browser.gypi | 4 ---- - 1 file changed, 4 deletions(-) - -diff --git a/content/content_browser.gypi b/content/content_browser.gypi -index 92798b9..9085fc9 100644 ---- a/content/content_browser.gypi -+++ b/content/content_browser.gypi -@@ -832,8 +832,6 @@ - 'browser/renderer_host/render_widget_host_view_aura.h', - 'browser/renderer_host/render_widget_host_view_base.cc', - 'browser/renderer_host/render_widget_host_view_base.h', -- 'browser/renderer_host/render_widget_host_view_gtk.cc', -- 'browser/renderer_host/render_widget_host_view_gtk.h', - 'browser/renderer_host/render_widget_host_view_guest.cc', - 'browser/renderer_host/render_widget_host_view_guest.h', - 'browser/renderer_host/render_widget_host_view_mac_editcommand_helper.h', --- -1.8.1.2 - diff --git a/patches/patch-chromium.sh b/patches/patch-chromium.sh index 2bbccaa3e..ce8a6c716 100755 --- a/patches/patch-chromium.sh +++ b/patches/patch-chromium.sh @@ -21,8 +21,7 @@ fi echo "Applying patches..." git am $PATCH_DIR/0001-My-local-fixes.patch -git am $PATCH_DIR/0001-Temporary-patch-add-some-Qt-member-functions-to-Rend.patch -git am $PATCH_DIR/0001-remove-render_widget_host_view_gtk-and-web_contents_.patch +git am $PATCH_DIR/0001-Exclude-some-Gtk-files-from-the-chromium-build.patch cd tools/gyp echo "Entering $PWD" -- cgit v1.2.3