OLD | NEW |
---|---|
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/command_line.h" | |
11 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
12 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
13 #include "base/memory/weak_ptr.h" | 14 #include "base/memory/weak_ptr.h" |
14 #include "chrome/browser/profiles/profile.h" | 15 #include "chrome/browser/profiles/profile.h" |
15 #include "chrome/browser/profiles/profile_info_cache_observer.h" | 16 #include "chrome/browser/profiles/profile_info_cache_observer.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 "chrome/browser/ui/app_list/keep_alive_service.h" | |
19 #include "chrome/browser/ui/app_list/profile_loader.h" | |
20 | |
21 class ProfileStore; | |
18 | 22 |
19 namespace base { | 23 namespace base { |
20 class FilePath; | 24 class FilePath; |
21 } | 25 } |
22 | 26 |
23 // Parts of the AppListService implementation shared between platforms. | 27 // Parts of the AppListService implementation shared between platforms. |
24 class AppListServiceImpl : public AppListService, | 28 class AppListServiceImpl : public AppListService, |
25 public ProfileInfoCacheObserver { | 29 public ProfileInfoCacheObserver { |
26 public: | 30 public: |
27 static void RecordAppListLaunch(); | 31 static void RecordAppListLaunch(); |
28 static void RecordAppListAppLaunch(); | 32 static void RecordAppListAppLaunch(); |
33 virtual ~AppListServiceImpl(); | |
29 | 34 |
30 protected: | |
benwells
2013/09/27 09:00:40
Can we bring back protected? I like keeping visibi
koz (OOO until 15th September)
2013/09/30 00:53:27
Done. I've kept things that are public in the pare
| |
31 AppListServiceImpl(); | 35 AppListServiceImpl(); |
32 virtual ~AppListServiceImpl(); | 36 // Constructor used for testing. |
37 AppListServiceImpl(const CommandLine& command_line, | |
38 PrefService* local_state, | |
39 scoped_ptr<ProfileStore> profile_store, | |
40 scoped_ptr<KeepAliveService> keep_alive_service); | |
33 | 41 |
34 Profile* profile() const { return profile_; } | 42 Profile* profile() const { return profile_; } |
35 void SetProfile(Profile* new_profile); | 43 void SetProfile(Profile* new_profile); |
36 void InvalidatePendingProfileLoads(); | 44 void InvalidatePendingProfileLoads(); |
37 ProfileLoader& profile_loader() { return profile_loader_; } | 45 ProfileLoader& profile_loader() { return *profile_loader_; } |
38 const ProfileLoader& profile_loader() const { return profile_loader_; } | 46 const ProfileLoader& profile_loader() const { return *profile_loader_; } |
39 | 47 |
40 // Process command line flags shared between desktop implementations of the | 48 // Process command line flags shared between desktop implementations of the |
41 // app list. Currently this allows for enabling or disabling the app list. | 49 // app list. Currently this allows for enabling or disabling the app list. |
42 void HandleCommandLineFlags(Profile* initial_profile); | 50 void HandleCommandLineFlags(Profile* initial_profile); |
43 | 51 |
52 // Records UMA stats that try to approximate usage after a delay. | |
53 void SendUsageStats(); | |
54 | |
44 // Create a platform-specific shortcut for the app list. | 55 // Create a platform-specific shortcut for the app list. |
45 virtual void CreateShortcut(); | 56 virtual void CreateShortcut(); |
46 | 57 |
47 // AppListService overrides: | 58 // AppListService overrides: |
48 virtual void SetAppListNextPaintCallback( | 59 virtual void SetAppListNextPaintCallback( |
49 const base::Closure& callback) OVERRIDE; | 60 const base::Closure& callback) OVERRIDE; |
50 virtual void HandleFirstRun() OVERRIDE; | 61 virtual void HandleFirstRun() OVERRIDE; |
51 virtual void Init(Profile* initial_profile) OVERRIDE; | 62 virtual void Init(Profile* initial_profile) OVERRIDE; |
52 | 63 |
53 // Returns the app list path configured in BrowserProcess::local_state(). | 64 // Returns the app list path configured in BrowserProcess::local_state(). |
(...skipping 15 matching lines...) Expand all Loading... | |
69 Profile::CreateStatus status); | 80 Profile::CreateStatus status); |
70 | 81 |
71 virtual Profile* GetCurrentAppListProfile() OVERRIDE; | 82 virtual Profile* GetCurrentAppListProfile() OVERRIDE; |
72 | 83 |
73 // ProfileInfoCacheObserver overrides: | 84 // ProfileInfoCacheObserver overrides: |
74 virtual void OnProfileWillBeRemoved( | 85 virtual void OnProfileWillBeRemoved( |
75 const base::FilePath& profile_path) OVERRIDE; | 86 const base::FilePath& profile_path) OVERRIDE; |
76 | 87 |
77 // The profile the AppList is currently displaying. | 88 // The profile the AppList is currently displaying. |
78 Profile* profile_; | 89 Profile* profile_; |
79 | 90 scoped_ptr<ProfileStore> profile_store_; |
80 // Incremented to indicate that pending profile loads are no longer valid. | |
81 int profile_load_sequence_id_; | |
82 | |
83 // How many profile loads are pending. | |
84 int pending_profile_loads_; | |
85 | 91 |
86 base::WeakPtrFactory<AppListServiceImpl> weak_factory_; | 92 base::WeakPtrFactory<AppListServiceImpl> weak_factory_; |
87 | 93 |
88 ProfileLoader profile_loader_; | 94 CommandLine command_line_; |
95 PrefService* local_state_; | |
96 scoped_ptr<ProfileLoader> profile_loader_; | |
89 | 97 |
90 DISALLOW_COPY_AND_ASSIGN(AppListServiceImpl); | 98 DISALLOW_COPY_AND_ASSIGN(AppListServiceImpl); |
91 }; | 99 }; |
92 | 100 |
93 #endif // CHROME_BROWSER_UI_APP_LIST_APP_LIST_SERVICE_IMPL_H_ | 101 #endif // CHROME_BROWSER_UI_APP_LIST_APP_LIST_SERVICE_IMPL_H_ |
OLD | NEW |