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

Side by Side Diff: base/scoped_observer.h

Issue 2234773002: base: Use stl utilities from the base namespace (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Removed unnecessary formatting change Created 4 years, 4 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
« no previous file with comments | « base/memory/scoped_vector.h ('k') | 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 #ifndef BASE_SCOPED_OBSERVER_H_ 5 #ifndef BASE_SCOPED_OBSERVER_H_
6 #define BASE_SCOPED_OBSERVER_H_ 6 #define BASE_SCOPED_OBSERVER_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 29 matching lines...) Expand all
40 source->RemoveObserver(observer_); 40 source->RemoveObserver(observer_);
41 } 41 }
42 42
43 void RemoveAll() { 43 void RemoveAll() {
44 for (size_t i = 0; i < sources_.size(); ++i) 44 for (size_t i = 0; i < sources_.size(); ++i)
45 sources_[i]->RemoveObserver(observer_); 45 sources_[i]->RemoveObserver(observer_);
46 sources_.clear(); 46 sources_.clear();
47 } 47 }
48 48
49 bool IsObserving(Source* source) const { 49 bool IsObserving(Source* source) const {
50 return ContainsValue(sources_, source); 50 return base::ContainsValue(sources_, source);
51 } 51 }
52 52
53 bool IsObservingSources() const { return !sources_.empty(); } 53 bool IsObservingSources() const { return !sources_.empty(); }
54 54
55 private: 55 private:
56 Observer* observer_; 56 Observer* observer_;
57 57
58 std::vector<Source*> sources_; 58 std::vector<Source*> sources_;
59 59
60 DISALLOW_COPY_AND_ASSIGN(ScopedObserver); 60 DISALLOW_COPY_AND_ASSIGN(ScopedObserver);
61 }; 61 };
62 62
63 #endif // BASE_SCOPED_OBSERVER_H_ 63 #endif // BASE_SCOPED_OBSERVER_H_
OLDNEW
« no previous file with comments | « base/memory/scoped_vector.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698