Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(7368)

Unified Diff: chrome/browser/ui/search/instant_page.cc

Issue 525793002: Make WebContentsObserver::web_contents() public (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Comments addressed Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/search/instant_page.h ('k') | chrome/browser/ui/tabs/tab_strip_model.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/search/instant_page.cc
diff --git a/chrome/browser/ui/search/instant_page.cc b/chrome/browser/ui/search/instant_page.cc
index 2e2fa1e04111e483f658cd169eddd84124417ff3..07d09a2392787d9b022c9a706337482bd41ba652 100644
--- a/chrome/browser/ui/search/instant_page.cc
+++ b/chrome/browser/ui/search/instant_page.cc
@@ -23,13 +23,15 @@ InstantPage::Delegate::~Delegate() {
}
InstantPage::~InstantPage() {
- if (contents())
- SearchTabHelper::FromWebContents(contents())->model()->RemoveObserver(this);
+ if (web_contents()) {
+ SearchTabHelper::FromWebContents(web_contents())->model()->RemoveObserver(
+ this);
+ }
}
bool InstantPage::supports_instant() const {
- return contents() ?
- SearchTabHelper::FromWebContents(contents())->SupportsInstant() : false;
+ return web_contents() &&
+ SearchTabHelper::FromWebContents(web_contents())->SupportsInstant();
}
const std::string& InstantPage::instant_url() const {
@@ -37,8 +39,8 @@ const std::string& InstantPage::instant_url() const {
}
bool InstantPage::IsLocal() const {
- return contents() &&
- contents()->GetURL() == GURL(chrome::kChromeSearchLocalNtpUrl);
+ return web_contents() &&
+ web_contents()->GetURL() == GURL(chrome::kChromeSearchLocalNtpUrl);
}
InstantPage::InstantPage(Delegate* delegate, const std::string& instant_url,
@@ -49,14 +51,15 @@ InstantPage::InstantPage(Delegate* delegate, const std::string& instant_url,
is_incognito_(is_incognito) {
}
-void InstantPage::SetContents(content::WebContents* web_contents) {
+void InstantPage::SetContents(content::WebContents* new_web_contents) {
ClearContents();
- if (!web_contents)
+ if (!new_web_contents)
return;
- Observe(web_contents);
- SearchModel* model = SearchTabHelper::FromWebContents(contents())->model();
+ Observe(new_web_contents);
+ SearchModel* model =
+ SearchTabHelper::FromWebContents(web_contents())->model();
model->AddObserver(this);
// Already know whether the page supports instant.
@@ -74,7 +77,7 @@ void InstantPage::DidCommitProvisionalLoadForFrame(
content::PageTransition /* transition_type */) {
if (!render_frame_host->GetParent() &&
ShouldProcessAboutToNavigateMainFrame())
- delegate_->InstantPageAboutToNavigateMainFrame(contents(), url);
+ delegate_->InstantPageAboutToNavigateMainFrame(web_contents(), url);
}
void InstantPage::ModelChanged(const SearchModel::State& old_state,
@@ -84,7 +87,7 @@ void InstantPage::ModelChanged(const SearchModel::State& old_state,
}
void InstantPage::InstantSupportDetermined(bool supports_instant) {
- delegate_->InstantSupportDetermined(contents(), supports_instant);
+ delegate_->InstantSupportDetermined(web_contents(), supports_instant);
// If the page doesn't support Instant, stop listening to it.
if (!supports_instant)
@@ -92,8 +95,10 @@ void InstantPage::InstantSupportDetermined(bool supports_instant) {
}
void InstantPage::ClearContents() {
- if (contents())
- SearchTabHelper::FromWebContents(contents())->model()->RemoveObserver(this);
+ if (web_contents()) {
+ SearchTabHelper::FromWebContents(web_contents())->model()->RemoveObserver(
+ this);
+ }
Observe(NULL);
}
« no previous file with comments | « chrome/browser/ui/search/instant_page.h ('k') | chrome/browser/ui/tabs/tab_strip_model.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698