| 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/instant_controller.h" | 5 #include "chrome/browser/ui/search/instant_controller.h" |
| 6 | 6 |
| 7 #include "base/metrics/histogram.h" | 7 #include "base/metrics/histogram.h" |
| 8 #include "base/prefs/pref_service.h" | 8 #include "base/prefs/pref_service.h" |
| 9 #include "base/strings/stringprintf.h" | 9 #include "base/strings/stringprintf.h" |
| 10 #include "chrome/browser/chrome_notification_types.h" | 10 #include "chrome/browser/chrome_notification_types.h" |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 if (omnibox_bounds_ == bounds) | 118 if (omnibox_bounds_ == bounds) |
| 119 return; | 119 return; |
| 120 | 120 |
| 121 omnibox_bounds_ = bounds; | 121 omnibox_bounds_ = bounds; |
| 122 if (instant_tab_) | 122 if (instant_tab_) |
| 123 instant_tab_->sender()->SetOmniboxBounds(omnibox_bounds_); | 123 instant_tab_->sender()->SetOmniboxBounds(omnibox_bounds_); |
| 124 } | 124 } |
| 125 | 125 |
| 126 void InstantController::SetSuggestionToPrefetch( | 126 void InstantController::SetSuggestionToPrefetch( |
| 127 const InstantSuggestion& suggestion) { | 127 const InstantSuggestion& suggestion) { |
| 128 if (instant_tab_ && search_mode_.is_search()) | 128 if (instant_tab_ && search_mode_.is_search()) { |
| 129 instant_tab_->sender()->SetSuggestionToPrefetch(suggestion); | 129 SearchTabHelper::FromWebContents(instant_tab_->contents())-> |
| 130 SetSuggestionToPrefetch(suggestion); |
| 131 } |
| 130 } | 132 } |
| 131 | 133 |
| 132 void InstantController::ToggleVoiceSearch() { | 134 void InstantController::ToggleVoiceSearch() { |
| 133 if (instant_tab_) | 135 if (instant_tab_) |
| 134 instant_tab_->sender()->ToggleVoiceSearch(); | 136 instant_tab_->sender()->ToggleVoiceSearch(); |
| 135 } | 137 } |
| 136 | 138 |
| 137 void InstantController::InstantPageLoadFailed(content::WebContents* contents) { | 139 void InstantController::InstantPageLoadFailed(content::WebContents* contents) { |
| 138 if (!chrome::ShouldPreferRemoteNTPOnStartup()) { | 140 if (!chrome::ShouldPreferRemoteNTPOnStartup()) { |
| 139 // We only need to fall back on errors if we're showing the online page | 141 // We only need to fall back on errors if we're showing the online page |
| (...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 395 content::PAGE_TRANSITION_SERVER_REDIRECT, | 397 content::PAGE_TRANSITION_SERVER_REDIRECT, |
| 396 std::string()); // No extra headers. | 398 std::string()); // No extra headers. |
| 397 // TODO(dcblack): Remove extraneous history entry caused by 404s. | 399 // TODO(dcblack): Remove extraneous history entry caused by 404s. |
| 398 // Note that the base case of a 204 being returned doesn't push a history | 400 // Note that the base case of a 204 being returned doesn't push a history |
| 399 // entry. | 401 // entry. |
| 400 } | 402 } |
| 401 | 403 |
| 402 InstantService* InstantController::GetInstantService() const { | 404 InstantService* InstantController::GetInstantService() const { |
| 403 return InstantServiceFactory::GetForProfile(profile()); | 405 return InstantServiceFactory::GetForProfile(profile()); |
| 404 } | 406 } |
| OLD | NEW |