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

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: rebase, rename and add chrome search 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 "base/timer.h"
12 #include "ui/app_list/search_box_model_observer.h"
13 #include "ui/views/view.h"
14 #include "ui/views/controls/textfield/textfield_controller.h"
15
16 namespace views {
17 class ImageView;
18 class Textfield;
19 } // namespace views
20
21 namespace app_list {
22
23 class SearchBoxModel;
24 class SearchBoxViewDelegate;
25
26 class SearchBoxView : public views::View,
sky 2012/05/22 22:16:06 Add a description.
xiyuan 2012/05/23 21:25:22 Done.
27 public views::TextfieldController,
28 public SearchBoxModelObserver {
29 public:
30 explicit SearchBoxView(SearchBoxViewDelegate* delegate);
31 virtual ~SearchBoxView();
32
33 void SetModel(SearchBoxModel* model);
34
35 views::Textfield* search_box() {
36 return search_box_;
37 }
38
39 private:
40 // Updates model text and selection model with current Textfield info.
41 void UpdateModel();
42
43 // Fires query change notification.
44 void NotifyQueryChanged();
45
46 // Overridden from views::View:
47 virtual gfx::Size GetPreferredSize() OVERRIDE;
48 virtual void Layout() OVERRIDE;
49
50 // Overridden from views::TextfieldController:
51 virtual void ContentsChanged(views::Textfield* sender,
52 const string16& new_contents) OVERRIDE;
53 virtual bool HandleKeyEvent(views::Textfield* sender,
54 const views::KeyEvent& key_event) OVERRIDE;
55
56 // Overridden from SearchBoxModelObserver:
57 virtual void IconChanged() OVERRIDE;
58 virtual void HintTextChanged() OVERRIDE;
59 virtual void SelectionModelChanged() OVERRIDE;
60 virtual void TextChanged() OVERRIDE;
61
62 SearchBoxViewDelegate* delegate_; // Not owned.
63 SearchBoxModel* model_; // Owned by AppListModel
64
65 views::ImageView* icon_view_; // Owned by views hierarchy
66 views::Textfield* search_box_; // Owned by views hierarchy
67
68 // Query text change coalescing timer.
69 base::OneShotTimer<SearchBoxView> query_timer_;
70
71 DISALLOW_COPY_AND_ASSIGN(SearchBoxView);
72 };
73
74 } // namespace app_list
75
76 #endif // UI_APP_LIST_SEARCH_BOX_VIEW_H_
77
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698