| 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 <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "chrome/browser/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
| 10 #include "chrome/browser/search/instant_service.h" | 10 #include "chrome/browser/search/instant_service.h" |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 DCHECK(policy_.get()); | 100 DCHECK(policy_.get()); |
| 101 } | 101 } |
| 102 | 102 |
| 103 SearchIPCRouter::~SearchIPCRouter() = default; | 103 SearchIPCRouter::~SearchIPCRouter() = default; |
| 104 | 104 |
| 105 void SearchIPCRouter::OnNavigationEntryCommitted() { | 105 void SearchIPCRouter::OnNavigationEntryCommitted() { |
| 106 ++commit_counter_; | 106 ++commit_counter_; |
| 107 search_box()->SetPageSequenceNumber(commit_counter_); | 107 search_box()->SetPageSequenceNumber(commit_counter_); |
| 108 } | 108 } |
| 109 | 109 |
| 110 void SearchIPCRouter::DetermineIfPageSupportsInstant() { | |
| 111 search_box()->DetermineIfPageSupportsInstant(); | |
| 112 } | |
| 113 | |
| 114 void SearchIPCRouter::SendChromeIdentityCheckResult( | 110 void SearchIPCRouter::SendChromeIdentityCheckResult( |
| 115 const base::string16& identity, | 111 const base::string16& identity, |
| 116 bool identity_match) { | 112 bool identity_match) { |
| 117 if (!policy_->ShouldProcessChromeIdentityCheck()) | 113 if (!policy_->ShouldProcessChromeIdentityCheck()) |
| 118 return; | 114 return; |
| 119 | 115 |
| 120 search_box()->ChromeIdentityCheckResult(identity, identity_match); | 116 search_box()->ChromeIdentityCheckResult(identity, identity_match); |
| 121 } | 117 } |
| 122 | 118 |
| 123 void SearchIPCRouter::SendHistorySyncCheckResult(bool sync_history) { | 119 void SearchIPCRouter::SendHistorySyncCheckResult(bool sync_history) { |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 175 } | 171 } |
| 176 | 172 |
| 177 void SearchIPCRouter::OnTabActivated() { | 173 void SearchIPCRouter::OnTabActivated() { |
| 178 is_active_tab_ = true; | 174 is_active_tab_ = true; |
| 179 } | 175 } |
| 180 | 176 |
| 181 void SearchIPCRouter::OnTabDeactivated() { | 177 void SearchIPCRouter::OnTabDeactivated() { |
| 182 is_active_tab_ = false; | 178 is_active_tab_ = false; |
| 183 } | 179 } |
| 184 | 180 |
| 185 void SearchIPCRouter::InstantSupportDetermined(int page_seq_no, | |
| 186 bool instant_support) { | |
| 187 if (page_seq_no != commit_counter_) | |
| 188 return; | |
| 189 | |
| 190 delegate_->OnInstantSupportDetermined(instant_support); | |
| 191 } | |
| 192 | |
| 193 void SearchIPCRouter::FocusOmnibox(int page_seq_no, OmniboxFocusState state) { | 181 void SearchIPCRouter::FocusOmnibox(int page_seq_no, OmniboxFocusState state) { |
| 194 if (page_seq_no != commit_counter_) | 182 if (page_seq_no != commit_counter_) |
| 195 return; | 183 return; |
| 196 | 184 |
| 197 delegate_->OnInstantSupportDetermined(true); | 185 delegate_->OnInstantSupportDetermined(true); |
| 198 if (!policy_->ShouldProcessFocusOmnibox(is_active_tab_)) | 186 if (!policy_->ShouldProcessFocusOmnibox(is_active_tab_)) |
| 199 return; | 187 return; |
| 200 | 188 |
| 201 delegate_->FocusOmnibox(state); | 189 delegate_->FocusOmnibox(state); |
| 202 } | 190 } |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 317 | 305 |
| 318 void SearchIPCRouter::set_delegate_for_testing(Delegate* delegate) { | 306 void SearchIPCRouter::set_delegate_for_testing(Delegate* delegate) { |
| 319 DCHECK(delegate); | 307 DCHECK(delegate); |
| 320 delegate_ = delegate; | 308 delegate_ = delegate; |
| 321 } | 309 } |
| 322 | 310 |
| 323 void SearchIPCRouter::set_policy_for_testing(std::unique_ptr<Policy> policy) { | 311 void SearchIPCRouter::set_policy_for_testing(std::unique_ptr<Policy> policy) { |
| 324 DCHECK(policy); | 312 DCHECK(policy); |
| 325 policy_ = std::move(policy); | 313 policy_ = std::move(policy); |
| 326 } | 314 } |
| OLD | NEW |