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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 void SearchIPCRouter::SendChromeIdentityCheckResult( | 54 void SearchIPCRouter::SendChromeIdentityCheckResult( |
55 const base::string16& identity, | 55 const base::string16& identity, |
56 bool identity_match) { | 56 bool identity_match) { |
57 if (!policy_->ShouldProcessChromeIdentityCheck()) | 57 if (!policy_->ShouldProcessChromeIdentityCheck()) |
58 return; | 58 return; |
59 | 59 |
60 Send(new ChromeViewMsg_ChromeIdentityCheckResult(routing_id(), identity, | 60 Send(new ChromeViewMsg_ChromeIdentityCheckResult(routing_id(), identity, |
61 identity_match)); | 61 identity_match)); |
62 } | 62 } |
63 | 63 |
| 64 void SearchIPCRouter::SendHistorySyncCheckResult(bool sync_history) { |
| 65 if (!policy_->ShouldProcessHistorySyncCheck()) |
| 66 return; |
| 67 |
| 68 Send(new ChromeViewMsg_HistorySyncCheckResult(routing_id(), sync_history)); |
| 69 } |
| 70 |
64 void SearchIPCRouter::SetPromoInformation(bool is_app_launcher_enabled) { | 71 void SearchIPCRouter::SetPromoInformation(bool is_app_launcher_enabled) { |
65 if (!policy_->ShouldSendSetPromoInformation()) | 72 if (!policy_->ShouldSendSetPromoInformation()) |
66 return; | 73 return; |
67 | 74 |
68 Send(new ChromeViewMsg_SearchBoxPromoInformation(routing_id(), | 75 Send(new ChromeViewMsg_SearchBoxPromoInformation(routing_id(), |
69 is_app_launcher_enabled)); | 76 is_app_launcher_enabled)); |
70 } | 77 } |
71 | 78 |
72 void SearchIPCRouter::SetDisplayInstantResults() { | 79 void SearchIPCRouter::SetDisplayInstantResults() { |
73 if (!policy_->ShouldSendSetDisplayInstantResults()) | 80 if (!policy_->ShouldSendSetDisplayInstantResults()) |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
173 OnUndoMostVisitedDeletion); | 180 OnUndoMostVisitedDeletion); |
174 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_SearchBoxUndoAllMostVisitedDeletions, | 181 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_SearchBoxUndoAllMostVisitedDeletions, |
175 OnUndoAllMostVisitedDeletions); | 182 OnUndoAllMostVisitedDeletions); |
176 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_LogEvent, OnLogEvent); | 183 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_LogEvent, OnLogEvent); |
177 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_LogMostVisitedImpression, | 184 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_LogMostVisitedImpression, |
178 OnLogMostVisitedImpression); | 185 OnLogMostVisitedImpression); |
179 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_LogMostVisitedNavigation, | 186 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_LogMostVisitedNavigation, |
180 OnLogMostVisitedNavigation); | 187 OnLogMostVisitedNavigation); |
181 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_PasteAndOpenDropdown, | 188 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_PasteAndOpenDropdown, |
182 OnPasteAndOpenDropDown); | 189 OnPasteAndOpenDropDown); |
| 190 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_HistorySyncCheck, |
| 191 OnHistorySyncCheck); |
183 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_ChromeIdentityCheck, | 192 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_ChromeIdentityCheck, |
184 OnChromeIdentityCheck); | 193 OnChromeIdentityCheck); |
185 IPC_MESSAGE_UNHANDLED(handled = false) | 194 IPC_MESSAGE_UNHANDLED(handled = false) |
186 IPC_END_MESSAGE_MAP() | 195 IPC_END_MESSAGE_MAP() |
187 return handled; | 196 return handled; |
188 } | 197 } |
189 | 198 |
190 void SearchIPCRouter::OnInstantSupportDetermined(int page_seq_no, | 199 void SearchIPCRouter::OnInstantSupportDetermined(int page_seq_no, |
191 bool instant_support) const { | 200 bool instant_support) const { |
192 if (page_seq_no != commit_counter_) | 201 if (page_seq_no != commit_counter_) |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
326 if (page_seq_no != commit_counter_) | 335 if (page_seq_no != commit_counter_) |
327 return; | 336 return; |
328 | 337 |
329 delegate_->OnInstantSupportDetermined(true); | 338 delegate_->OnInstantSupportDetermined(true); |
330 if (!policy_->ShouldProcessChromeIdentityCheck()) | 339 if (!policy_->ShouldProcessChromeIdentityCheck()) |
331 return; | 340 return; |
332 | 341 |
333 delegate_->OnChromeIdentityCheck(identity); | 342 delegate_->OnChromeIdentityCheck(identity); |
334 } | 343 } |
335 | 344 |
| 345 void SearchIPCRouter::OnHistorySyncCheck(int page_seq_no) const { |
| 346 if (page_seq_no != commit_counter_) |
| 347 return; |
| 348 |
| 349 delegate_->OnInstantSupportDetermined(true); |
| 350 if (!policy_->ShouldProcessHistorySyncCheck()) |
| 351 return; |
| 352 |
| 353 delegate_->OnHistorySyncCheck(); |
| 354 } |
| 355 |
336 void SearchIPCRouter::set_delegate_for_testing(Delegate* delegate) { | 356 void SearchIPCRouter::set_delegate_for_testing(Delegate* delegate) { |
337 DCHECK(delegate); | 357 DCHECK(delegate); |
338 delegate_ = delegate; | 358 delegate_ = delegate; |
339 } | 359 } |
340 | 360 |
341 void SearchIPCRouter::set_policy_for_testing(scoped_ptr<Policy> policy) { | 361 void SearchIPCRouter::set_policy_for_testing(scoped_ptr<Policy> policy) { |
342 DCHECK(policy.get()); | 362 DCHECK(policy.get()); |
343 policy_.reset(policy.release()); | 363 policy_.reset(policy.release()); |
344 } | 364 } |
OLD | NEW |