| OLD | NEW |
| 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/search_ipc_router.h" | 5 #include "chrome/browser/ui/search/search_ipc_router.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "chrome/browser/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
| 10 #include "chrome/browser/search/search.h" | 10 #include "chrome/browser/search/search.h" |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 identity_match)); | 47 identity_match)); |
| 48 } | 48 } |
| 49 | 49 |
| 50 void SearchIPCRouter::SendHistorySyncCheckResult(bool sync_history) { | 50 void SearchIPCRouter::SendHistorySyncCheckResult(bool sync_history) { |
| 51 if (!policy_->ShouldProcessHistorySyncCheck()) | 51 if (!policy_->ShouldProcessHistorySyncCheck()) |
| 52 return; | 52 return; |
| 53 | 53 |
| 54 Send(new ChromeViewMsg_HistorySyncCheckResult(routing_id(), sync_history)); | 54 Send(new ChromeViewMsg_HistorySyncCheckResult(routing_id(), sync_history)); |
| 55 } | 55 } |
| 56 | 56 |
| 57 void SearchIPCRouter::SetDisplayInstantResults() { | |
| 58 if (!policy_->ShouldSendSetDisplayInstantResults()) | |
| 59 return; | |
| 60 | |
| 61 bool is_search_results_page = !search::GetSearchTerms(web_contents()).empty(); | |
| 62 bool display_instant_results = | |
| 63 is_search_results_page ? search::ShouldPrefetchSearchResultsOnSRP() | |
| 64 : search::ShouldPrefetchSearchResults(); | |
| 65 Send(new ChromeViewMsg_SearchBoxSetDisplayInstantResults( | |
| 66 routing_id(), display_instant_results)); | |
| 67 } | |
| 68 | |
| 69 void SearchIPCRouter::SetSuggestionToPrefetch( | 57 void SearchIPCRouter::SetSuggestionToPrefetch( |
| 70 const InstantSuggestion& suggestion) { | 58 const InstantSuggestion& suggestion) { |
| 71 if (!policy_->ShouldSendSetSuggestionToPrefetch()) | 59 if (!policy_->ShouldSendSetSuggestionToPrefetch()) |
| 72 return; | 60 return; |
| 73 | 61 |
| 74 Send(new ChromeViewMsg_SearchBoxSetSuggestionToPrefetch(routing_id(), | 62 Send(new ChromeViewMsg_SearchBoxSetSuggestionToPrefetch(routing_id(), |
| 75 suggestion)); | 63 suggestion)); |
| 76 } | 64 } |
| 77 | 65 |
| 78 void SearchIPCRouter::SetInputInProgress(bool input_in_progress) { | 66 void SearchIPCRouter::SetInputInProgress(bool input_in_progress) { |
| (...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 291 | 279 |
| 292 void SearchIPCRouter::set_delegate_for_testing(Delegate* delegate) { | 280 void SearchIPCRouter::set_delegate_for_testing(Delegate* delegate) { |
| 293 DCHECK(delegate); | 281 DCHECK(delegate); |
| 294 delegate_ = delegate; | 282 delegate_ = delegate; |
| 295 } | 283 } |
| 296 | 284 |
| 297 void SearchIPCRouter::set_policy_for_testing(std::unique_ptr<Policy> policy) { | 285 void SearchIPCRouter::set_policy_for_testing(std::unique_ptr<Policy> policy) { |
| 298 DCHECK(policy.get()); | 286 DCHECK(policy.get()); |
| 299 policy_.reset(policy.release()); | 287 policy_.reset(policy.release()); |
| 300 } | 288 } |
| OLD | NEW |