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

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

Issue 19675010: [win] Initialize the app list menu lazily, and allow invalidation. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase/no-op because CQ is wedged Created 7 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « ui/app_list/views/app_list_view.cc ('k') | ui/app_list/views/search_box_view.cc » ('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 #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/app_list/views/app_list_menu_views.h"
12 #include "ui/views/controls/button/menu_button_listener.h" 11 #include "ui/views/controls/button/menu_button_listener.h"
13 #include "ui/views/controls/textfield/textfield_controller.h" 12 #include "ui/views/controls/textfield/textfield_controller.h"
14 #include "ui/views/view.h" 13 #include "ui/views/view.h"
15 14
16 namespace views { 15 namespace views {
17 class ImageView; 16 class ImageView;
18 class MenuButton; 17 class MenuButton;
19 class Textfield; 18 class Textfield;
20 } // namespace views 19 } // namespace views
21 20
22 namespace app_list { 21 namespace app_list {
23 22
23 class AppListMenuViews;
24 class AppListViewDelegate; 24 class AppListViewDelegate;
25 class SearchBoxModel; 25 class SearchBoxModel;
26 class SearchBoxViewDelegate; 26 class SearchBoxViewDelegate;
27 27
28 // SearchBoxView consists of an icon and a Textfield. SearchBoxModel is its data 28 // 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 29 // 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 30 // Textfield. The text and selection model part could be set to change the
31 // contents and selection model of the Textfield. 31 // contents and selection model of the Textfield.
32 class SearchBoxView : public views::View, 32 class SearchBoxView : public views::View,
33 public views::TextfieldController, 33 public views::TextfieldController,
34 public views::MenuButtonListener, 34 public views::MenuButtonListener,
35 public SearchBoxModelObserver { 35 public SearchBoxModelObserver {
36 public: 36 public:
37 SearchBoxView(SearchBoxViewDelegate* delegate, 37 SearchBoxView(SearchBoxViewDelegate* delegate,
38 AppListViewDelegate* view_delegate); 38 AppListViewDelegate* view_delegate);
39 virtual ~SearchBoxView(); 39 virtual ~SearchBoxView();
40 40
41 void SetModel(SearchBoxModel* model); 41 void SetModel(SearchBoxModel* model);
42 42
43 bool HasSearch() const; 43 bool HasSearch() const;
44 void ClearSearch(); 44 void ClearSearch();
45 void InvalidateMenu();
45 46
46 views::Textfield* search_box() { return search_box_; } 47 views::Textfield* search_box() { return search_box_; }
47 48
48 void set_contents_view(View* contents_view) { 49 void set_contents_view(View* contents_view) {
49 contents_view_ = contents_view; 50 contents_view_ = contents_view;
50 } 51 }
51 52
52 // Overridden from views::View: 53 // Overridden from views::View:
53 virtual gfx::Size GetPreferredSize() OVERRIDE; 54 virtual gfx::Size GetPreferredSize() OVERRIDE;
54 virtual void Layout() OVERRIDE; 55 virtual void Layout() OVERRIDE;
(...skipping 16 matching lines...) Expand all
71 virtual void OnMenuButtonClicked(View* source, 72 virtual void OnMenuButtonClicked(View* source,
72 const gfx::Point& point) OVERRIDE; 73 const gfx::Point& point) OVERRIDE;
73 74
74 // Overridden from SearchBoxModelObserver: 75 // Overridden from SearchBoxModelObserver:
75 virtual void IconChanged() OVERRIDE; 76 virtual void IconChanged() OVERRIDE;
76 virtual void HintTextChanged() OVERRIDE; 77 virtual void HintTextChanged() OVERRIDE;
77 virtual void SelectionModelChanged() OVERRIDE; 78 virtual void SelectionModelChanged() OVERRIDE;
78 virtual void TextChanged() OVERRIDE; 79 virtual void TextChanged() OVERRIDE;
79 80
80 SearchBoxViewDelegate* delegate_; // Not owned. 81 SearchBoxViewDelegate* delegate_; // Not owned.
82 AppListViewDelegate* view_delegate_; // Not owned.
81 SearchBoxModel* model_; // Owned by AppListModel. 83 SearchBoxModel* model_; // Owned by AppListModel.
82 84
83 AppListMenuViews menu_; 85 scoped_ptr<AppListMenuViews> menu_;
84 86
85 views::ImageView* icon_view_; // Owned by views hierarchy. 87 views::ImageView* icon_view_; // Owned by views hierarchy.
86 views::MenuButton* menu_button_; // Owned by views hierarchy. 88 views::MenuButton* menu_button_; // Owned by views hierarchy.
87 views::Textfield* search_box_; // Owned by views hierarchy. 89 views::Textfield* search_box_; // Owned by views hierarchy.
88 views::View* contents_view_; // Owned by views hierarchy. 90 views::View* contents_view_; // Owned by views hierarchy.
89 91
90 DISALLOW_COPY_AND_ASSIGN(SearchBoxView); 92 DISALLOW_COPY_AND_ASSIGN(SearchBoxView);
91 }; 93 };
92 94
93 } // namespace app_list 95 } // namespace app_list
94 96
95 #endif // UI_APP_LIST_VIEWS_SEARCH_BOX_VIEW_H_ 97 #endif // UI_APP_LIST_VIEWS_SEARCH_BOX_VIEW_H_
OLDNEW
« no previous file with comments | « ui/app_list/views/app_list_view.cc ('k') | ui/app_list/views/search_box_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698