| 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 "chrome/browser/profiles/profile.h" | 7 #include "chrome/browser/profiles/profile.h" |
| 8 #include "chrome/browser/search/search.h" | 8 #include "chrome/browser/search/search.h" |
| 9 #include "chrome/common/render_messages.h" | 9 #include "chrome/common/render_messages.h" |
| 10 #include "content/public/browser/navigation_details.h" | 10 #include "content/public/browser/navigation_details.h" |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 | 67 |
| 68 Send(new ChromeViewMsg_SearchBoxPromoInformation(routing_id(), | 68 Send(new ChromeViewMsg_SearchBoxPromoInformation(routing_id(), |
| 69 is_app_launcher_enabled)); | 69 is_app_launcher_enabled)); |
| 70 } | 70 } |
| 71 | 71 |
| 72 void SearchIPCRouter::SetDisplayInstantResults() { | 72 void SearchIPCRouter::SetDisplayInstantResults() { |
| 73 if (!policy_->ShouldSendSetDisplayInstantResults()) | 73 if (!policy_->ShouldSendSetDisplayInstantResults()) |
| 74 return; | 74 return; |
| 75 | 75 |
| 76 bool is_search_results_page = !chrome::GetSearchTerms(web_contents()).empty(); | 76 bool is_search_results_page = !chrome::GetSearchTerms(web_contents()).empty(); |
| 77 bool display_instant_results = is_search_results_page ? |
| 78 chrome::ShouldPrefetchSearchResultsOnSRP() : |
| 79 chrome::ShouldPrefetchSearchResults(); |
| 77 Send(new ChromeViewMsg_SearchBoxSetDisplayInstantResults( | 80 Send(new ChromeViewMsg_SearchBoxSetDisplayInstantResults( |
| 78 routing_id(), | 81 routing_id(), display_instant_results)); |
| 79 (is_search_results_page && chrome::ShouldPrefetchSearchResultsOnSRP()) || | |
| 80 chrome::ShouldPrefetchSearchResults())); | |
| 81 } | 82 } |
| 82 | 83 |
| 83 void SearchIPCRouter::SetSuggestionToPrefetch( | 84 void SearchIPCRouter::SetSuggestionToPrefetch( |
| 84 const InstantSuggestion& suggestion) { | 85 const InstantSuggestion& suggestion) { |
| 85 if (!policy_->ShouldSendSetSuggestionToPrefetch()) | 86 if (!policy_->ShouldSendSetSuggestionToPrefetch()) |
| 86 return; | 87 return; |
| 87 | 88 |
| 88 Send(new ChromeViewMsg_SearchBoxSetSuggestionToPrefetch(routing_id(), | 89 Send(new ChromeViewMsg_SearchBoxSetSuggestionToPrefetch(routing_id(), |
| 89 suggestion)); | 90 suggestion)); |
| 90 } | 91 } |
| (...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 333 | 334 |
| 334 void SearchIPCRouter::set_delegate_for_testing(Delegate* delegate) { | 335 void SearchIPCRouter::set_delegate_for_testing(Delegate* delegate) { |
| 335 DCHECK(delegate); | 336 DCHECK(delegate); |
| 336 delegate_ = delegate; | 337 delegate_ = delegate; |
| 337 } | 338 } |
| 338 | 339 |
| 339 void SearchIPCRouter::set_policy_for_testing(scoped_ptr<Policy> policy) { | 340 void SearchIPCRouter::set_policy_for_testing(scoped_ptr<Policy> policy) { |
| 340 DCHECK(policy.get()); | 341 DCHECK(policy.get()); |
| 341 policy_.reset(policy.release()); | 342 policy_.reset(policy.release()); |
| 342 } | 343 } |
| OLD | NEW |