| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/autocomplete/shortcuts_provider.h" | 5 #include "chrome/browser/autocomplete/shortcuts_provider.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <cmath> | 8 #include <cmath> |
| 9 #include <map> | 9 #include <map> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 using shortcuts_provider::Shortcut; | 33 using shortcuts_provider::Shortcut; |
| 34 using shortcuts_provider::ShortcutMap; | 34 using shortcuts_provider::ShortcutMap; |
| 35 | 35 |
| 36 namespace { | 36 namespace { |
| 37 | 37 |
| 38 class RemoveMatchPredicate { | 38 class RemoveMatchPredicate { |
| 39 public: | 39 public: |
| 40 explicit RemoveMatchPredicate(const std::set<GURL>& urls) | 40 explicit RemoveMatchPredicate(const std::set<GURL>& urls) |
| 41 : urls_(urls) { | 41 : urls_(urls) { |
| 42 } | 42 } |
| 43 bool operator()(AutocompleteMatch match) { | 43 bool operator()(const AutocompleteMatch& match) { |
| 44 return urls_.find(match.destination_url) != urls_.end(); | 44 return urls_.find(match.destination_url) != urls_.end(); |
| 45 } | 45 } |
| 46 private: | 46 private: |
| 47 // Lifetime of the object is less than the lifetime of passed |urls|, so | 47 // Lifetime of the object is less than the lifetime of passed |urls|, so |
| 48 // it is safe to store reference. | 48 // it is safe to store reference. |
| 49 const std::set<GURL>& urls_; | 49 const std::set<GURL>& urls_; |
| 50 }; | 50 }; |
| 51 | 51 |
| 52 } // namespace | 52 } // namespace |
| 53 | 53 |
| (...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 303 | 303 |
| 304 void ShortcutsProvider::set_shortcuts_backend( | 304 void ShortcutsProvider::set_shortcuts_backend( |
| 305 history::ShortcutsBackend* shortcuts_backend) { | 305 history::ShortcutsBackend* shortcuts_backend) { |
| 306 DCHECK(shortcuts_backend); | 306 DCHECK(shortcuts_backend); |
| 307 shortcuts_backend_ = shortcuts_backend; | 307 shortcuts_backend_ = shortcuts_backend; |
| 308 shortcuts_backend_->AddObserver(this); | 308 shortcuts_backend_->AddObserver(this); |
| 309 if (shortcuts_backend_->initialized()) | 309 if (shortcuts_backend_->initialized()) |
| 310 initialized_ = true; | 310 initialized_ = true; |
| 311 } | 311 } |
| 312 | 312 |
| OLD | NEW |