OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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/search_tab_helper.h" | 5 #include "chrome/browser/ui/search/search_tab_helper.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 | 8 |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
176 chrome::SetInstantSupportStateInNavigationEntry(new_state, entry); | 176 chrome::SetInstantSupportStateInNavigationEntry(new_state, entry); |
177 if (!instant_support) | 177 if (!instant_support) |
178 UpdateLocationBar(web_contents_); | 178 UpdateLocationBar(web_contents_); |
179 } | 179 } |
180 } | 180 } |
181 | 181 |
182 bool SearchTabHelper::SupportsInstant() const { | 182 bool SearchTabHelper::SupportsInstant() const { |
183 return model_.instant_support() == INSTANT_SUPPORT_YES; | 183 return model_.instant_support() == INSTANT_SUPPORT_YES; |
184 } | 184 } |
185 | 185 |
| 186 void SearchTabHelper::SetSuggestionToPrefetch( |
| 187 const InstantSuggestion& suggestion) { |
| 188 ipc_router_.SetSuggestionToPrefetch(suggestion); |
| 189 } |
| 190 |
186 void SearchTabHelper::Observe( | 191 void SearchTabHelper::Observe( |
187 int type, | 192 int type, |
188 const content::NotificationSource& source, | 193 const content::NotificationSource& source, |
189 const content::NotificationDetails& details) { | 194 const content::NotificationDetails& details) { |
190 DCHECK_EQ(content::NOTIFICATION_NAV_ENTRY_COMMITTED, type); | 195 DCHECK_EQ(content::NOTIFICATION_NAV_ENTRY_COMMITTED, type); |
191 content::LoadCommittedDetails* load_details = | 196 content::LoadCommittedDetails* load_details = |
192 content::Details<content::LoadCommittedDetails>(details).ptr(); | 197 content::Details<content::LoadCommittedDetails>(details).ptr(); |
193 if (!load_details->is_main_frame) | 198 if (!load_details->is_main_frame) |
194 return; | 199 return; |
195 | 200 |
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
379 void SearchTabHelper::RedirectToLocalNTP() { | 384 void SearchTabHelper::RedirectToLocalNTP() { |
380 // Extra parentheses to declare a variable. | 385 // Extra parentheses to declare a variable. |
381 content::NavigationController::LoadURLParams load_params( | 386 content::NavigationController::LoadURLParams load_params( |
382 (GURL(chrome::kChromeSearchLocalNtpUrl))); | 387 (GURL(chrome::kChromeSearchLocalNtpUrl))); |
383 load_params.referrer = content::Referrer(); | 388 load_params.referrer = content::Referrer(); |
384 load_params.transition_type = content::PAGE_TRANSITION_SERVER_REDIRECT; | 389 load_params.transition_type = content::PAGE_TRANSITION_SERVER_REDIRECT; |
385 // Don't push a history entry. | 390 // Don't push a history entry. |
386 load_params.should_replace_current_entry = true; | 391 load_params.should_replace_current_entry = true; |
387 web_contents_->GetController().LoadURLWithParams(load_params); | 392 web_contents_->GetController().LoadURLWithParams(load_params); |
388 } | 393 } |
OLD | NEW |