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

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

Issue 439703002: Allow app list tiles to show search results in the experimental app list. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix athena Created 6 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 | Annotate | Revision Log
« no previous file with comments | « ui/app_list/views/search_result_list_view.cc ('k') | ui/app_list/views/start_page_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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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_START_PAGE_VIEW_H_ 5 #ifndef UI_APP_LIST_VIEWS_START_PAGE_VIEW_H_
6 #define UI_APP_LIST_VIEWS_START_PAGE_VIEW_H_ 6 #define UI_APP_LIST_VIEWS_START_PAGE_VIEW_H_
7 7
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "ui/app_list/app_list_model_observer.h" 9 #include "base/memory/weak_ptr.h"
10 #include "ui/app_list/app_list_export.h"
11 #include "ui/app_list/app_list_model.h"
10 #include "ui/app_list/app_list_view_delegate_observer.h" 12 #include "ui/app_list/app_list_view_delegate_observer.h"
11 #include "ui/app_list/views/search_box_view_delegate.h" 13 #include "ui/app_list/views/search_box_view_delegate.h"
14 #include "ui/base/models/list_model_observer.h"
12 #include "ui/views/view.h" 15 #include "ui/views/view.h"
13 16
14 namespace app_list { 17 namespace app_list {
18 namespace test {
19 class AppListViewTestContext;
20 }
15 21
16 class AppListMainView; 22 class AppListMainView;
17 class AppListModel;
18 class AppListViewDelegate; 23 class AppListViewDelegate;
19 class SearchResultListView; 24 class SearchResultListView;
20 class TileItemView; 25 class TileItemView;
21 26
22 // The start page for the experimental app list. 27 // The start page for the experimental app list.
23 class StartPageView : public views::View, 28 class APP_LIST_EXPORT StartPageView : public views::View,
24 public SearchBoxViewDelegate, 29 public ui::ListModelObserver,
25 public AppListViewDelegateObserver, 30 public SearchBoxViewDelegate,
26 public AppListModelObserver { 31 public AppListViewDelegateObserver {
27 public: 32 public:
28 StartPageView(AppListMainView* app_list_main_view, 33 StartPageView(AppListMainView* app_list_main_view,
29 AppListViewDelegate* view_delegate); 34 AppListViewDelegate* view_delegate);
30 virtual ~StartPageView(); 35 virtual ~StartPageView();
31 36
32 void Reset(); 37 void Reset();
33 void ShowSearchResults(); 38 void ShowSearchResults();
34 39
35 bool IsShowingSearchResults() const; 40 bool IsShowingSearchResults() const;
36 41
37 const std::vector<TileItemView*>& tile_views() const { return tile_views_; } 42 const std::vector<TileItemView*>& tile_views() const { return tile_views_; }
38 SearchBoxView* dummy_search_box_view() { return search_box_view_; } 43 SearchBoxView* dummy_search_box_view() { return search_box_view_; }
39 44
40 // Overridden from views::View: 45 // Overridden from views::View:
41 virtual bool OnKeyPressed(const ui::KeyEvent& event) OVERRIDE; 46 virtual bool OnKeyPressed(const ui::KeyEvent& event) OVERRIDE;
42 virtual void Layout() OVERRIDE; 47 virtual void Layout() OVERRIDE;
43 48
44 private: 49 private:
50 friend class test::AppListViewTestContext;
Matt Giuca 2014/08/14 02:54:22 As discussed, instead of friending, add a public m
calamity 2014/08/14 04:28:05 Done.
51
45 enum ShowState { 52 enum ShowState {
46 SHOW_START_PAGE, 53 SHOW_START_PAGE,
47 SHOW_SEARCH_RESULTS, 54 SHOW_SEARCH_RESULTS,
48 }; 55 };
49 56
50 void InitInstantContainer(); 57 void InitInstantContainer();
51 void InitTilesContainer(); 58 void InitTilesContainer();
52 59
53 void SetShowState(ShowState show_state); 60 void SetShowState(ShowState show_state);
54 void SetModel(AppListModel* model); 61 void SetModel(AppListModel* model);
55 62
63 // Updates UI with model.
64 void Update();
65
66 // Schedules an Update() call using |update_factory_|. Does nothing if there
67 // is a pending call.
68 void ScheduleUpdate();
69
56 // Overridden from SearchBoxViewDelegate: 70 // Overridden from SearchBoxViewDelegate:
57 virtual void QueryChanged(SearchBoxView* sender) OVERRIDE; 71 virtual void QueryChanged(SearchBoxView* sender) OVERRIDE;
58 72
59 // Overridden from AppListViewDelegateObserver: 73 // Overridden from AppListViewDelegateObserver:
60 virtual void OnProfilesChanged() OVERRIDE; 74 virtual void OnProfilesChanged() OVERRIDE;
61 75
62 // Overridden from AppListModelObserver: 76 // Overridden from ui::ListModelObserver:
63 virtual void OnAppListModelStatusChanged() OVERRIDE; 77 virtual void ListItemsAdded(size_t start, size_t count) OVERRIDE;
64 virtual void OnAppListItemAdded(AppListItem* item) OVERRIDE; 78 virtual void ListItemsRemoved(size_t start, size_t count) OVERRIDE;
65 virtual void OnAppListItemDeleted() OVERRIDE; 79 virtual void ListItemMoved(size_t index, size_t target_index) OVERRIDE;
66 virtual void OnAppListItemUpdated(AppListItem* item) OVERRIDE; 80 virtual void ListItemsChanged(size_t start, size_t count) OVERRIDE;
67 81
68 // The parent view of ContentsView which is the parent of this view. 82 // The parent view of ContentsView which is the parent of this view.
69 AppListMainView* app_list_main_view_; 83 AppListMainView* app_list_main_view_;
70 84
71 AppListModel* model_; // Owned by AppListSyncableService. 85 AppListModel::SearchResults*
86 search_results_model_; // Owned by AppListSyncableService.
72 87
73 AppListViewDelegate* view_delegate_; // Owned by AppListView. 88 AppListViewDelegate* view_delegate_; // Owned by AppListView.
74 89
75 SearchBoxView* search_box_view_; // Owned by views hierarchy. 90 SearchBoxView* search_box_view_; // Owned by views hierarchy.
76 SearchResultListView* results_view_; // Owned by views hierarchy. 91 SearchResultListView* results_view_; // Owned by views hierarchy.
77 views::View* instant_container_; // Owned by views hierarchy. 92 views::View* instant_container_; // Owned by views hierarchy.
78 views::View* tiles_container_; // Owned by views hierarchy. 93 views::View* tiles_container_; // Owned by views hierarchy.
79 94
80 std::vector<TileItemView*> tile_views_; 95 std::vector<TileItemView*> tile_views_;
81 96
82 ShowState show_state_; 97 ShowState show_state_;
83 98
99 // ScheduleUpdate() generates a single weak pointer; if one exists then an
100 // update is pending. Further calls to ScheduleUpdate() will have no effect.
101 // Once the Update() completes, the weak pointer is invalidated.
102 base::WeakPtrFactory<StartPageView> update_factory_;
103
84 DISALLOW_COPY_AND_ASSIGN(StartPageView); 104 DISALLOW_COPY_AND_ASSIGN(StartPageView);
85 }; 105 };
86 106
87 } // namespace app_list 107 } // namespace app_list
88 108
89 #endif // UI_APP_LIST_VIEWS_START_PAGE_VIEW_H_ 109 #endif // UI_APP_LIST_VIEWS_START_PAGE_VIEW_H_
OLDNEW
« no previous file with comments | « ui/app_list/views/search_result_list_view.cc ('k') | ui/app_list/views/start_page_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698