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

Side by Side Diff: chrome/browser/ui/search/instant_page.cc

Issue 562603002: Move PageTransition from //content/public/common to //ui/base (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase 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 unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/ui/search/instant_page.h" 5 #include "chrome/browser/ui/search/instant_page.h"
6 6
7 #include "chrome/browser/profiles/profile.h" 7 #include "chrome/browser/profiles/profile.h"
8 #include "chrome/browser/search/search.h" 8 #include "chrome/browser/search/search.h"
9 #include "chrome/browser/ui/search/search_model.h" 9 #include "chrome/browser/ui/search/search_model.h"
10 #include "chrome/browser/ui/search/search_tab_helper.h" 10 #include "chrome/browser/ui/search/search_tab_helper.h"
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 InstantSupportDetermined(model->instant_support() == INSTANT_SUPPORT_YES); 67 InstantSupportDetermined(model->instant_support() == INSTANT_SUPPORT_YES);
68 } 68 }
69 69
70 bool InstantPage::ShouldProcessAboutToNavigateMainFrame() { 70 bool InstantPage::ShouldProcessAboutToNavigateMainFrame() {
71 return false; 71 return false;
72 } 72 }
73 73
74 void InstantPage::DidCommitProvisionalLoadForFrame( 74 void InstantPage::DidCommitProvisionalLoadForFrame(
75 content::RenderFrameHost* render_frame_host, 75 content::RenderFrameHost* render_frame_host,
76 const GURL& url, 76 const GURL& url,
77 content::PageTransition /* transition_type */) { 77 ui::PageTransition /* transition_type */) {
78 if (!render_frame_host->GetParent() && 78 if (!render_frame_host->GetParent() &&
79 ShouldProcessAboutToNavigateMainFrame()) 79 ShouldProcessAboutToNavigateMainFrame())
80 delegate_->InstantPageAboutToNavigateMainFrame(web_contents(), url); 80 delegate_->InstantPageAboutToNavigateMainFrame(web_contents(), url);
81 } 81 }
82 82
83 void InstantPage::ModelChanged(const SearchModel::State& old_state, 83 void InstantPage::ModelChanged(const SearchModel::State& old_state,
84 const SearchModel::State& new_state) { 84 const SearchModel::State& new_state) {
85 if (old_state.instant_support != new_state.instant_support) 85 if (old_state.instant_support != new_state.instant_support)
86 InstantSupportDetermined(new_state.instant_support == INSTANT_SUPPORT_YES); 86 InstantSupportDetermined(new_state.instant_support == INSTANT_SUPPORT_YES);
87 } 87 }
88 88
89 void InstantPage::InstantSupportDetermined(bool supports_instant) { 89 void InstantPage::InstantSupportDetermined(bool supports_instant) {
90 delegate_->InstantSupportDetermined(web_contents(), supports_instant); 90 delegate_->InstantSupportDetermined(web_contents(), supports_instant);
91 91
92 // If the page doesn't support Instant, stop listening to it. 92 // If the page doesn't support Instant, stop listening to it.
93 if (!supports_instant) 93 if (!supports_instant)
94 ClearContents(); 94 ClearContents();
95 } 95 }
96 96
97 void InstantPage::ClearContents() { 97 void InstantPage::ClearContents() {
98 if (web_contents()) { 98 if (web_contents()) {
99 SearchTabHelper::FromWebContents(web_contents())->model()->RemoveObserver( 99 SearchTabHelper::FromWebContents(web_contents())->model()->RemoveObserver(
100 this); 100 this);
101 } 101 }
102 102
103 Observe(NULL); 103 Observe(NULL);
104 } 104 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/search/instant_page.h ('k') | chrome/browser/ui/search/instant_page_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698