OLD | NEW |
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/search/search.h" | 7 #include "chrome/browser/search/search.h" |
8 #include "chrome/browser/ui/search/search_model_observer.h" | 8 #include "chrome/browser/ui/search/search_model_observer.h" |
9 | 9 |
10 SearchModel::SearchModel() { | 10 SearchModel::SearchModel() { |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 if (state_.top_bars_visible == visible) | 70 if (state_.top_bars_visible == visible) |
71 return; | 71 return; |
72 | 72 |
73 const State old_state = state_; | 73 const State old_state = state_; |
74 state_.top_bars_visible = visible; | 74 state_.top_bars_visible = visible; |
75 | 75 |
76 FOR_EACH_OBSERVER(SearchModelObserver, observers_, | 76 FOR_EACH_OBSERVER(SearchModelObserver, observers_, |
77 ModelChanged(old_state, state_)); | 77 ModelChanged(old_state, state_)); |
78 } | 78 } |
79 | 79 |
| 80 void SearchModel::SetSupportsInstant(bool supports_instant) { |
| 81 DCHECK(chrome::IsInstantExtendedAPIEnabled()) |
| 82 << "Please do not try to set the SearchModel mode without first " |
| 83 << "checking if Search is enabled."; |
| 84 |
| 85 InstantSupportState new_instant_support = supports_instant ? |
| 86 INSTANT_SUPPORT_YES : INSTANT_SUPPORT_NO; |
| 87 |
| 88 if (state_.instant_support == new_instant_support) |
| 89 return; |
| 90 |
| 91 const State old_state = state_; |
| 92 state_.instant_support = new_instant_support; |
| 93 |
| 94 FOR_EACH_OBSERVER(SearchModelObserver, observers_, |
| 95 ModelChanged(old_state, state_)); |
| 96 } |
| 97 |
80 void SearchModel::AddObserver(SearchModelObserver* observer) { | 98 void SearchModel::AddObserver(SearchModelObserver* observer) { |
81 observers_.AddObserver(observer); | 99 observers_.AddObserver(observer); |
82 } | 100 } |
83 | 101 |
84 void SearchModel::RemoveObserver(SearchModelObserver* observer) { | 102 void SearchModel::RemoveObserver(SearchModelObserver* observer) { |
85 observers_.RemoveObserver(observer); | 103 observers_.RemoveObserver(observer); |
86 } | 104 } |
OLD | NEW |