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

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

Issue 20656002: Add profile selector menu to app list. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: remove junk from list_model.h Created 7 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
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_SERVICE_IMPL_H_ 5 #ifndef CHROME_BROWSER_UI_APP_LIST_APP_LIST_SERVICE_IMPL_H_
6 #define CHROME_BROWSER_UI_APP_LIST_APP_LIST_SERVICE_IMPL_H_ 6 #define CHROME_BROWSER_UI_APP_LIST_APP_LIST_SERVICE_IMPL_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
11 #include "base/compiler_specific.h" 11 #include "base/compiler_specific.h"
12 #include "base/memory/scoped_ptr.h" 12 #include "base/memory/scoped_ptr.h"
13 #include "base/memory/weak_ptr.h" 13 #include "base/memory/weak_ptr.h"
14 #include "chrome/browser/profiles/profile.h" 14 #include "chrome/browser/profiles/profile.h"
15 #include "chrome/browser/profiles/profile_info_cache_observer.h" 15 #include "chrome/browser/profiles/profile_info_cache_observer.h"
16 #include "chrome/browser/profiles/profile_loader.h" 16 #include "chrome/browser/profiles/profile_loader.h"
17 #include "chrome/browser/ui/app_list/app_list_service.h" 17 #include "chrome/browser/ui/app_list/app_list_service.h"
18 #include "content/public/browser/notification_observer.h"
19 #include "content/public/browser/notification_registrar.h"
20 18
21 namespace base { 19 namespace base {
22 class FilePath; 20 class FilePath;
23 } 21 }
24 22
25 namespace content { 23 namespace content {
26 class NotificationSource; 24 class NotificationSource;
27 class NotificationDetails; 25 class NotificationDetails;
28 } 26 }
29 27
30 // Parts of the AppListService implementation shared between platforms. 28 // Parts of the AppListService implementation shared between platforms.
31 class AppListServiceImpl : public AppListService, 29 class AppListServiceImpl : public AppListService,
32 public ProfileInfoCacheObserver, 30 public ProfileInfoCacheObserver{
tapted 2013/08/05 03:01:39 space before {
calamity 2013/08/08 04:52:12 Done.
33 public content::NotificationObserver {
34 public: 31 public:
35 static void RecordAppListLaunch(); 32 static void RecordAppListLaunch();
36 static void RecordAppListAppLaunch(); 33 static void RecordAppListAppLaunch();
37 static void SendAppListStats(); 34 static void SendAppListStats();
38 35
36 // Shows the app list for the profile at the current |profile_path|. If the
37 // profile has not been loaded, this will load the profile and then show the
38 // app list.
39 virtual void Show() OVERRIDE;
tapted 2013/08/05 03:01:39 nit: there should be a comment saying these are ov
calamity 2013/08/08 04:52:12 AppListControllerDelegateWin calls Show and SetPro
40 virtual void SetProfilePath(const base::FilePath& profile_path) OVERRIDE;
41
39 protected: 42 protected:
40 AppListServiceImpl(); 43 AppListServiceImpl();
41 virtual ~AppListServiceImpl(); 44 virtual ~AppListServiceImpl();
42 45
43 Profile* profile() const { return profile_; } 46 Profile* profile() const { return profile_; }
44 void SetProfile(Profile* new_profile); 47 void SetProfile(Profile* new_profile);
45 void InvalidatePendingProfileLoads(); 48 void InvalidatePendingProfileLoads();
46 ProfileLoader& profile_loader() { return profile_loader_; } 49 ProfileLoader& profile_loader() { return profile_loader_; }
47 const ProfileLoader& profile_loader() const { return profile_loader_; } 50 const ProfileLoader& profile_loader() const { return profile_loader_; }
48 51
49 // Process command line flags shared between desktop implementations of the 52 // Process command line flags shared between desktop implementations of the
50 // app list. Currently this allows for enabling or disabling the app list. 53 // app list. Currently this allows for enabling or disabling the app list.
51 void HandleCommandLineFlags(Profile* initial_profile); 54 void HandleCommandLineFlags(Profile* initial_profile);
52 55
53 // Create a platform-specific shortcut for the app list. 56 // Create a platform-specific shortcut for the app list.
54 virtual void CreateShortcut(); 57 virtual void CreateShortcut();
55 58
56 // Called in response to observed successful and unsuccessful signin changes. 59 // Called in response to observed successful and unsuccessful signin changes.
57 virtual void OnSigninStatusChanged(); 60 virtual void OnSigninStatusChanged();
58 61
59 // AppListService overrides: 62 // AppListService overrides:
60 virtual void HandleFirstRun() OVERRIDE; 63 virtual void HandleFirstRun() OVERRIDE;
61 virtual void Init(Profile* initial_profile) OVERRIDE; 64 virtual void Init(Profile* initial_profile) OVERRIDE;
62 65
63 // Returns the app list path configured in BrowserProcess::local_state(). 66 // Returns the app list path configured in BrowserProcess::local_state().
64 virtual base::FilePath GetProfilePath( 67 virtual base::FilePath GetProfilePath(
65 const base::FilePath& user_data_dir) OVERRIDE; 68 const base::FilePath& user_data_dir) OVERRIDE;
66 virtual void SetProfilePath(const base::FilePath& profile_path) OVERRIDE;
67 virtual void Show() OVERRIDE;
68 virtual void EnableAppList(Profile* initial_profile) OVERRIDE; 69 virtual void EnableAppList(Profile* initial_profile) OVERRIDE;
69 virtual AppListControllerDelegate* CreateControllerDelegate() OVERRIDE; 70 virtual AppListControllerDelegate* CreateControllerDelegate() OVERRIDE;
70 71
71 private: 72 private:
72 // Loads a profile asynchronously and calls OnProfileLoaded() when done. 73 // Loads a profile asynchronously and calls OnProfileLoaded() when done.
73 void LoadProfileAsync(const base::FilePath& profile_file_path); 74 void LoadProfileAsync(const base::FilePath& profile_file_path);
74 75
75 // Callback for asynchronous profile load. 76 // Callback for asynchronous profile load.
76 void OnProfileLoaded(int profile_load_sequence_id, 77 void OnProfileLoaded(int profile_load_sequence_id,
77 Profile* profile, 78 Profile* profile,
78 Profile::CreateStatus status); 79 Profile::CreateStatus status);
79 80
80 virtual Profile* GetCurrentAppListProfile() OVERRIDE; 81 virtual Profile* GetCurrentAppListProfile() OVERRIDE;
81 82
82 // ProfileInfoCacheObserver overrides: 83 // ProfileInfoCacheObserver overrides:
83 virtual void OnProfileWillBeRemoved( 84 virtual void OnProfileWillBeRemoved(
84 const base::FilePath& profile_path) OVERRIDE; 85 const base::FilePath& profile_path) OVERRIDE;
85 86
86 // content::NotificationObserver
87 virtual void Observe(int type,
88 const content::NotificationSource& source,
89 const content::NotificationDetails& details) OVERRIDE;
90
91 // The profile the AppList is currently displaying. 87 // The profile the AppList is currently displaying.
92 Profile* profile_; 88 Profile* profile_;
93 89
94 // Incremented to indicate that pending profile loads are no longer valid. 90 // Incremented to indicate that pending profile loads are no longer valid.
95 int profile_load_sequence_id_; 91 int profile_load_sequence_id_;
96 92
97 // How many profile loads are pending. 93 // How many profile loads are pending.
98 int pending_profile_loads_; 94 int pending_profile_loads_;
99 95
100 base::WeakPtrFactory<AppListServiceImpl> weak_factory_; 96 base::WeakPtrFactory<AppListServiceImpl> weak_factory_;
101 content::NotificationRegistrar registrar_;
102 97
103 ProfileLoader profile_loader_; 98 ProfileLoader profile_loader_;
104 99
105 DISALLOW_COPY_AND_ASSIGN(AppListServiceImpl); 100 DISALLOW_COPY_AND_ASSIGN(AppListServiceImpl);
106 }; 101 };
107 102
108 #endif // CHROME_BROWSER_UI_APP_LIST_APP_LIST_SERVICE_IMPL_H_ 103 #endif // CHROME_BROWSER_UI_APP_LIST_APP_LIST_SERVICE_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698