| 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/search.h" | 10 #include "chrome/browser/search/search.h" |
| (...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 197 if (page_seq_no != commit_counter_) | 197 if (page_seq_no != commit_counter_) |
| 198 return; | 198 return; |
| 199 | 199 |
| 200 delegate_->OnInstantSupportDetermined(true); | 200 delegate_->OnInstantSupportDetermined(true); |
| 201 if (!policy_->ShouldProcessFocusOmnibox(is_active_tab_)) | 201 if (!policy_->ShouldProcessFocusOmnibox(is_active_tab_)) |
| 202 return; | 202 return; |
| 203 | 203 |
| 204 delegate_->FocusOmnibox(state); | 204 delegate_->FocusOmnibox(state); |
| 205 } | 205 } |
| 206 | 206 |
| 207 void SearchIPCRouter::SearchBoxDeleteMostVisitedItem(int page_seq_no, | 207 void SearchIPCRouter::DeleteMostVisitedItem(int page_seq_no, const GURL& url) { |
| 208 const GURL& url) { | |
| 209 if (!IsRenderedInInstantProcess(web_contents())) | 208 if (!IsRenderedInInstantProcess(web_contents())) |
| 210 return; | 209 return; |
| 211 if (page_seq_no != commit_counter_) | 210 if (page_seq_no != commit_counter_) |
| 212 return; | 211 return; |
| 213 | 212 |
| 214 delegate_->OnInstantSupportDetermined(true); | 213 delegate_->OnInstantSupportDetermined(true); |
| 215 if (!policy_->ShouldProcessDeleteMostVisitedItem()) | 214 if (!policy_->ShouldProcessDeleteMostVisitedItem()) |
| 216 return; | 215 return; |
| 217 | 216 |
| 218 delegate_->OnDeleteMostVisitedItem(url); | 217 delegate_->OnDeleteMostVisitedItem(url); |
| 219 } | 218 } |
| 220 | 219 |
| 221 void SearchIPCRouter::SearchBoxUndoMostVisitedDeletion(int page_seq_no, | 220 void SearchIPCRouter::UndoMostVisitedDeletion(int page_seq_no, |
| 222 const GURL& url) { | 221 const GURL& url) { |
| 223 if (!IsRenderedInInstantProcess(web_contents())) | 222 if (!IsRenderedInInstantProcess(web_contents())) |
| 224 return; | 223 return; |
| 225 if (page_seq_no != commit_counter_) | 224 if (page_seq_no != commit_counter_) |
| 226 return; | 225 return; |
| 227 | 226 |
| 228 delegate_->OnInstantSupportDetermined(true); | 227 delegate_->OnInstantSupportDetermined(true); |
| 229 if (!policy_->ShouldProcessUndoMostVisitedDeletion()) | 228 if (!policy_->ShouldProcessUndoMostVisitedDeletion()) |
| 230 return; | 229 return; |
| 231 | 230 |
| 232 delegate_->OnUndoMostVisitedDeletion(url); | 231 delegate_->OnUndoMostVisitedDeletion(url); |
| 233 } | 232 } |
| 234 | 233 |
| 235 void SearchIPCRouter::SearchBoxUndoAllMostVisitedDeletions(int page_seq_no) { | 234 void SearchIPCRouter::UndoAllMostVisitedDeletions(int page_seq_no) { |
| 236 if (!IsRenderedInInstantProcess(web_contents())) | 235 if (!IsRenderedInInstantProcess(web_contents())) |
| 237 return; | 236 return; |
| 238 if (page_seq_no != commit_counter_) | 237 if (page_seq_no != commit_counter_) |
| 239 return; | 238 return; |
| 240 | 239 |
| 241 delegate_->OnInstantSupportDetermined(true); | 240 delegate_->OnInstantSupportDetermined(true); |
| 242 if (!policy_->ShouldProcessUndoAllMostVisitedDeletions()) | 241 if (!policy_->ShouldProcessUndoAllMostVisitedDeletions()) |
| 243 return; | 242 return; |
| 244 | 243 |
| 245 delegate_->OnUndoAllMostVisitedDeletions(); | 244 delegate_->OnUndoAllMostVisitedDeletions(); |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 337 | 336 |
| 338 void SearchIPCRouter::set_delegate_for_testing(Delegate* delegate) { | 337 void SearchIPCRouter::set_delegate_for_testing(Delegate* delegate) { |
| 339 DCHECK(delegate); | 338 DCHECK(delegate); |
| 340 delegate_ = delegate; | 339 delegate_ = delegate; |
| 341 } | 340 } |
| 342 | 341 |
| 343 void SearchIPCRouter::set_policy_for_testing(std::unique_ptr<Policy> policy) { | 342 void SearchIPCRouter::set_policy_for_testing(std::unique_ptr<Policy> policy) { |
| 344 DCHECK(policy); | 343 DCHECK(policy); |
| 345 policy_ = std::move(policy); | 344 policy_ = std::move(policy); |
| 346 } | 345 } |
| OLD | NEW |