| 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/prefs/pref_service.h" | 7 #include "base/prefs/pref_service.h" |
| 8 #include "base/strings/stringprintf.h" | 8 #include "base/strings/stringprintf.h" |
| 9 #include "chrome/browser/chrome_notification_types.h" | 9 #include "chrome/browser/chrome_notification_types.h" |
| 10 #include "chrome/browser/platform_util.h" | 10 #include "chrome/browser/platform_util.h" |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 | 71 |
| 72 } // namespace | 72 } // namespace |
| 73 | 73 |
| 74 InstantController::InstantController(BrowserInstantController* browser) | 74 InstantController::InstantController(BrowserInstantController* browser) |
| 75 : browser_(browser) { | 75 : browser_(browser) { |
| 76 } | 76 } |
| 77 | 77 |
| 78 InstantController::~InstantController() { | 78 InstantController::~InstantController() { |
| 79 } | 79 } |
| 80 | 80 |
| 81 bool InstantController::SubmitQuery(const base::string16& search_terms) { | 81 bool InstantController::SubmitQuery(const base::string16& search_terms, |
| 82 const EmbeddedSearchRequestParams& params) { |
| 82 if (instant_tab_ && instant_tab_->supports_instant() && | 83 if (instant_tab_ && instant_tab_->supports_instant() && |
| 83 search_mode_.is_origin_search()) { | 84 search_mode_.is_origin_search()) { |
| 84 // Use |instant_tab_| to run the query if we're already on a search results | 85 // Use |instant_tab_| to run the query if we're already on a search results |
| 85 // page. (NOTE: in particular, we do not send the query to NTPs.) | 86 // page. (NOTE: in particular, we do not send the query to NTPs.) |
| 86 SearchTabHelper::FromWebContents(instant_tab_->web_contents())->Submit( | 87 SearchTabHelper::FromWebContents(instant_tab_->web_contents())->Submit( |
| 87 search_terms); | 88 search_terms, params); |
| 88 instant_tab_->web_contents()->Focus(); | 89 instant_tab_->web_contents()->Focus(); |
| 89 EnsureSearchTermsAreSet(instant_tab_->web_contents(), search_terms); | 90 EnsureSearchTermsAreSet(instant_tab_->web_contents(), search_terms); |
| 90 return true; | 91 return true; |
| 91 } | 92 } |
| 92 return false; | 93 return false; |
| 93 } | 94 } |
| 94 | 95 |
| 95 void InstantController::SearchModeChanged(const SearchMode& old_mode, | 96 void InstantController::SearchModeChanged(const SearchMode& old_mode, |
| 96 const SearchMode& new_mode) { | 97 const SearchMode& new_mode) { |
| 97 LOG_INSTANT_DEBUG_EVENT(this, base::StringPrintf( | 98 LOG_INSTANT_DEBUG_EVENT(this, base::StringPrintf( |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 191 if (instant_service) { | 192 if (instant_service) { |
| 192 instant_service->UpdateThemeInfo(); | 193 instant_service->UpdateThemeInfo(); |
| 193 instant_service->UpdateMostVisitedItemsInfo(); | 194 instant_service->UpdateMostVisitedItemsInfo(); |
| 194 } | 195 } |
| 195 } | 196 } |
| 196 } | 197 } |
| 197 | 198 |
| 198 InstantService* InstantController::GetInstantService() const { | 199 InstantService* InstantController::GetInstantService() const { |
| 199 return InstantServiceFactory::GetForProfile(profile()); | 200 return InstantServiceFactory::GetForProfile(profile()); |
| 200 } | 201 } |
| OLD | NEW |