| 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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 Send(new ChromeViewMsg_SearchBoxPromoInformation(routing_id(), | 61 Send(new ChromeViewMsg_SearchBoxPromoInformation(routing_id(), |
| 62 is_app_launcher_enabled)); | 62 is_app_launcher_enabled)); |
| 63 } | 63 } |
| 64 | 64 |
| 65 void SearchIPCRouter::SetDisplayInstantResults() { | 65 void SearchIPCRouter::SetDisplayInstantResults() { |
| 66 if (!policy_->ShouldSendSetDisplayInstantResults()) | 66 if (!policy_->ShouldSendSetDisplayInstantResults()) |
| 67 return; | 67 return; |
| 68 | 68 |
| 69 bool is_search_results_page = !search::GetSearchTerms(web_contents()).empty(); | 69 bool is_search_results_page = !search::GetSearchTerms(web_contents()).empty(); |
| 70 bool display_instant_results = | 70 bool display_instant_results = |
| 71 is_search_results_page ? search::ShouldPrefetchSearchResultsOnSRP() | 71 !is_search_results_page && search::ShouldPrefetchSearchResults(); |
| 72 : search::ShouldPrefetchSearchResults(); | |
| 73 Send(new ChromeViewMsg_SearchBoxSetDisplayInstantResults( | 72 Send(new ChromeViewMsg_SearchBoxSetDisplayInstantResults( |
| 74 routing_id(), display_instant_results)); | 73 routing_id(), display_instant_results)); |
| 75 } | 74 } |
| 76 | 75 |
| 77 void SearchIPCRouter::SetSuggestionToPrefetch( | 76 void SearchIPCRouter::SetSuggestionToPrefetch( |
| 78 const InstantSuggestion& suggestion) { | 77 const InstantSuggestion& suggestion) { |
| 79 if (!policy_->ShouldSendSetSuggestionToPrefetch()) | 78 if (!policy_->ShouldSendSetSuggestionToPrefetch()) |
| 80 return; | 79 return; |
| 81 | 80 |
| 82 Send(new ChromeViewMsg_SearchBoxSetSuggestionToPrefetch(routing_id(), | 81 Send(new ChromeViewMsg_SearchBoxSetSuggestionToPrefetch(routing_id(), |
| (...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 299 | 298 |
| 300 void SearchIPCRouter::set_delegate_for_testing(Delegate* delegate) { | 299 void SearchIPCRouter::set_delegate_for_testing(Delegate* delegate) { |
| 301 DCHECK(delegate); | 300 DCHECK(delegate); |
| 302 delegate_ = delegate; | 301 delegate_ = delegate; |
| 303 } | 302 } |
| 304 | 303 |
| 305 void SearchIPCRouter::set_policy_for_testing(std::unique_ptr<Policy> policy) { | 304 void SearchIPCRouter::set_policy_for_testing(std::unique_ptr<Policy> policy) { |
| 306 DCHECK(policy.get()); | 305 DCHECK(policy.get()); |
| 307 policy_.reset(policy.release()); | 306 policy_.reset(policy.release()); |
| 308 } | 307 } |
| OLD | NEW |