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

Side by Side Diff: chrome/browser/ui/app_list/app_list_shower_views.h

Issue 225053004: Refactor views app list services to allow more code sharing (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Windows is the worst Created 6 years, 8 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
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 CHROME_BROWSER_UI_APP_LIST_APP_LIST_SHOWER_H_ 5 #ifndef CHROME_BROWSER_UI_APP_LIST_APP_LIST_SHOWER_VIEWS_H_
6 #define CHROME_BROWSER_UI_APP_LIST_APP_LIST_SHOWER_H_ 6 #define CHROME_BROWSER_UI_APP_LIST_APP_LIST_SHOWER_VIEWS_H_
7 7
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "chrome/browser/ui/app_list/app_list.h"
10 #include "chrome/browser/ui/app_list/app_list_factory.h"
11 #include "ui/app_list/pagination_model.h" 9 #include "ui/app_list/pagination_model.h"
12 #include "ui/gfx/native_widget_types.h" 10 #include "ui/gfx/native_widget_types.h"
13 11
14 namespace app_list { 12 namespace app_list {
15 class AppListModel; 13 class AppListView;
16 } 14 }
17 15
16 class AppListShowerDelegate;
18 class AppListShowerUnitTest; 17 class AppListShowerUnitTest;
19 class Profile; 18 class Profile;
20 class ScopedKeepAlive; 19 class ScopedKeepAlive;
21 20
22 // Creates and shows an AppList as needed for non-Ash desktops. It is owned 21 // Creates and shows an AppList as needed for non-Ash desktops. It is owned by
23 // by AppListService. 22 // AppListServiceViews.
24 class AppListShower { 23 class AppListShower {
25 public: 24 public:
26 AppListShower(scoped_ptr<AppListFactory> factory, 25 explicit AppListShower(AppListShowerDelegate* delegate);
27 AppListService* service); 26 virtual ~AppListShower();
28 ~AppListShower();
29
30 void set_can_close(bool can_close) {
31 can_close_app_list_ = can_close;
32 }
33 27
34 void ShowForProfile(Profile* requested_profile); 28 void ShowForProfile(Profile* requested_profile);
35 gfx::NativeWindow GetWindow(); 29 gfx::NativeWindow GetWindow();
36 30
37 AppList* app_list() { return app_list_.get(); } 31 app_list::AppListView* app_list() { return app_list_; }
38 Profile* profile() const { return profile_; } 32 Profile* profile() const { return profile_; }
39 33
40 // Create or recreate, and initialize |app_list_| from |requested_profile|. 34 // Create or recreate, and initialize |app_list_| from |requested_profile|.
41 void CreateViewForProfile(Profile* requested_profile); 35 void CreateViewForProfile(Profile* requested_profile);
42 36
43 void DismissAppList(); 37 void DismissAppList();
44 void HandleViewBeingDestroyed(); 38 virtual void HandleViewBeingDestroyed();
45 bool IsAppListVisible() const; 39 virtual bool IsAppListVisible() const;
46 void WarmupForProfile(Profile* profile); 40 void WarmupForProfile(Profile* profile);
47 bool HasView() const; 41 virtual bool HasView() const;
42
43 protected:
44 // Virtual functions mocked out in tests.
45 virtual app_list::AppListView* MakeViewForCurrentProfile();
46 virtual void UpdateViewForNewProfile();
47
48 // Shows the app list, activates it, and ensures the taskbar icon is updated.
49 virtual void Show();
50 virtual void Hide();
48 51
49 private: 52 private:
50 friend class ::AppListShowerUnitTest; 53 friend class ::AppListShowerUnitTest;
51 54
52 void ResetKeepAlive(); 55 void ResetKeepAlive();
53 56
54 scoped_ptr<AppListFactory> factory_; 57 AppListShowerDelegate* delegate_; // Weak. Owns this.
55 scoped_ptr<ScopedKeepAlive> keep_alive_; 58
56 scoped_ptr<AppList> app_list_; 59 // The profile currently shown by |app_list_|.
57 AppListService* service_; // Weak ptr, owns this.
58 Profile* profile_; 60 Profile* profile_;
59 bool can_close_app_list_; 61
62 // The view, once created. Owned by native widget.
63 app_list::AppListView* app_list_;
60 64
61 // Used to keep the browser process alive while the app list is visible. 65 // Used to keep the browser process alive while the app list is visible.
66 scoped_ptr<ScopedKeepAlive> keep_alive_;
67
68 bool window_icon_updated_;
69 app_list::PaginationModel pagination_model_;
62 70
63 DISALLOW_COPY_AND_ASSIGN(AppListShower); 71 DISALLOW_COPY_AND_ASSIGN(AppListShower);
64 }; 72 };
65 73
66 #endif // CHROME_BROWSER_UI_APP_LIST_APP_LIST_SHOWER_H_ 74 #endif // CHROME_BROWSER_UI_APP_LIST_APP_LIST_SHOWER_VIEWS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698