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 "ui/app_list/search_box_model.h" | 5 #include "ui/app_list/search_box_model.h" |
6 | 6 |
7 #include "base/metrics/histogram.h" | 7 #include "base/metrics/histogram.h" |
8 #include "ui/app_list/search_box_model_observer.h" | 8 #include "ui/app_list/search_box_model_observer.h" |
9 | 9 |
10 namespace app_list { | 10 namespace app_list { |
11 | 11 |
12 SearchBoxModel::ButtonProperty::ButtonProperty( | 12 SearchBoxModel::SpeechButtonProperty::SpeechButtonProperty( |
13 const gfx::ImageSkia& icon, | 13 const gfx::ImageSkia& on_icon, |
14 const base::string16& tooltip) | 14 const base::string16& on_tooltip, |
15 : icon(icon), | 15 const gfx::ImageSkia& off_icon, |
16 tooltip(tooltip) { | 16 const base::string16& off_tooltip) |
| 17 : on_icon(on_icon), |
| 18 on_tooltip(on_tooltip), |
| 19 off_icon(off_icon), |
| 20 off_tooltip(off_tooltip) { |
17 } | 21 } |
18 | 22 |
19 SearchBoxModel::ButtonProperty::~ButtonProperty() { | 23 SearchBoxModel::SpeechButtonProperty::~SpeechButtonProperty() { |
20 } | 24 } |
21 | 25 |
22 SearchBoxModel::SearchBoxModel() { | 26 SearchBoxModel::SearchBoxModel() { |
23 } | 27 } |
24 | 28 |
25 SearchBoxModel::~SearchBoxModel() { | 29 SearchBoxModel::~SearchBoxModel() { |
26 } | 30 } |
27 | 31 |
28 void SearchBoxModel::SetIcon(const gfx::ImageSkia& icon) { | 32 void SearchBoxModel::SetIcon(const gfx::ImageSkia& icon) { |
29 icon_ = icon; | 33 icon_ = icon; |
30 FOR_EACH_OBSERVER(SearchBoxModelObserver, observers_, IconChanged()); | 34 FOR_EACH_OBSERVER(SearchBoxModelObserver, observers_, IconChanged()); |
31 } | 35 } |
32 | 36 |
33 void SearchBoxModel::SetSpeechRecognitionButton( | 37 void SearchBoxModel::SetSpeechRecognitionButton( |
34 scoped_ptr<SearchBoxModel::ButtonProperty> speech_button) { | 38 scoped_ptr<SearchBoxModel::SpeechButtonProperty> speech_button) { |
35 speech_button_ = speech_button.Pass(); | 39 speech_button_ = speech_button.Pass(); |
36 FOR_EACH_OBSERVER(SearchBoxModelObserver, | 40 FOR_EACH_OBSERVER(SearchBoxModelObserver, |
37 observers_, | 41 observers_, |
38 SpeechRecognitionButtonPropChanged()); | 42 SpeechRecognitionButtonPropChanged()); |
39 } | 43 } |
40 | 44 |
41 void SearchBoxModel::SetHintText(const base::string16& hint_text) { | 45 void SearchBoxModel::SetHintText(const base::string16& hint_text) { |
42 if (hint_text_ == hint_text) | 46 if (hint_text_ == hint_text) |
43 return; | 47 return; |
44 | 48 |
(...skipping 26 matching lines...) Expand all Loading... |
71 | 75 |
72 void SearchBoxModel::AddObserver(SearchBoxModelObserver* observer) { | 76 void SearchBoxModel::AddObserver(SearchBoxModelObserver* observer) { |
73 observers_.AddObserver(observer); | 77 observers_.AddObserver(observer); |
74 } | 78 } |
75 | 79 |
76 void SearchBoxModel::RemoveObserver(SearchBoxModelObserver* observer) { | 80 void SearchBoxModel::RemoveObserver(SearchBoxModelObserver* observer) { |
77 observers_.RemoveObserver(observer); | 81 observers_.RemoveObserver(observer); |
78 } | 82 } |
79 | 83 |
80 } // namespace app_list | 84 } // namespace app_list |
OLD | NEW |