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

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

Issue 79773005: Update app list search box menu when Users changes (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add AppListViewDelegateObserver 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
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/app_list_view_delegate_observer.h"
10 #include "ui/app_list/search_box_model_observer.h" 11 #include "ui/app_list/search_box_model_observer.h"
11 #include "ui/views/controls/button/image_button.h" 12 #include "ui/views/controls/button/image_button.h"
12 #include "ui/views/controls/button/menu_button_listener.h" 13 #include "ui/views/controls/button/menu_button_listener.h"
13 #include "ui/views/controls/textfield/textfield_controller.h" 14 #include "ui/views/controls/textfield/textfield_controller.h"
14 #include "ui/views/view.h" 15 #include "ui/views/view.h"
15 16
16 namespace views { 17 namespace views {
17 class ImageView; 18 class ImageView;
18 class MenuButton; 19 class MenuButton;
19 class Textfield; 20 class Textfield;
20 } // namespace views 21 } // namespace views
21 22
22 namespace app_list { 23 namespace app_list {
23 24
24 class AppListMenuViews; 25 class AppListMenuViews;
25 class AppListModel; 26 class AppListModel;
26 class AppListViewDelegate; 27 class AppListViewDelegate;
27 class SearchBoxModel; 28 class SearchBoxModel;
28 class SearchBoxViewDelegate; 29 class SearchBoxViewDelegate;
29 30
30 // SearchBoxView consists of an icon and a Textfield. SearchBoxModel is its data 31 // SearchBoxView consists of an icon and a Textfield. SearchBoxModel is its data
31 // model that controls what icon to display, what placeholder text to use for 32 // model that controls what icon to display, what placeholder text to use for
32 // Textfield. The text and selection model part could be set to change the 33 // Textfield. The text and selection model part could be set to change the
33 // contents and selection model of the Textfield. 34 // contents and selection model of the Textfield.
34 class SearchBoxView : public views::View, 35 class SearchBoxView : public views::View,
35 public views::TextfieldController, 36 public views::TextfieldController,
36 public views::ButtonListener, 37 public views::ButtonListener,
37 public views::MenuButtonListener, 38 public views::MenuButtonListener,
39 public AppListViewDelegateObserver,
38 public SearchBoxModelObserver { 40 public SearchBoxModelObserver {
39 public: 41 public:
40 SearchBoxView(SearchBoxViewDelegate* delegate, 42 SearchBoxView(SearchBoxViewDelegate* delegate,
41 AppListViewDelegate* view_delegate, 43 AppListViewDelegate* view_delegate,
42 AppListModel* model); 44 AppListModel* model);
43 virtual ~SearchBoxView(); 45 virtual ~SearchBoxView();
44 46
45 bool HasSearch() const; 47 bool HasSearch() const;
46 void ClearSearch(); 48 void ClearSearch();
47 void InvalidateMenu(); 49 void InvalidateMenu();
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 const gfx::Point& point) OVERRIDE; 81 const gfx::Point& point) OVERRIDE;
80 82
81 // Overridden from SearchBoxModelObserver: 83 // Overridden from SearchBoxModelObserver:
82 virtual void IconChanged() OVERRIDE; 84 virtual void IconChanged() OVERRIDE;
83 virtual void SpeechRecognitionButtonPropChanged() OVERRIDE; 85 virtual void SpeechRecognitionButtonPropChanged() OVERRIDE;
84 virtual void SetSpeechRecognitionButtonState(bool toggled) OVERRIDE; 86 virtual void SetSpeechRecognitionButtonState(bool toggled) OVERRIDE;
85 virtual void HintTextChanged() OVERRIDE; 87 virtual void HintTextChanged() OVERRIDE;
86 virtual void SelectionModelChanged() OVERRIDE; 88 virtual void SelectionModelChanged() OVERRIDE;
87 virtual void TextChanged() OVERRIDE; 89 virtual void TextChanged() OVERRIDE;
88 90
91 // Overridden from AppListViewDelegateObserver:
92 virtual void OnUsersChanged() OVERRIDE;
93
89 SearchBoxViewDelegate* delegate_; // Not owned. 94 SearchBoxViewDelegate* delegate_; // Not owned.
90 AppListViewDelegate* view_delegate_; // Not owned. 95 AppListViewDelegate* view_delegate_; // Not owned.
91 AppListModel* model_; // Owned by AppListView. 96 AppListModel* model_; // Owned by AppListView.
92 97
93 scoped_ptr<AppListMenuViews> menu_; 98 scoped_ptr<AppListMenuViews> menu_;
94 99
95 views::ImageView* icon_view_; // Owned by views hierarchy. 100 views::ImageView* icon_view_; // Owned by views hierarchy.
96 views::ToggleImageButton* speech_button_; // Owned by views hierarchy. 101 views::ToggleImageButton* speech_button_; // Owned by views hierarchy.
97 views::MenuButton* menu_button_; // Owned by views hierarchy. 102 views::MenuButton* menu_button_; // Owned by views hierarchy.
98 views::Textfield* search_box_; // Owned by views hierarchy. 103 views::Textfield* search_box_; // Owned by views hierarchy.
99 views::View* contents_view_; // Owned by views hierarchy. 104 views::View* contents_view_; // Owned by views hierarchy.
100 105
101 DISALLOW_COPY_AND_ASSIGN(SearchBoxView); 106 DISALLOW_COPY_AND_ASSIGN(SearchBoxView);
102 }; 107 };
103 108
104 } // namespace app_list 109 } // namespace app_list
105 110
106 #endif // UI_APP_LIST_VIEWS_SEARCH_BOX_VIEW_H_ 111 #endif // UI_APP_LIST_VIEWS_SEARCH_BOX_VIEW_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698