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 <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
183 SearchIPCRouter& GetSearchIPCRouter() { | 183 SearchIPCRouter& GetSearchIPCRouter() { |
184 return GetSearchTabHelper(web_contents())->ipc_router(); | 184 return GetSearchTabHelper(web_contents())->ipc_router(); |
185 } | 185 } |
186 | 186 |
187 int GetSearchIPCRouterSeqNo() { | 187 int GetSearchIPCRouterSeqNo() { |
188 return GetSearchIPCRouter().page_seq_no_for_testing(); | 188 return GetSearchIPCRouter().page_seq_no_for_testing(); |
189 } | 189 } |
190 | 190 |
191 void OnMessageReceived(const IPC::Message& message) { | 191 void OnMessageReceived(const IPC::Message& message) { |
192 bool should_handle_message = | 192 bool should_handle_message = |
193 chrome::IsRenderedInInstantProcess(web_contents(), profile()); | 193 search::IsRenderedInInstantProcess(web_contents(), profile()); |
194 bool handled = GetSearchIPCRouter().OnMessageReceived(message); | 194 bool handled = GetSearchIPCRouter().OnMessageReceived(message); |
195 ASSERT_EQ(should_handle_message, handled); | 195 ASSERT_EQ(should_handle_message, handled); |
196 } | 196 } |
197 | 197 |
198 bool OnSpuriousMessageReceived(const IPC::Message& message) { | 198 bool OnSpuriousMessageReceived(const IPC::Message& message) { |
199 return GetSearchIPCRouter().OnMessageReceived(message); | 199 return GetSearchIPCRouter().OnMessageReceived(message); |
200 } | 200 } |
201 | 201 |
202 bool IsActiveTab(content::WebContents* contents) { | 202 bool IsActiveTab(content::WebContents* contents) { |
203 return GetSearchTabHelper(contents)->ipc_router().is_active_tab_; | 203 return GetSearchTabHelper(contents)->ipc_router().is_active_tab_; |
(...skipping 704 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
908 | 908 |
909 // Construct a series of synthetic messages for each valid IPC message type, | 909 // Construct a series of synthetic messages for each valid IPC message type, |
910 // ensuring the router ignores them all. | 910 // ensuring the router ignores them all. |
911 for (int i = 0; i < LastIPCMsgStart; ++i) { | 911 for (int i = 0; i < LastIPCMsgStart; ++i) { |
912 const int message_id = i << 16; | 912 const int message_id = i << 16; |
913 ASSERT_EQ(IPC_MESSAGE_ID_CLASS(message_id), i); | 913 ASSERT_EQ(IPC_MESSAGE_ID_CLASS(message_id), i); |
914 IPC::Message msg(routing_id, message_id, IPC::Message::PRIORITY_LOW); | 914 IPC::Message msg(routing_id, message_id, IPC::Message::PRIORITY_LOW); |
915 EXPECT_FALSE(OnSpuriousMessageReceived(msg)) << i; | 915 EXPECT_FALSE(OnSpuriousMessageReceived(msg)) << i; |
916 } | 916 } |
917 } | 917 } |
OLD | NEW |