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

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

Issue 18223002: InstantExtended: Remove overlay control code. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Call renamed method. Created 7 years, 5 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 | Annotate | Revision Log
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 "apps/app_launcher.h" 7 #include "apps/app_launcher.h"
8 #include "base/strings/utf_string_conversions.h" 8 #include "base/strings/utf_string_conversions.h"
9 #include "chrome/browser/search/search.h" 9 #include "chrome/browser/search/search.h"
10 #include "chrome/browser/ui/search/search_model.h" 10 #include "chrome/browser/ui/search/search_model.h"
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 82
83 // Already know whether the page supports instant. 83 // Already know whether the page supports instant.
84 if (model->instant_support() != INSTANT_SUPPORT_UNKNOWN) 84 if (model->instant_support() != INSTANT_SUPPORT_UNKNOWN)
85 InstantSupportDetermined(model->instant_support() == INSTANT_SUPPORT_YES); 85 InstantSupportDetermined(model->instant_support() == INSTANT_SUPPORT_YES);
86 } 86 }
87 87
88 bool InstantPage::ShouldProcessAboutToNavigateMainFrame() { 88 bool InstantPage::ShouldProcessAboutToNavigateMainFrame() {
89 return false; 89 return false;
90 } 90 }
91 91
92 bool InstantPage::ShouldProcessSetSuggestions() {
93 return false;
94 }
95
96 bool InstantPage::ShouldProcessShowInstantOverlay() {
97 return false;
98 }
99
100 bool InstantPage::ShouldProcessFocusOmnibox() { 92 bool InstantPage::ShouldProcessFocusOmnibox() {
101 return false; 93 return false;
102 } 94 }
103 95
104 bool InstantPage::ShouldProcessNavigateToURL() { 96 bool InstantPage::ShouldProcessNavigateToURL() {
105 return false; 97 return false;
106 } 98 }
107 99
108 bool InstantPage::ShouldProcessDeleteMostVisitedItem() { 100 bool InstantPage::ShouldProcessDeleteMostVisitedItem() {
109 return false; 101 return false;
110 } 102 }
111 103
112 bool InstantPage::ShouldProcessUndoMostVisitedDeletion() { 104 bool InstantPage::ShouldProcessUndoMostVisitedDeletion() {
113 return false; 105 return false;
114 } 106 }
115 107
116 bool InstantPage::ShouldProcessUndoAllMostVisitedDeletions() { 108 bool InstantPage::ShouldProcessUndoAllMostVisitedDeletions() {
117 return false; 109 return false;
118 } 110 }
119 111
120 bool InstantPage::OnMessageReceived(const IPC::Message& message) { 112 bool InstantPage::OnMessageReceived(const IPC::Message& message) {
121 if (is_incognito_) 113 if (is_incognito_)
122 return false; 114 return false;
123 115
124 bool handled = true; 116 bool handled = true;
125 IPC_BEGIN_MESSAGE_MAP(InstantPage, message) 117 IPC_BEGIN_MESSAGE_MAP(InstantPage, message)
126 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_SetSuggestions, OnSetSuggestions)
127 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_ShowInstantOverlay,
128 OnShowInstantOverlay)
129 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_FocusOmnibox, OnFocusOmnibox) 118 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_FocusOmnibox, OnFocusOmnibox)
130 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_SearchBoxNavigate, 119 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_SearchBoxNavigate,
131 OnSearchBoxNavigate); 120 OnSearchBoxNavigate);
132 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_SearchBoxDeleteMostVisitedItem, 121 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_SearchBoxDeleteMostVisitedItem,
133 OnDeleteMostVisitedItem); 122 OnDeleteMostVisitedItem);
134 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_SearchBoxUndoMostVisitedDeletion, 123 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_SearchBoxUndoMostVisitedDeletion,
135 OnUndoMostVisitedDeletion); 124 OnUndoMostVisitedDeletion);
136 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_SearchBoxUndoAllMostVisitedDeletions, 125 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_SearchBoxUndoAllMostVisitedDeletions,
137 OnUndoAllMostVisitedDeletions); 126 OnUndoAllMostVisitedDeletions);
138 IPC_MESSAGE_UNHANDLED(handled = false) 127 IPC_MESSAGE_UNHANDLED(handled = false)
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 } 167 }
179 168
180 void InstantPage::InstantSupportDetermined(bool supports_instant) { 169 void InstantPage::InstantSupportDetermined(bool supports_instant) {
181 delegate_->InstantSupportDetermined(contents(), supports_instant); 170 delegate_->InstantSupportDetermined(contents(), supports_instant);
182 171
183 // If the page doesn't support Instant, stop listening to it. 172 // If the page doesn't support Instant, stop listening to it.
184 if (!supports_instant) 173 if (!supports_instant)
185 ClearContents(); 174 ClearContents();
186 } 175 }
187 176
188 void InstantPage::OnSetSuggestions(
189 int page_id,
190 const std::vector<InstantSuggestion>& suggestions) {
191 if (!contents()->IsActiveEntry(page_id))
192 return;
193
194 SearchTabHelper::FromWebContents(contents())->InstantSupportChanged(true);
195 if (!ShouldProcessSetSuggestions())
196 return;
197
198 delegate_->SetSuggestions(contents(), suggestions);
199 }
200
201 void InstantPage::OnShowInstantOverlay(int page_id,
202 int height,
203 InstantSizeUnits units) {
204 if (!contents()->IsActiveEntry(page_id))
205 return;
206
207 SearchTabHelper::FromWebContents(contents())->InstantSupportChanged(true);
208 delegate_->LogDropdownShown();
209 if (!ShouldProcessShowInstantOverlay())
210 return;
211
212 delegate_->ShowInstantOverlay(contents(), height, units);
213 }
214
215 void InstantPage::OnFocusOmnibox(int page_id, OmniboxFocusState state) { 177 void InstantPage::OnFocusOmnibox(int page_id, OmniboxFocusState state) {
216 if (!contents()->IsActiveEntry(page_id)) 178 if (!contents()->IsActiveEntry(page_id))
217 return; 179 return;
218 180
219 SearchTabHelper::FromWebContents(contents())->InstantSupportChanged(true); 181 SearchTabHelper::FromWebContents(contents())->InstantSupportChanged(true);
220 if (!ShouldProcessFocusOmnibox()) 182 if (!ShouldProcessFocusOmnibox())
221 return; 183 return;
222 184
223 delegate_->FocusOmnibox(contents(), state); 185 delegate_->FocusOmnibox(contents(), state);
224 } 186 }
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
272 delegate_->UndoAllMostVisitedDeletions(); 234 delegate_->UndoAllMostVisitedDeletions();
273 } 235 }
274 236
275 void InstantPage::ClearContents() { 237 void InstantPage::ClearContents() {
276 if (contents()) 238 if (contents())
277 SearchTabHelper::FromWebContents(contents())->model()->RemoveObserver(this); 239 SearchTabHelper::FromWebContents(contents())->model()->RemoveObserver(this);
278 240
279 sender()->SetContents(NULL); 241 sender()->SetContents(NULL);
280 Observe(NULL); 242 Observe(NULL);
281 } 243 }
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