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 "ui/app_list/search_box_model_observer.h" | 7 #include "ui/app_list/search_box_model_observer.h" |
8 | 8 |
9 namespace app_list { | 9 namespace app_list { |
10 | 10 |
11 SearchBoxModel::SearchBoxModel() | 11 SearchBoxModel::SearchBoxModel() { |
12 : user_icon_enabled_(false) { | |
13 } | 12 } |
14 | 13 |
15 SearchBoxModel::~SearchBoxModel() { | 14 SearchBoxModel::~SearchBoxModel() { |
16 } | 15 } |
17 | 16 |
18 void SearchBoxModel::SetIcon(const gfx::ImageSkia& icon) { | 17 void SearchBoxModel::SetIcon(const gfx::ImageSkia& icon) { |
19 icon_ = icon; | 18 icon_ = icon; |
20 FOR_EACH_OBSERVER(SearchBoxModelObserver, observers_, IconChanged()); | 19 FOR_EACH_OBSERVER(SearchBoxModelObserver, observers_, IconChanged()); |
21 } | 20 } |
22 | 21 |
23 void SearchBoxModel::SetUserIcon(const gfx::ImageSkia& icon) { | |
24 user_icon_ = icon; | |
25 FOR_EACH_OBSERVER(SearchBoxModelObserver, observers_, UserIconChanged()); | |
26 } | |
27 | |
28 void SearchBoxModel::SetUserIconTooltip(const string16& tooltip_text) { | |
29 user_icon_tooltip_ = tooltip_text; | |
30 FOR_EACH_OBSERVER(SearchBoxModelObserver, observers_, | |
31 UserIconTooltipChanged()); | |
32 } | |
33 | |
34 void SearchBoxModel::SetUserIconEnabled(bool user_icon_enabled) { | |
35 user_icon_enabled_ = user_icon_enabled; | |
36 FOR_EACH_OBSERVER(SearchBoxModelObserver, observers_, | |
37 UserIconEnabledChanged()); | |
38 } | |
39 | |
40 void SearchBoxModel::SetHintText(const string16& hint_text) { | 22 void SearchBoxModel::SetHintText(const string16& hint_text) { |
41 if (hint_text_ == hint_text) | 23 if (hint_text_ == hint_text) |
42 return; | 24 return; |
43 | 25 |
44 hint_text_ = hint_text; | 26 hint_text_ = hint_text; |
45 FOR_EACH_OBSERVER(SearchBoxModelObserver, observers_, HintTextChanged()); | 27 FOR_EACH_OBSERVER(SearchBoxModelObserver, observers_, HintTextChanged()); |
46 } | 28 } |
47 | 29 |
48 void SearchBoxModel::SetSelectionModel(const gfx::SelectionModel& sel) { | 30 void SearchBoxModel::SetSelectionModel(const gfx::SelectionModel& sel) { |
49 if (selection_model_ == sel) | 31 if (selection_model_ == sel) |
(...skipping 15 matching lines...) Expand all Loading... |
65 | 47 |
66 void SearchBoxModel::AddObserver(SearchBoxModelObserver* observer) { | 48 void SearchBoxModel::AddObserver(SearchBoxModelObserver* observer) { |
67 observers_.AddObserver(observer); | 49 observers_.AddObserver(observer); |
68 } | 50 } |
69 | 51 |
70 void SearchBoxModel::RemoveObserver(SearchBoxModelObserver* observer) { | 52 void SearchBoxModel::RemoveObserver(SearchBoxModelObserver* observer) { |
71 observers_.RemoveObserver(observer); | 53 observers_.RemoveObserver(observer); |
72 } | 54 } |
73 | 55 |
74 } // namespace app_list | 56 } // namespace app_list |
OLD | NEW |