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

Side by Side Diff: chrome/browser/ui/search/search_model.cc

Issue 2424853003: Remove FOR_EACH_OBSERVER macro usage in chrome/browser/ui (Closed)
Patch Set: explicit types Created 4 years, 2 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 | « chrome/browser/ui/libgtk2ui/gtk2_ui.cc ('k') | chrome/browser/ui/settings_window_manager.cc » ('j') | 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 #include "chrome/browser/ui/search/search_model.h" 5 #include "chrome/browser/ui/search/search_model.h"
6 6
7 #include "chrome/browser/ui/search/search_model_observer.h" 7 #include "chrome/browser/ui/search/search_model_observer.h"
8 #include "components/search/search.h" 8 #include "components/search/search.h"
9 9
10 SearchModel::State::State() : instant_support(INSTANT_SUPPORT_UNKNOWN) {} 10 SearchModel::State::State() : instant_support(INSTANT_SUPPORT_UNKNOWN) {}
(...skipping 16 matching lines...) Expand all
27 DCHECK(search::IsInstantExtendedAPIEnabled()) 27 DCHECK(search::IsInstantExtendedAPIEnabled())
28 << "Please do not try to set the SearchModel mode without first " 28 << "Please do not try to set the SearchModel mode without first "
29 << "checking if Search is enabled."; 29 << "checking if Search is enabled.";
30 30
31 if (state_ == new_state) 31 if (state_ == new_state)
32 return; 32 return;
33 33
34 const State old_state = state_; 34 const State old_state = state_;
35 state_ = new_state; 35 state_ = new_state;
36 36
37 FOR_EACH_OBSERVER(SearchModelObserver, observers_, 37 for (SearchModelObserver& observer : observers_)
38 ModelChanged(old_state, state_)); 38 observer.ModelChanged(old_state, state_);
39 } 39 }
40 40
41 void SearchModel::SetMode(const SearchMode& new_mode) { 41 void SearchModel::SetMode(const SearchMode& new_mode) {
42 DCHECK(search::IsInstantExtendedAPIEnabled()) 42 DCHECK(search::IsInstantExtendedAPIEnabled())
43 << "Please do not try to set the SearchModel mode without first " 43 << "Please do not try to set the SearchModel mode without first "
44 << "checking if Search is enabled."; 44 << "checking if Search is enabled.";
45 45
46 if (state_.mode == new_mode) 46 if (state_.mode == new_mode)
47 return; 47 return;
48 48
49 const State old_state = state_; 49 const State old_state = state_;
50 state_.mode = new_mode; 50 state_.mode = new_mode;
51 51
52 FOR_EACH_OBSERVER(SearchModelObserver, observers_, 52 for (SearchModelObserver& observer : observers_)
53 ModelChanged(old_state, state_)); 53 observer.ModelChanged(old_state, state_);
54 } 54 }
55 55
56 void SearchModel::SetInstantSupportState(InstantSupportState instant_support) { 56 void SearchModel::SetInstantSupportState(InstantSupportState instant_support) {
57 DCHECK(search::IsInstantExtendedAPIEnabled()) 57 DCHECK(search::IsInstantExtendedAPIEnabled())
58 << "Please do not try to set the SearchModel state without first " 58 << "Please do not try to set the SearchModel state without first "
59 << "checking if Search is enabled."; 59 << "checking if Search is enabled.";
60 60
61 if (state_.instant_support == instant_support) 61 if (state_.instant_support == instant_support)
62 return; 62 return;
63 63
64 const State old_state = state_; 64 const State old_state = state_;
65 state_.instant_support = instant_support; 65 state_.instant_support = instant_support;
66 FOR_EACH_OBSERVER(SearchModelObserver, observers_, 66 for (SearchModelObserver& observer : observers_)
67 ModelChanged(old_state, state_)); 67 observer.ModelChanged(old_state, state_);
68 } 68 }
69 69
70 void SearchModel::AddObserver(SearchModelObserver* observer) { 70 void SearchModel::AddObserver(SearchModelObserver* observer) {
71 observers_.AddObserver(observer); 71 observers_.AddObserver(observer);
72 } 72 }
73 73
74 void SearchModel::RemoveObserver(SearchModelObserver* observer) { 74 void SearchModel::RemoveObserver(SearchModelObserver* observer) {
75 observers_.RemoveObserver(observer); 75 observers_.RemoveObserver(observer);
76 } 76 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/libgtk2ui/gtk2_ui.cc ('k') | chrome/browser/ui/settings_window_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698