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::RightButtonProperty::RightButtonProperty( | |
13 const gfx::ImageSkia& icon, | |
14 const gfx::ImageSkia& toggled_icon, | |
15 const base::string16& tooltip, | |
16 const base::string16& toggled_tooltip) | |
17 : icon(icon), | |
18 toggled_icon(toggled_icon), | |
19 tooltip(tooltip), | |
20 toggled_tooltip(toggled_tooltip) { | |
21 } | |
22 | |
23 SearchBoxModel::RightButtonProperty::~RightButtonProperty() { | |
24 } | |
25 | |
12 SearchBoxModel::SearchBoxModel() { | 26 SearchBoxModel::SearchBoxModel() { |
13 } | 27 } |
14 | 28 |
15 SearchBoxModel::~SearchBoxModel() { | 29 SearchBoxModel::~SearchBoxModel() { |
16 } | 30 } |
17 | 31 |
18 void SearchBoxModel::SetIcon(const gfx::ImageSkia& icon) { | 32 void SearchBoxModel::SetIcon(const gfx::ImageSkia& icon) { |
19 icon_ = icon; | 33 icon_ = icon; |
20 FOR_EACH_OBSERVER(SearchBoxModelObserver, observers_, IconChanged()); | 34 FOR_EACH_OBSERVER(SearchBoxModelObserver, observers_, IconChanged()); |
21 } | 35 } |
22 | 36 |
37 void SearchBoxModel::SetRightButton( | |
38 scoped_ptr<SearchBoxModel::RightButtonProperty> right_button_prop) { | |
39 right_button_prop_.reset(right_button_prop.release()); | |
xiyuan
2013/11/12 03:09:25
nit: right_button_prop_ = right_button_prop.Pass()
Jun Mukai
2013/11/12 19:24:09
Done.
| |
40 FOR_EACH_OBSERVER(SearchBoxModelObserver, | |
41 observers_, | |
42 RightButtonPropChanged()); | |
43 } | |
44 | |
45 void SearchBoxModel::SetRightButtonState(bool toggled) { | |
46 FOR_EACH_OBSERVER(SearchBoxModelObserver, | |
47 observers_, | |
48 RightButtonStateChanged(toggled)); | |
49 } | |
50 | |
23 void SearchBoxModel::SetHintText(const base::string16& hint_text) { | 51 void SearchBoxModel::SetHintText(const base::string16& hint_text) { |
24 if (hint_text_ == hint_text) | 52 if (hint_text_ == hint_text) |
25 return; | 53 return; |
26 | 54 |
27 hint_text_ = hint_text; | 55 hint_text_ = hint_text; |
28 FOR_EACH_OBSERVER(SearchBoxModelObserver, observers_, HintTextChanged()); | 56 FOR_EACH_OBSERVER(SearchBoxModelObserver, observers_, HintTextChanged()); |
29 } | 57 } |
30 | 58 |
31 void SearchBoxModel::SetSelectionModel(const gfx::SelectionModel& sel) { | 59 void SearchBoxModel::SetSelectionModel(const gfx::SelectionModel& sel) { |
32 if (selection_model_ == sel) | 60 if (selection_model_ == sel) |
(...skipping 20 matching lines...) Expand all Loading... | |
53 | 81 |
54 void SearchBoxModel::AddObserver(SearchBoxModelObserver* observer) { | 82 void SearchBoxModel::AddObserver(SearchBoxModelObserver* observer) { |
55 observers_.AddObserver(observer); | 83 observers_.AddObserver(observer); |
56 } | 84 } |
57 | 85 |
58 void SearchBoxModel::RemoveObserver(SearchBoxModelObserver* observer) { | 86 void SearchBoxModel::RemoveObserver(SearchBoxModelObserver* observer) { |
59 observers_.RemoveObserver(observer); | 87 observers_.RemoveObserver(observer); |
60 } | 88 } |
61 | 89 |
62 } // namespace app_list | 90 } // namespace app_list |
OLD | NEW |