Add an observer to the list. An observer should not be added to the same list more than once.
| 117 | // Add an observer to the list. An observer should not be added to |
| 118 | // the same list more than once. |
| 119 | void AddObserver(ObserverType* obs) { |
| 120 | if (std::find(observers_.begin(), observers_.end(), obs) |
| 121 | != observers_.end()) { |
| 122 | NOTREACHED() << "Observers can only be added once!"; |
| 123 | return; |
| 124 | } |
| 125 | observers_.push_back(obs); |
| 126 | } |
| 127 | |
| 128 | // Remove an observer from the list if it is in the list. |
| 129 | void RemoveObserver(ObserverType* obs) { |