diff options
-rw-r--r-- | lib/web_contents_delegate_qt.cpp | 14 | ||||
-rw-r--r-- | lib/web_contents_delegate_qt.h | 3 | ||||
-rw-r--r-- | lib/web_contents_view_qt.cpp | 6 | ||||
-rw-r--r-- | lib/web_contents_view_qt.h | 2 |
4 files changed, 7 insertions, 18 deletions
diff --git a/lib/web_contents_delegate_qt.cpp b/lib/web_contents_delegate_qt.cpp index 222d6f1bc..22725bdc7 100644 --- a/lib/web_contents_delegate_qt.cpp +++ b/lib/web_contents_delegate_qt.cpp @@ -77,20 +77,6 @@ WebContentsDelegateQt::WebContentsDelegateQt(content::BrowserContext* browser_co m_webContents->GetRenderViewHost()->SyncRendererPrefs(); m_webContents->SetDelegate(this); - m_registrar.Add(this, content::NOTIFICATION_WEB_CONTENTS_TITLE_UPDATED, content::Source<content::WebContents>(m_webContents.get())); -} - -void WebContentsDelegateQt::Observe(int type, const content::NotificationSource& source, const content::NotificationDetails& details) -{ - if (type == content::NOTIFICATION_WEB_CONTENTS_TITLE_UPDATED) { - std::pair<content::NavigationEntry*, bool>* title = content::Details<std::pair<content::NavigationEntry*, bool> >(details).ptr(); - - if (title->first) { - string16 text = title->first->GetTitle(); - QString title = QString::fromUtf16(text.data()); - Q_EMIT titleChanged(title); - } - } } void WebContentsDelegateQt::NavigationStateChanged(const content::WebContents* source, unsigned changed_flags) diff --git a/lib/web_contents_delegate_qt.h b/lib/web_contents_delegate_qt.h index 2ffaf2d33..817c219cb 100644 --- a/lib/web_contents_delegate_qt.h +++ b/lib/web_contents_delegate_qt.h @@ -57,14 +57,12 @@ namespace content { class WebContentsDelegateQt : public QObject , public content::WebContentsDelegate - , public content::NotificationObserver { Q_OBJECT public: WebContentsDelegateQt(content::BrowserContext*, content::SiteInstance*, int routing_id, const gfx::Size& initial_size); content::WebContents* web_contents(); - virtual void Observe(int type, const content::NotificationSource&, const content::NotificationDetails&); virtual void NavigationStateChanged(const content::WebContents* source, unsigned changed_flags); virtual void LoadingStateChanged(content::WebContents* source); @@ -75,7 +73,6 @@ Q_SIGNALS: private: scoped_ptr<content::WebContents> m_webContents; - content::NotificationRegistrar m_registrar; }; #endif diff --git a/lib/web_contents_view_qt.cpp b/lib/web_contents_view_qt.cpp index dedf85f01..51af43d5e 100644 --- a/lib/web_contents_view_qt.cpp +++ b/lib/web_contents_view_qt.cpp @@ -60,3 +60,9 @@ content::RenderWidgetHostView* WebContentsViewQt::CreateViewForWidget(content::R return view; } + +void WebContentsViewQt::SetPageTitle(const string16& title) +{ + QString string = QString::fromUtf16(title.data()); + Q_EMIT m_client->webContentsDelegate->titleChanged(string); +} diff --git a/lib/web_contents_view_qt.h b/lib/web_contents_view_qt.h index dbdd3cc9c..5f59d4934 100644 --- a/lib/web_contents_view_qt.h +++ b/lib/web_contents_view_qt.h @@ -79,7 +79,7 @@ public: virtual content::RenderWidgetHostView* CreateViewForPopupWidget(content::RenderWidgetHost* render_widget_host) { return 0; } - virtual void SetPageTitle(const string16& title) { QT_NOT_YET_IMPLEMENTED } + virtual void SetPageTitle(const string16& title); virtual void RenderViewCreated(content::RenderViewHost* host) { QT_NOT_YET_IMPLEMENTED } |