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

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

Issue 22268009: Move signin status and current user information into AppListModel. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years, 4 months 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
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/menu_button_listener.h" 11 #include "ui/views/controls/button/menu_button_listener.h"
12 #include "ui/views/controls/textfield/textfield_controller.h" 12 #include "ui/views/controls/textfield/textfield_controller.h"
13 #include "ui/views/view.h" 13 #include "ui/views/view.h"
14 14
15 namespace views { 15 namespace views {
16 class ImageView; 16 class ImageView;
17 class MenuButton; 17 class MenuButton;
18 class Textfield; 18 class Textfield;
19 } // namespace views 19 } // namespace views
20 20
21 namespace app_list { 21 namespace app_list {
22 22
23 class AppListMenuViews; 23 class AppListMenuViews;
24 class AppListViewDelegate; 24 class AppListViewDelegate;
25 class AppListModel;
xiyuan 2013/08/06 17:04:54 nit: keep the list sorted.
calamity 2013/08/08 01:34:58 Done.
25 class SearchBoxModel; 26 class SearchBoxModel;
26 class SearchBoxViewDelegate; 27 class SearchBoxViewDelegate;
27 28
28 // SearchBoxView consists of an icon and a Textfield. SearchBoxModel is its data 29 // SearchBoxView consists of an icon and a Textfield. SearchBoxModel is its data
29 // model that controls what icon to display, what placeholder text to use for 30 // model that controls what icon to display, what placeholder text to use for
30 // Textfield. The text and selection model part could be set to change the 31 // Textfield. The text and selection model part could be set to change the
31 // contents and selection model of the Textfield. 32 // contents and selection model of the Textfield.
32 class SearchBoxView : public views::View, 33 class SearchBoxView : public views::View,
33 public views::TextfieldController, 34 public views::TextfieldController,
34 public views::MenuButtonListener, 35 public views::MenuButtonListener,
35 public SearchBoxModelObserver { 36 public SearchBoxModelObserver {
36 public: 37 public:
37 SearchBoxView(SearchBoxViewDelegate* delegate, 38 SearchBoxView(SearchBoxViewDelegate* delegate,
38 AppListViewDelegate* view_delegate); 39 AppListViewDelegate* view_delegate,
40 AppListModel* model);
39 virtual ~SearchBoxView(); 41 virtual ~SearchBoxView();
40 42
41 void SetModel(SearchBoxModel* model);
42
43 bool HasSearch() const; 43 bool HasSearch() const;
44 void ClearSearch(); 44 void ClearSearch();
45 void InvalidateMenu(); 45 void InvalidateMenu();
46 46
47 views::Textfield* search_box() { return search_box_; } 47 views::Textfield* search_box() { return search_box_; }
48 48
49 void set_contents_view(View* contents_view) { 49 void set_contents_view(View* contents_view) {
50 contents_view_ = contents_view; 50 contents_view_ = contents_view;
51 } 51 }
52 52
(...skipping 20 matching lines...) Expand all
73 const gfx::Point& point) OVERRIDE; 73 const gfx::Point& point) OVERRIDE;
74 74
75 // Overridden from SearchBoxModelObserver: 75 // Overridden from SearchBoxModelObserver:
76 virtual void IconChanged() OVERRIDE; 76 virtual void IconChanged() OVERRIDE;
77 virtual void HintTextChanged() OVERRIDE; 77 virtual void HintTextChanged() OVERRIDE;
78 virtual void SelectionModelChanged() OVERRIDE; 78 virtual void SelectionModelChanged() OVERRIDE;
79 virtual void TextChanged() OVERRIDE; 79 virtual void TextChanged() OVERRIDE;
80 80
81 SearchBoxViewDelegate* delegate_; // Not owned. 81 SearchBoxViewDelegate* delegate_; // Not owned.
82 AppListViewDelegate* view_delegate_; // Not owned. 82 AppListViewDelegate* view_delegate_; // Not owned.
83 SearchBoxModel* model_; // Owned by AppListModel. 83 AppListModel* model_; // Owned by AppListView.
84 84
85 scoped_ptr<AppListMenuViews> menu_; 85 scoped_ptr<AppListMenuViews> menu_;
86 86
87 views::ImageView* icon_view_; // Owned by views hierarchy. 87 views::ImageView* icon_view_; // Owned by views hierarchy.
88 views::MenuButton* menu_button_; // Owned by views hierarchy. 88 views::MenuButton* menu_button_; // Owned by views hierarchy.
89 views::Textfield* search_box_; // Owned by views hierarchy. 89 views::Textfield* search_box_; // Owned by views hierarchy.
90 views::View* contents_view_; // Owned by views hierarchy. 90 views::View* contents_view_; // Owned by views hierarchy.
91 91
92 DISALLOW_COPY_AND_ASSIGN(SearchBoxView); 92 DISALLOW_COPY_AND_ASSIGN(SearchBoxView);
93 }; 93 };
94 94
95 } // namespace app_list 95 } // namespace app_list
96 96
97 #endif // UI_APP_LIST_VIEWS_SEARCH_BOX_VIEW_H_ 97 #endif // UI_APP_LIST_VIEWS_SEARCH_BOX_VIEW_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698