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