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

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

Issue 302803002: Refactor app list so AppsGridView owns the PaginationModel. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix compile error (conflict). Created 6 years, 6 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_folder_view.cc ('k') | ui/app_list/views/app_list_main_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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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_APP_LIST_MAIN_VIEW_H_ 5 #ifndef UI_APP_LIST_VIEWS_APP_LIST_MAIN_VIEW_H_
6 #define UI_APP_LIST_VIEWS_APP_LIST_MAIN_VIEW_H_ 6 #define UI_APP_LIST_VIEWS_APP_LIST_MAIN_VIEW_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/memory/scoped_vector.h" 10 #include "base/memory/scoped_vector.h"
(...skipping 21 matching lines...) Expand all
32 32
33 // AppListMainView contains the normal view of the app list, which is shown 33 // AppListMainView contains the normal view of the app list, which is shown
34 // when the user is signed in. 34 // when the user is signed in.
35 class APP_LIST_EXPORT AppListMainView : public views::View, 35 class APP_LIST_EXPORT AppListMainView : public views::View,
36 public AppsGridViewDelegate, 36 public AppsGridViewDelegate,
37 public SearchBoxViewDelegate, 37 public SearchBoxViewDelegate,
38 public SearchResultListViewDelegate { 38 public SearchResultListViewDelegate {
39 public: 39 public:
40 // Takes ownership of |delegate|. 40 // Takes ownership of |delegate|.
41 explicit AppListMainView(AppListViewDelegate* delegate, 41 explicit AppListMainView(AppListViewDelegate* delegate,
42 PaginationModel* pagination_model, 42 int initial_apps_page,
43 gfx::NativeView parent); 43 gfx::NativeView parent);
44 virtual ~AppListMainView(); 44 virtual ~AppListMainView();
45 45
46 void ShowAppListWhenReady(); 46 void ShowAppListWhenReady();
47 47
48 void ResetForShow(); 48 void ResetForShow();
49 49
50 void Close(); 50 void Close();
51 51
52 void Prerender(); 52 void Prerender();
(...skipping 14 matching lines...) Expand all
67 ContentsView* contents_view() const { return contents_view_; } 67 ContentsView* contents_view() const { return contents_view_; }
68 68
69 // Returns true if the app list should be centered and in landscape mode. 69 // Returns true if the app list should be centered and in landscape mode.
70 bool ShouldCenterWindow() const; 70 bool ShouldCenterWindow() const;
71 71
72 private: 72 private:
73 class IconLoader; 73 class IconLoader;
74 74
75 void AddContentsView(); 75 void AddContentsView();
76 76
77 // Gets the PaginationModel owned by the AppsGridView.
78 PaginationModel* GetAppsPaginationModel();
79
77 // Loads icon image for the apps in the selected page of |pagination_model_|. 80 // Loads icon image for the apps in the selected page of |pagination_model_|.
78 // |parent| is used to determine the image scale factor to use. 81 // |parent| is used to determine the image scale factor to use.
79 void PreloadIcons(gfx::NativeView parent); 82 void PreloadIcons(gfx::NativeView parent);
80 83
81 // Invoked when |icon_loading_wait_timer_| fires. 84 // Invoked when |icon_loading_wait_timer_| fires.
82 void OnIconLoadingWaitTimer(); 85 void OnIconLoadingWaitTimer();
83 86
84 // Invoked from an IconLoader when icon loading is finished. 87 // Invoked from an IconLoader when icon loading is finished.
85 void OnItemIconLoaded(IconLoader* loader); 88 void OnItemIconLoaded(IconLoader* loader);
86 89
87 // Overridden from views::View: 90 // Overridden from views::View:
88 virtual void ChildVisibilityChanged(views::View* child) OVERRIDE; 91 virtual void ChildVisibilityChanged(views::View* child) OVERRIDE;
89 92
90 // Overridden from AppsGridViewDelegate: 93 // Overridden from AppsGridViewDelegate:
91 virtual void ActivateApp(AppListItem* item, int event_flags) OVERRIDE; 94 virtual void ActivateApp(AppListItem* item, int event_flags) OVERRIDE;
92 virtual void GetShortcutPathForApp( 95 virtual void GetShortcutPathForApp(
93 const std::string& app_id, 96 const std::string& app_id,
94 const base::Callback<void(const base::FilePath&)>& callback) OVERRIDE; 97 const base::Callback<void(const base::FilePath&)>& callback) OVERRIDE;
95 98
96 // Overridden from SearchBoxViewDelegate: 99 // Overridden from SearchBoxViewDelegate:
97 virtual void QueryChanged(SearchBoxView* sender) OVERRIDE; 100 virtual void QueryChanged(SearchBoxView* sender) OVERRIDE;
98 101
99 // Overridden from SearchResultListViewDelegate: 102 // Overridden from SearchResultListViewDelegate:
100 virtual void OnResultInstalled(SearchResult* result) OVERRIDE; 103 virtual void OnResultInstalled(SearchResult* result) OVERRIDE;
101 virtual void OnResultUninstalled(SearchResult* result) OVERRIDE; 104 virtual void OnResultUninstalled(SearchResult* result) OVERRIDE;
102 105
103 AppListViewDelegate* delegate_; // Owned by parent view (AppListView). 106 AppListViewDelegate* delegate_; // Owned by parent view (AppListView).
104 PaginationModel* pagination_model_; // Owned by AppListController.
105 AppListModel* model_; // Unowned; ownership is handled by |delegate_|. 107 AppListModel* model_; // Unowned; ownership is handled by |delegate_|.
106 108
107 SearchBoxView* search_box_view_; // Owned by views hierarchy. 109 SearchBoxView* search_box_view_; // Owned by views hierarchy.
108 ContentsView* contents_view_; // Owned by views hierarchy. 110 ContentsView* contents_view_; // Owned by views hierarchy.
109 111
110 // A timer that fires when maximum allowed time to wait for icon loading has 112 // A timer that fires when maximum allowed time to wait for icon loading has
111 // passed. 113 // passed.
112 base::OneShotTimer<AppListMainView> icon_loading_wait_timer_; 114 base::OneShotTimer<AppListMainView> icon_loading_wait_timer_;
113 115
114 ScopedVector<IconLoader> pending_icon_loaders_; 116 ScopedVector<IconLoader> pending_icon_loaders_;
115 117
116 base::WeakPtrFactory<AppListMainView> weak_ptr_factory_; 118 base::WeakPtrFactory<AppListMainView> weak_ptr_factory_;
117 119
118 DISALLOW_COPY_AND_ASSIGN(AppListMainView); 120 DISALLOW_COPY_AND_ASSIGN(AppListMainView);
119 }; 121 };
120 122
121 } // namespace app_list 123 } // namespace app_list
122 124
123 #endif // UI_APP_LIST_VIEWS_APP_LIST_MAIN_VIEW_H_ 125 #endif // UI_APP_LIST_VIEWS_APP_LIST_MAIN_VIEW_H_
OLDNEW
« no previous file with comments | « ui/app_list/views/app_list_folder_view.cc ('k') | ui/app_list/views/app_list_main_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698