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

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

Issue 10386224: app_list: Add search box and search result view for v2. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix win_aura Created 8 years, 7 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
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef UI_APP_LIST_SEARCH_BOX_VIEW_H_
6 #define UI_APP_LIST_SEARCH_BOX_VIEW_H_
7 #pragma once
8
9 #include <string>
10
11 #include "ui/app_list/search_box_model_observer.h"
12 #include "ui/views/view.h"
13 #include "ui/views/controls/textfield/textfield_controller.h"
14
15 namespace views {
16 class ImageView;
17 class Textfield;
18 } // namespace views
19
20 namespace app_list {
21
22 class SearchBoxModel;
23 class SearchBoxViewDelegate;
24
25 // SearchBoxView consists of an icon and a Textfield. SearchBoxModel is its data
26 // model that controls what icon to display, what placeholder text to use for
27 // Textfield. The text and selection model part could be set to change the
28 // contents and selection model of the Textfield.
29 class SearchBoxView : public views::View,
30 public views::TextfieldController,
31 public SearchBoxModelObserver {
32 public:
33 explicit SearchBoxView(SearchBoxViewDelegate* delegate);
34 virtual ~SearchBoxView();
35
36 void SetModel(SearchBoxModel* model);
37
38 views::Textfield* search_box() { return search_box_; }
39 void set_grid_view(View* grid_view) { grid_view_ = grid_view; }
40 void set_results_view(View* results_view) { results_view_ = results_view; }
41
42 // Overridden from views::View:
43 virtual gfx::Size GetPreferredSize() OVERRIDE;
44 virtual void Layout() OVERRIDE;
45
46 private:
47 // Updates model text and selection model with current Textfield info.
48 void UpdateModel();
49
50 // Fires query change notification.
51 void NotifyQueryChanged();
52
53 // Overridden from views::TextfieldController:
54 virtual void ContentsChanged(views::Textfield* sender,
55 const string16& new_contents) OVERRIDE;
56 virtual bool HandleKeyEvent(views::Textfield* sender,
57 const views::KeyEvent& key_event) OVERRIDE;
58
59 // Overridden from SearchBoxModelObserver:
60 virtual void IconChanged() OVERRIDE;
61 virtual void HintTextChanged() OVERRIDE;
62 virtual void SelectionModelChanged() OVERRIDE;
63 virtual void TextChanged() OVERRIDE;
64
65 SearchBoxViewDelegate* delegate_; // Not owned.
66 SearchBoxModel* model_; // Owned by AppListModel
67
68 views::ImageView* icon_view_; // Owned by views hierarchy
69 views::Textfield* search_box_; // Owned by views hierarchy
70 views::View* grid_view_; // Owned by views hierarchy
71 views::View* results_view_; // Owned by views hierarchy
72
73 DISALLOW_COPY_AND_ASSIGN(SearchBoxView);
74 };
75
76 } // namespace app_list
77
78 #endif // UI_APP_LIST_SEARCH_BOX_VIEW_H_
79
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698