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

Side by Side Diff: ui/app_list/views/search_box_view.h

Issue 69813002: Adds the speech recognition button to the app-list searchbox. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 1 month 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
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 #ifndef UI_APP_LIST_VIEWS_SEARCH_BOX_VIEW_H_ 5 #ifndef UI_APP_LIST_VIEWS_SEARCH_BOX_VIEW_H_
6 #define UI_APP_LIST_VIEWS_SEARCH_BOX_VIEW_H_ 6 #define UI_APP_LIST_VIEWS_SEARCH_BOX_VIEW_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "ui/app_list/search_box_model_observer.h" 10 #include "ui/app_list/search_box_model_observer.h"
11 #include "ui/views/controls/button/image_button.h"
11 #include "ui/views/controls/button/menu_button_listener.h" 12 #include "ui/views/controls/button/menu_button_listener.h"
12 #include "ui/views/controls/textfield/textfield_controller.h" 13 #include "ui/views/controls/textfield/textfield_controller.h"
13 #include "ui/views/view.h" 14 #include "ui/views/view.h"
14 15
15 namespace views { 16 namespace views {
16 class ImageView; 17 class ImageView;
17 class MenuButton; 18 class MenuButton;
18 class Textfield; 19 class Textfield;
19 } // namespace views 20 } // namespace views
20 21
21 namespace app_list { 22 namespace app_list {
22 23
23 class AppListMenuViews; 24 class AppListMenuViews;
24 class AppListModel; 25 class AppListModel;
25 class AppListViewDelegate; 26 class AppListViewDelegate;
26 class SearchBoxModel; 27 class SearchBoxModel;
27 class SearchBoxViewDelegate; 28 class SearchBoxViewDelegate;
28 29
29 // SearchBoxView consists of an icon and a Textfield. SearchBoxModel is its data 30 // SearchBoxView consists of an icon and a Textfield. SearchBoxModel is its data
30 // model that controls what icon to display, what placeholder text to use for 31 // model that controls what icon to display, what placeholder text to use for
31 // Textfield. The text and selection model part could be set to change the 32 // Textfield. The text and selection model part could be set to change the
32 // contents and selection model of the Textfield. 33 // contents and selection model of the Textfield.
33 class SearchBoxView : public views::View, 34 class SearchBoxView : public views::View,
34 public views::TextfieldController, 35 public views::TextfieldController,
36 public views::ButtonListener,
35 public views::MenuButtonListener, 37 public views::MenuButtonListener,
36 public SearchBoxModelObserver { 38 public SearchBoxModelObserver {
37 public: 39 public:
38 SearchBoxView(SearchBoxViewDelegate* delegate, 40 SearchBoxView(SearchBoxViewDelegate* delegate,
39 AppListViewDelegate* view_delegate, 41 AppListViewDelegate* view_delegate,
40 AppListModel* model); 42 AppListModel* model);
41 virtual ~SearchBoxView(); 43 virtual ~SearchBoxView();
42 44
43 bool HasSearch() const; 45 bool HasSearch() const;
44 void ClearSearch(); 46 void ClearSearch();
(...skipping 16 matching lines...) Expand all
61 63
62 // Fires query change notification. 64 // Fires query change notification.
63 void NotifyQueryChanged(); 65 void NotifyQueryChanged();
64 66
65 // Overridden from views::TextfieldController: 67 // Overridden from views::TextfieldController:
66 virtual void ContentsChanged(views::Textfield* sender, 68 virtual void ContentsChanged(views::Textfield* sender,
67 const base::string16& new_contents) OVERRIDE; 69 const base::string16& new_contents) OVERRIDE;
68 virtual bool HandleKeyEvent(views::Textfield* sender, 70 virtual bool HandleKeyEvent(views::Textfield* sender,
69 const ui::KeyEvent& key_event) OVERRIDE; 71 const ui::KeyEvent& key_event) OVERRIDE;
70 72
73 // Overridden from views::ButtonListener:
74 virtual void ButtonPressed(views::Button* sender,
75 const ui::Event& event) OVERRIDE;
76
71 // Overridden from views::MenuButtonListener: 77 // Overridden from views::MenuButtonListener:
72 virtual void OnMenuButtonClicked(View* source, 78 virtual void OnMenuButtonClicked(View* source,
73 const gfx::Point& point) OVERRIDE; 79 const gfx::Point& point) OVERRIDE;
74 80
75 // Overridden from SearchBoxModelObserver: 81 // Overridden from SearchBoxModelObserver:
76 virtual void IconChanged() OVERRIDE; 82 virtual void IconChanged() OVERRIDE;
83 virtual void RightButtonPropChanged() OVERRIDE;
84 virtual void RightButtonStateChanged(bool toggled) OVERRIDE;
77 virtual void HintTextChanged() OVERRIDE; 85 virtual void HintTextChanged() OVERRIDE;
78 virtual void SelectionModelChanged() OVERRIDE; 86 virtual void SelectionModelChanged() OVERRIDE;
79 virtual void TextChanged() OVERRIDE; 87 virtual void TextChanged() OVERRIDE;
80 88
81 SearchBoxViewDelegate* delegate_; // Not owned. 89 SearchBoxViewDelegate* delegate_; // Not owned.
82 AppListViewDelegate* view_delegate_; // Not owned. 90 AppListViewDelegate* view_delegate_; // Not owned.
83 AppListModel* model_; // Owned by AppListView. 91 AppListModel* model_; // Owned by AppListView.
84 92
85 scoped_ptr<AppListMenuViews> menu_; 93 scoped_ptr<AppListMenuViews> menu_;
86 94
87 views::ImageView* icon_view_; // Owned by views hierarchy. 95 views::ImageView* icon_view_; // Owned by views hierarchy.
96 views::ToggleImageButton* right_button_; // Owned by views hierarchy.
88 views::MenuButton* menu_button_; // Owned by views hierarchy. 97 views::MenuButton* menu_button_; // Owned by views hierarchy.
89 views::Textfield* search_box_; // Owned by views hierarchy. 98 views::Textfield* search_box_; // Owned by views hierarchy.
90 views::View* contents_view_; // Owned by views hierarchy. 99 views::View* contents_view_; // Owned by views hierarchy.
91 100
92 DISALLOW_COPY_AND_ASSIGN(SearchBoxView); 101 DISALLOW_COPY_AND_ASSIGN(SearchBoxView);
93 }; 102 };
94 103
95 } // namespace app_list 104 } // namespace app_list
96 105
97 #endif // UI_APP_LIST_VIEWS_SEARCH_BOX_VIEW_H_ 106 #endif // UI_APP_LIST_VIEWS_SEARCH_BOX_VIEW_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698