diff options
author | Jocelyn Turcotte <jocelyn.turcotte@digia.com> | 2013-08-26 15:57:55 +0200 |
---|---|---|
committer | Jocelyn Turcotte <jocelyn.turcotte@digia.com> | 2013-08-29 17:40:37 +0200 |
commit | 63fe3552a5873c9477e0c8c01972d6c2a0bd9674 (patch) | |
tree | 9b78e38e1bba84b9f31ff74fddde182157bd4eb6 /lib | |
parent | 8ba789e6170649a692d13f95ed513b4ba5bd616b (diff) |
Get rid of WebContentsAdapter::webContents().
This isn't needed since the ownership was removed from WebContentsDelegateQt.
Change-Id: I44755966fd7681c638da083803cfde6262cb2dc2
Reviewed-by: Andras Becsi <andras.becsi@digia.com>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/web_contents_adapter.cpp | 67 | ||||
-rw-r--r-- | lib/web_contents_adapter.h | 1 |
2 files changed, 38 insertions, 30 deletions
diff --git a/lib/web_contents_adapter.cpp b/lib/web_contents_adapter.cpp index a4a32ed81..efcda76f3 100644 --- a/lib/web_contents_adapter.cpp +++ b/lib/web_contents_adapter.cpp @@ -58,7 +58,6 @@ static const int kTestWindowWidth = 800; static const int kTestWindowHeight = 600; -// Used to maintain a WebEngineContext for as long as we need one class WebContentsAdapterPrivate { public: WebContentsAdapterPrivate(); @@ -107,103 +106,113 @@ WebContentsAdapter::~WebContentsAdapter() bool WebContentsAdapter::canGoBack() const { - return webContents()->GetController().CanGoBack(); + Q_D(const WebContentsAdapter); + return d->webContents->GetController().CanGoBack(); } bool WebContentsAdapter::canGoForward() const { - return webContents()->GetController().CanGoForward(); + Q_D(const WebContentsAdapter); + return d->webContents->GetController().CanGoForward(); } bool WebContentsAdapter::isLoading() const { - return webContents()->IsLoading(); + Q_D(const WebContentsAdapter); + return d->webContents->IsLoading(); } void WebContentsAdapter::stop() { - content::NavigationController& controller = webContents()->GetController(); + Q_D(WebContentsAdapter); + content::NavigationController& controller = d->webContents->GetController(); int index = controller.GetPendingEntryIndex(); if (index != -1) controller.RemoveEntryAtIndex(index); - webContents()->GetView()->Focus(); + d->webContents->GetView()->Focus(); } void WebContentsAdapter::reload() { - webContents()->GetController().Reload(/*checkRepost = */false); - webContents()->GetView()->Focus(); + Q_D(WebContentsAdapter); + d->webContents->GetController().Reload(/*checkRepost = */false); + d->webContents->GetView()->Focus(); } void WebContentsAdapter::load(const QUrl &url) { + Q_D(WebContentsAdapter); content::NavigationController::LoadURLParams params(toGurl(url)); params.transition_type = content::PageTransitionFromInt(content::PAGE_TRANSITION_TYPED | content::PAGE_TRANSITION_FROM_ADDRESS_BAR); - webContents()->GetController().LoadURLWithParams(params); - webContents()->GetView()->Focus(); + d->webContents->GetController().LoadURLWithParams(params); + d->webContents->GetView()->Focus(); } QUrl WebContentsAdapter::activeUrl() const { - return toQt(webContents()->GetVisibleURL()); + Q_D(const WebContentsAdapter); + return toQt(d->webContents->GetVisibleURL()); } QString WebContentsAdapter::pageTitle() const { - content::NavigationEntry* entry = webContents()->GetController().GetVisibleEntry(); + Q_D(const WebContentsAdapter); + content::NavigationEntry* entry = d->webContents->GetController().GetVisibleEntry(); return entry ? toQt(entry->GetTitle()) : QString(); } void WebContentsAdapter::navigateToIndex(int offset) { - webContents()->GetController().GoToIndex(offset); - webContents()->GetView()->Focus(); + Q_D(WebContentsAdapter); + d->webContents->GetController().GoToIndex(offset); + d->webContents->GetView()->Focus(); } void WebContentsAdapter::navigateToOffset(int offset) { - webContents()->GetController().GoToOffset(offset); - webContents()->GetView()->Focus(); + Q_D(WebContentsAdapter); + d->webContents->GetController().GoToOffset(offset); + d->webContents->GetView()->Focus(); } int WebContentsAdapter::navigationEntryCount() { - return webContents()->GetController().GetEntryCount(); + Q_D(WebContentsAdapter); + return d->webContents->GetController().GetEntryCount(); } int WebContentsAdapter::currentNavigationEntryIndex() { - return webContents()->GetController().GetCurrentEntryIndex(); + Q_D(WebContentsAdapter); + return d->webContents->GetController().GetCurrentEntryIndex(); } QUrl WebContentsAdapter::getNavigationEntryOriginalUrl(int index) { - content::NavigationEntry *entry = webContents()->GetController().GetEntryAtIndex(index); + Q_D(WebContentsAdapter); + content::NavigationEntry *entry = d->webContents->GetController().GetEntryAtIndex(index); return entry ? toQt(entry->GetOriginalRequestURL()) : QUrl(); } QUrl WebContentsAdapter::getNavigationEntryUrl(int index) { - content::NavigationEntry *entry = webContents()->GetController().GetEntryAtIndex(index); + Q_D(WebContentsAdapter); + content::NavigationEntry *entry = d->webContents->GetController().GetEntryAtIndex(index); return entry ? toQt(entry->GetURL()) : QUrl(); } QString WebContentsAdapter::getNavigationEntryTitle(int index) { - content::NavigationEntry *entry = webContents()->GetController().GetEntryAtIndex(index); + Q_D(WebContentsAdapter); + content::NavigationEntry *entry = d->webContents->GetController().GetEntryAtIndex(index); return entry ? toQt(entry->GetTitle()) : QString(); } void WebContentsAdapter::clearNavigationHistory() { - if (webContents()->GetController().CanPruneAllButVisible()) - webContents()->GetController().PruneAllButVisible(); -} - -content::WebContents *WebContentsAdapter::webContents() const -{ - Q_D(const WebContentsAdapter); - return d->webContents.get(); + Q_D(WebContentsAdapter); + if (d->webContents->GetController().CanPruneAllButVisible()) + d->webContents->GetController().PruneAllButVisible(); } diff --git a/lib/web_contents_adapter.h b/lib/web_contents_adapter.h index 2bc6b9881..4d3f57b4d 100644 --- a/lib/web_contents_adapter.h +++ b/lib/web_contents_adapter.h @@ -78,7 +78,6 @@ public: void clearNavigationHistory(); private: - inline content::WebContents* webContents() const; Q_DECLARE_PRIVATE(WebContentsAdapter); QScopedPointer<WebContentsAdapterPrivate> d_ptr; }; |