| 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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 // Sets/gets the text for screen readers on the search box. | 61 // Sets/gets the text for screen readers on the search box. |
| 62 void SetAccessibleName(const base::string16& accessible_name); | 62 void SetAccessibleName(const base::string16& accessible_name); |
| 63 const base::string16& accessible_name() const { return accessible_name_; } | 63 const base::string16& accessible_name() const { return accessible_name_; } |
| 64 | 64 |
| 65 // Sets/gets the selection model for the search box's Textfield. | 65 // Sets/gets the selection model for the search box's Textfield. |
| 66 void SetSelectionModel(const gfx::SelectionModel& sel); | 66 void SetSelectionModel(const gfx::SelectionModel& sel); |
| 67 const gfx::SelectionModel& selection_model() const { | 67 const gfx::SelectionModel& selection_model() const { |
| 68 return selection_model_; | 68 return selection_model_; |
| 69 } | 69 } |
| 70 | 70 |
| 71 // Sets/gets the text for the search box's Textfield. | 71 // Sets/gets the text for the search box's Textfield and the voice search |
| 72 void SetText(const base::string16& text); | 72 // flag. |
| 73 void Update(const base::string16& text, bool is_voice_query); |
| 73 const base::string16& text() const { return text_; } | 74 const base::string16& text() const { return text_; } |
| 75 bool is_voice_query() const { return is_voice_query_; } |
| 74 | 76 |
| 75 void AddObserver(SearchBoxModelObserver* observer); | 77 void AddObserver(SearchBoxModelObserver* observer); |
| 76 void RemoveObserver(SearchBoxModelObserver* observer); | 78 void RemoveObserver(SearchBoxModelObserver* observer); |
| 77 | 79 |
| 78 private: | 80 private: |
| 79 std::unique_ptr<SpeechButtonProperty> speech_button_; | 81 std::unique_ptr<SpeechButtonProperty> speech_button_; |
| 80 base::string16 hint_text_; | 82 base::string16 hint_text_; |
| 81 base::string16 accessible_name_; | 83 base::string16 accessible_name_; |
| 82 gfx::SelectionModel selection_model_; | 84 gfx::SelectionModel selection_model_; |
| 83 base::string16 text_; | 85 base::string16 text_; |
| 86 bool is_voice_query_ = false; |
| 84 | 87 |
| 85 base::ObserverList<SearchBoxModelObserver> observers_; | 88 base::ObserverList<SearchBoxModelObserver> observers_; |
| 86 | 89 |
| 87 DISALLOW_COPY_AND_ASSIGN(SearchBoxModel); | 90 DISALLOW_COPY_AND_ASSIGN(SearchBoxModel); |
| 88 }; | 91 }; |
| 89 | 92 |
| 90 } // namespace app_list | 93 } // namespace app_list |
| 91 | 94 |
| 92 #endif // UI_APP_LIST_SEARCH_BOX_MODEL_H_ | 95 #endif // UI_APP_LIST_SEARCH_BOX_MODEL_H_ |
| OLD | NEW |