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 #ifndef UI_APP_LIST_SEARCH_BOX_MODEL_H_ | 5 #ifndef UI_APP_LIST_SEARCH_BOX_MODEL_H_ |
6 #define UI_APP_LIST_SEARCH_BOX_MODEL_H_ | 6 #define UI_APP_LIST_SEARCH_BOX_MODEL_H_ |
7 | 7 |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "base/observer_list.h" | 9 #include "base/observer_list.h" |
10 #include "base/strings/string16.h" | 10 #include "base/strings/string16.h" |
(...skipping 29 matching lines...) Expand all Loading... |
40 gfx::ImageSkia off_icon; | 40 gfx::ImageSkia off_icon; |
41 base::string16 off_tooltip; | 41 base::string16 off_tooltip; |
42 | 42 |
43 // The accessibility name of the button. | 43 // The accessibility name of the button. |
44 base::string16 accessible_name; | 44 base::string16 accessible_name; |
45 }; | 45 }; |
46 | 46 |
47 SearchBoxModel(); | 47 SearchBoxModel(); |
48 ~SearchBoxModel(); | 48 ~SearchBoxModel(); |
49 | 49 |
50 // Sets/gets the icon on the left side of edit box. | |
51 void SetIcon(const gfx::ImageSkia& icon); | |
52 const gfx::ImageSkia& icon() const { return icon_; } | |
53 | |
54 // Sets/gets the properties for the button of speech recognition. | 50 // Sets/gets the properties for the button of speech recognition. |
55 void SetSpeechRecognitionButton( | 51 void SetSpeechRecognitionButton( |
56 std::unique_ptr<SpeechButtonProperty> speech_button); | 52 std::unique_ptr<SpeechButtonProperty> speech_button); |
57 const SpeechButtonProperty* speech_button() const { | 53 const SpeechButtonProperty* speech_button() const { |
58 return speech_button_.get(); | 54 return speech_button_.get(); |
59 } | 55 } |
60 | 56 |
61 // Sets/gets the hint text to display when there is in input. | 57 // Sets/gets the hint text to display when there is in input. |
62 void SetHintText(const base::string16& hint_text); | 58 void SetHintText(const base::string16& hint_text); |
63 const base::string16& hint_text() const { return hint_text_; } | 59 const base::string16& hint_text() const { return hint_text_; } |
64 | 60 |
65 // Sets/gets the text for screen readers on the search box. | 61 // Sets/gets the text for screen readers on the search box. |
66 void SetAccessibleName(const base::string16& accessible_name); | 62 void SetAccessibleName(const base::string16& accessible_name); |
67 const base::string16& accessible_name() const { return accessible_name_; } | 63 const base::string16& accessible_name() const { return accessible_name_; } |
68 | 64 |
69 // Sets/gets the selection model for the search box's Textfield. | 65 // Sets/gets the selection model for the search box's Textfield. |
70 void SetSelectionModel(const gfx::SelectionModel& sel); | 66 void SetSelectionModel(const gfx::SelectionModel& sel); |
71 const gfx::SelectionModel& selection_model() const { | 67 const gfx::SelectionModel& selection_model() const { |
72 return selection_model_; | 68 return selection_model_; |
73 } | 69 } |
74 | 70 |
75 // Sets/gets the text for the search box's Textfield. | 71 // Sets/gets the text for the search box's Textfield. |
76 void SetText(const base::string16& text); | 72 void SetText(const base::string16& text); |
77 const base::string16& text() const { return text_; } | 73 const base::string16& text() const { return text_; } |
78 | 74 |
79 void AddObserver(SearchBoxModelObserver* observer); | 75 void AddObserver(SearchBoxModelObserver* observer); |
80 void RemoveObserver(SearchBoxModelObserver* observer); | 76 void RemoveObserver(SearchBoxModelObserver* observer); |
81 | 77 |
82 private: | 78 private: |
83 gfx::ImageSkia icon_; | |
84 std::unique_ptr<SpeechButtonProperty> speech_button_; | 79 std::unique_ptr<SpeechButtonProperty> speech_button_; |
85 base::string16 hint_text_; | 80 base::string16 hint_text_; |
86 base::string16 accessible_name_; | 81 base::string16 accessible_name_; |
87 gfx::SelectionModel selection_model_; | 82 gfx::SelectionModel selection_model_; |
88 base::string16 text_; | 83 base::string16 text_; |
89 | 84 |
90 base::ObserverList<SearchBoxModelObserver> observers_; | 85 base::ObserverList<SearchBoxModelObserver> observers_; |
91 | 86 |
92 DISALLOW_COPY_AND_ASSIGN(SearchBoxModel); | 87 DISALLOW_COPY_AND_ASSIGN(SearchBoxModel); |
93 }; | 88 }; |
94 | 89 |
95 } // namespace app_list | 90 } // namespace app_list |
96 | 91 |
97 #endif // UI_APP_LIST_SEARCH_BOX_MODEL_H_ | 92 #endif // UI_APP_LIST_SEARCH_BOX_MODEL_H_ |
OLD | NEW |