Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3223)

Side by Side Diff: chrome/browser/autocomplete/shortcuts_provider.cc

Issue 9160032: [Coverity] Pass AutocompleteMatch to predicate as const-ref (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698