Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(131)

Side by Side Diff: ui/app_list/search_box_model.cc

Issue 105773004: Introduces the speech recognition UI to app_list. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ui/app_list/search_box_model.h ('k') | ui/app_list/search_box_model_observer.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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::ToggleButtonProperty::ToggleButtonProperty( 12 SearchBoxModel::ButtonProperty::ButtonProperty(
13 const gfx::ImageSkia& icon, 13 const gfx::ImageSkia& icon,
14 const gfx::ImageSkia& toggled_icon, 14 const base::string16& tooltip)
15 const base::string16& tooltip,
16 const base::string16& toggled_tooltip)
17 : icon(icon), 15 : icon(icon),
18 toggled_icon(toggled_icon), 16 tooltip(tooltip) {
19 tooltip(tooltip),
20 toggled_tooltip(toggled_tooltip) {
21 } 17 }
22 18
23 SearchBoxModel::ToggleButtonProperty::~ToggleButtonProperty() { 19 SearchBoxModel::ButtonProperty::~ButtonProperty() {
24 } 20 }
25 21
26 SearchBoxModel::SearchBoxModel() { 22 SearchBoxModel::SearchBoxModel() {
27 } 23 }
28 24
29 SearchBoxModel::~SearchBoxModel() { 25 SearchBoxModel::~SearchBoxModel() {
30 } 26 }
31 27
32 void SearchBoxModel::SetIcon(const gfx::ImageSkia& icon) { 28 void SearchBoxModel::SetIcon(const gfx::ImageSkia& icon) {
33 icon_ = icon; 29 icon_ = icon;
34 FOR_EACH_OBSERVER(SearchBoxModelObserver, observers_, IconChanged()); 30 FOR_EACH_OBSERVER(SearchBoxModelObserver, observers_, IconChanged());
35 } 31 }
36 32
37 void SearchBoxModel::SetSpeechRecognitionButton( 33 void SearchBoxModel::SetSpeechRecognitionButton(
38 scoped_ptr<SearchBoxModel::ToggleButtonProperty> speech_button) { 34 scoped_ptr<SearchBoxModel::ButtonProperty> speech_button) {
39 speech_button_ = speech_button.Pass(); 35 speech_button_ = speech_button.Pass();
40 FOR_EACH_OBSERVER(SearchBoxModelObserver, 36 FOR_EACH_OBSERVER(SearchBoxModelObserver,
41 observers_, 37 observers_,
42 SpeechRecognitionButtonPropChanged()); 38 SpeechRecognitionButtonPropChanged());
43 } 39 }
44 40
45 void SearchBoxModel::SetSpeechRecognitionButtonState(bool toggled) {
46 FOR_EACH_OBSERVER(SearchBoxModelObserver,
47 observers_,
48 SetSpeechRecognitionButtonState(toggled));
49 }
50
51 void SearchBoxModel::SetHintText(const base::string16& hint_text) { 41 void SearchBoxModel::SetHintText(const base::string16& hint_text) {
52 if (hint_text_ == hint_text) 42 if (hint_text_ == hint_text)
53 return; 43 return;
54 44
55 hint_text_ = hint_text; 45 hint_text_ = hint_text;
56 FOR_EACH_OBSERVER(SearchBoxModelObserver, observers_, HintTextChanged()); 46 FOR_EACH_OBSERVER(SearchBoxModelObserver, observers_, HintTextChanged());
57 } 47 }
58 48
59 void SearchBoxModel::SetSelectionModel(const gfx::SelectionModel& sel) { 49 void SearchBoxModel::SetSelectionModel(const gfx::SelectionModel& sel) {
60 if (selection_model_ == sel) 50 if (selection_model_ == sel)
(...skipping 20 matching lines...) Expand all
81 71
82 void SearchBoxModel::AddObserver(SearchBoxModelObserver* observer) { 72 void SearchBoxModel::AddObserver(SearchBoxModelObserver* observer) {
83 observers_.AddObserver(observer); 73 observers_.AddObserver(observer);
84 } 74 }
85 75
86 void SearchBoxModel::RemoveObserver(SearchBoxModelObserver* observer) { 76 void SearchBoxModel::RemoveObserver(SearchBoxModelObserver* observer) {
87 observers_.RemoveObserver(observer); 77 observers_.RemoveObserver(observer);
88 } 78 }
89 79
90 } // namespace app_list 80 } // namespace app_list
OLDNEW
« no previous file with comments | « ui/app_list/search_box_model.h ('k') | ui/app_list/search_box_model_observer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698