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