| 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/search/search.h" | 7 #include "chrome/browser/search/search.h" |
| 8 #include "chrome/common/render_messages.h" | 8 #include "chrome/common/render_messages.h" |
| 9 #include "content/public/browser/web_contents.h" | 9 #include "content/public/browser/web_contents.h" |
| 10 | 10 |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 | 43 |
| 44 void SearchIPCRouter::SendMostVisitedItems( | 44 void SearchIPCRouter::SendMostVisitedItems( |
| 45 const std::vector<InstantMostVisitedItem>& items) { | 45 const std::vector<InstantMostVisitedItem>& items) { |
| 46 if (!policy_->ShouldSendMostVisitedItems()) | 46 if (!policy_->ShouldSendMostVisitedItems()) |
| 47 return; | 47 return; |
| 48 | 48 |
| 49 Send(new ChromeViewMsg_SearchBoxMostVisitedItemsChanged( | 49 Send(new ChromeViewMsg_SearchBoxMostVisitedItemsChanged( |
| 50 routing_id(), items)); | 50 routing_id(), items)); |
| 51 } | 51 } |
| 52 | 52 |
| 53 void SearchIPCRouter::SetSuggestionToPrefetch( |
| 54 const InstantSuggestion& suggestion) { |
| 55 if (!policy_->ShouldSendSetSuggestionToPrefetch()) |
| 56 return; |
| 57 |
| 58 Send(new ChromeViewMsg_SearchBoxSetSuggestionToPrefetch(routing_id(), |
| 59 suggestion)); |
| 60 } |
| 61 |
| 53 bool SearchIPCRouter::OnMessageReceived(const IPC::Message& message) { | 62 bool SearchIPCRouter::OnMessageReceived(const IPC::Message& message) { |
| 54 bool handled = true; | 63 bool handled = true; |
| 55 IPC_BEGIN_MESSAGE_MAP(SearchIPCRouter, message) | 64 IPC_BEGIN_MESSAGE_MAP(SearchIPCRouter, message) |
| 56 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_InstantSupportDetermined, | 65 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_InstantSupportDetermined, |
| 57 OnInstantSupportDetermined) | 66 OnInstantSupportDetermined) |
| 58 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_SetVoiceSearchSupported, | 67 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_SetVoiceSearchSupported, |
| 59 OnVoiceSearchSupportDetermined) | 68 OnVoiceSearchSupportDetermined) |
| 60 IPC_MESSAGE_UNHANDLED(handled = false) | 69 IPC_MESSAGE_UNHANDLED(handled = false) |
| 61 IPC_END_MESSAGE_MAP() | 70 IPC_END_MESSAGE_MAP() |
| 62 return handled; | 71 return handled; |
| (...skipping 19 matching lines...) Expand all Loading... |
| 82 | 91 |
| 83 void SearchIPCRouter::set_delegate(Delegate* delegate) { | 92 void SearchIPCRouter::set_delegate(Delegate* delegate) { |
| 84 DCHECK(delegate); | 93 DCHECK(delegate); |
| 85 delegate_ = delegate; | 94 delegate_ = delegate; |
| 86 } | 95 } |
| 87 | 96 |
| 88 void SearchIPCRouter::set_policy(scoped_ptr<Policy> policy) { | 97 void SearchIPCRouter::set_policy(scoped_ptr<Policy> policy) { |
| 89 DCHECK(policy.get()); | 98 DCHECK(policy.get()); |
| 90 policy_.reset(policy.release()); | 99 policy_.reset(policy.release()); |
| 91 } | 100 } |
| OLD | NEW |