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

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

Issue 580133002: Update entry page type to include error pages when appropriate. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Compile fix for unit_tests 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 bool url_is_unreachable,
77 ui::PageTransition /* transition_type */) { 78 ui::PageTransition /* transition_type */) {
78 if (!render_frame_host->GetParent() && 79 if (!render_frame_host->GetParent() &&
79 ShouldProcessAboutToNavigateMainFrame()) 80 ShouldProcessAboutToNavigateMainFrame())
80 delegate_->InstantPageAboutToNavigateMainFrame(web_contents(), url); 81 delegate_->InstantPageAboutToNavigateMainFrame(web_contents(), url);
81 } 82 }
82 83
83 void InstantPage::ModelChanged(const SearchModel::State& old_state, 84 void InstantPage::ModelChanged(const SearchModel::State& old_state,
84 const SearchModel::State& new_state) { 85 const SearchModel::State& new_state) {
85 if (old_state.instant_support != new_state.instant_support) 86 if (old_state.instant_support != new_state.instant_support)
86 InstantSupportDetermined(new_state.instant_support == INSTANT_SUPPORT_YES); 87 InstantSupportDetermined(new_state.instant_support == INSTANT_SUPPORT_YES);
87 } 88 }
88 89
89 void InstantPage::InstantSupportDetermined(bool supports_instant) { 90 void InstantPage::InstantSupportDetermined(bool supports_instant) {
90 delegate_->InstantSupportDetermined(web_contents(), supports_instant); 91 delegate_->InstantSupportDetermined(web_contents(), supports_instant);
91 92
92 // If the page doesn't support Instant, stop listening to it. 93 // If the page doesn't support Instant, stop listening to it.
93 if (!supports_instant) 94 if (!supports_instant)
94 ClearContents(); 95 ClearContents();
95 } 96 }
96 97
97 void InstantPage::ClearContents() { 98 void InstantPage::ClearContents() {
98 if (web_contents()) { 99 if (web_contents()) {
99 SearchTabHelper::FromWebContents(web_contents())->model()->RemoveObserver( 100 SearchTabHelper::FromWebContents(web_contents())->model()->RemoveObserver(
100 this); 101 this);
101 } 102 }
102 103
103 Observe(NULL); 104 Observe(NULL);
104 } 105 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698