| 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" |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 class ProfileStore; | 21 class ProfileStore; |
| 22 | 22 |
| 23 namespace base { | 23 namespace base { |
| 24 class FilePath; | 24 class FilePath; |
| 25 } | 25 } |
| 26 | 26 |
| 27 // Parts of the AppListService implementation shared between platforms. | 27 // Parts of the AppListService implementation shared between platforms. |
| 28 class AppListServiceImpl : public AppListService, | 28 class AppListServiceImpl : public AppListService, |
| 29 public ProfileInfoCacheObserver { | 29 public ProfileInfoCacheObserver { |
| 30 public: | 30 public: |
| 31 static void RecordAppListLaunch(); |
| 32 static void RecordAppListAppLaunch(); |
| 31 virtual ~AppListServiceImpl(); | 33 virtual ~AppListServiceImpl(); |
| 32 | 34 |
| 33 // Constructor used for testing. | 35 // Constructor used for testing. |
| 34 AppListServiceImpl(const CommandLine& command_line, | 36 AppListServiceImpl(const CommandLine& command_line, |
| 35 PrefService* local_state, | 37 PrefService* local_state, |
| 36 scoped_ptr<ProfileStore> profile_store, | 38 scoped_ptr<ProfileStore> profile_store, |
| 37 scoped_ptr<KeepAliveService> keep_alive_service); | 39 scoped_ptr<KeepAliveService> keep_alive_service); |
| 38 | 40 |
| 39 void RecordAppListLaunch(); | |
| 40 static void RecordAppListAppLaunch(); | |
| 41 | |
| 42 // AppListService overrides: | 41 // AppListService overrides: |
| 43 virtual void SetAppListNextPaintCallback(void (*callback)()) OVERRIDE; | 42 virtual void SetAppListNextPaintCallback(void (*callback)()) OVERRIDE; |
| 44 virtual void HandleFirstRun() OVERRIDE; | 43 virtual void HandleFirstRun() OVERRIDE; |
| 45 virtual void Init(Profile* initial_profile) OVERRIDE; | 44 virtual void Init(Profile* initial_profile) OVERRIDE; |
| 46 virtual base::FilePath GetProfilePath( | 45 virtual base::FilePath GetProfilePath( |
| 47 const base::FilePath& user_data_dir) OVERRIDE; | 46 const base::FilePath& user_data_dir) OVERRIDE; |
| 48 virtual void SetProfilePath(const base::FilePath& profile_path) OVERRIDE; | 47 virtual void SetProfilePath(const base::FilePath& profile_path) OVERRIDE; |
| 49 virtual void Show() OVERRIDE; | 48 virtual void Show() OVERRIDE; |
| 50 virtual void AutoShowForProfile(Profile* requested_profile) OVERRIDE; | 49 virtual void EnableAppList(Profile* initial_profile) OVERRIDE; |
| 51 virtual void EnableAppList(Profile* initial_profile, | |
| 52 AppListEnableSource enable_source) OVERRIDE; | |
| 53 | 50 |
| 54 protected: | 51 protected: |
| 55 AppListServiceImpl(); | 52 AppListServiceImpl(); |
| 56 | 53 |
| 57 void InvalidatePendingProfileLoads(); | 54 void InvalidatePendingProfileLoads(); |
| 58 ProfileLoader& profile_loader() { return *profile_loader_; } | 55 ProfileLoader& profile_loader() { return *profile_loader_; } |
| 59 const ProfileLoader& profile_loader() const { return *profile_loader_; } | 56 const ProfileLoader& profile_loader() const { return *profile_loader_; } |
| 60 | 57 |
| 61 // Perform startup checks shared between desktop implementations of the app | 58 // Process command line flags shared between desktop implementations of the |
| 62 // list. Currently this checks command line flags to enable or disable the app | 59 // app list. Currently this allows for enabling or disabling the app list. |
| 63 // list, and records UMA stats delayed from a previous Chrome process. | 60 void HandleCommandLineFlags(Profile* initial_profile); |
| 64 void PerformStartupChecks(Profile* initial_profile); | 61 |
| 62 // Records UMA stats that try to approximate usage after a delay. |
| 63 void SendUsageStats(); |
| 65 | 64 |
| 66 // Create a platform-specific shortcut for the app list. | 65 // Create a platform-specific shortcut for the app list. |
| 67 virtual void CreateShortcut(); | 66 virtual void CreateShortcut(); |
| 68 | 67 |
| 69 private: | 68 private: |
| 70 static void SendAppListStats(); | 69 static void SendAppListStats(); |
| 71 | 70 |
| 72 // Loads a profile asynchronously and calls OnProfileLoaded() when done. | 71 // Loads a profile asynchronously and calls OnProfileLoaded() when done. |
| 73 void LoadProfileAsync(const base::FilePath& profile_file_path); | 72 void LoadProfileAsync(const base::FilePath& profile_file_path); |
| 74 | 73 |
| 75 // Callback for asynchronous profile load. | 74 // Callback for asynchronous profile load. |
| 76 void OnProfileLoaded(int profile_load_sequence_id, | 75 void OnProfileLoaded(int profile_load_sequence_id, |
| 77 Profile* profile, | 76 Profile* profile, |
| 78 Profile::CreateStatus status); | 77 Profile::CreateStatus status); |
| 79 | 78 |
| 80 // ProfileInfoCacheObserver overrides: | 79 // ProfileInfoCacheObserver overrides: |
| 81 virtual void OnProfileWillBeRemoved( | 80 virtual void OnProfileWillBeRemoved( |
| 82 const base::FilePath& profile_path) OVERRIDE; | 81 const base::FilePath& profile_path) OVERRIDE; |
| 83 | 82 |
| 84 scoped_ptr<ProfileStore> profile_store_; | 83 scoped_ptr<ProfileStore> profile_store_; |
| 85 base::WeakPtrFactory<AppListServiceImpl> weak_factory_; | 84 base::WeakPtrFactory<AppListServiceImpl> weak_factory_; |
| 86 CommandLine command_line_; | 85 CommandLine command_line_; |
| 87 PrefService* local_state_; | 86 PrefService* local_state_; |
| 88 scoped_ptr<ProfileLoader> profile_loader_; | 87 scoped_ptr<ProfileLoader> profile_loader_; |
| 89 | 88 |
| 90 DISALLOW_COPY_AND_ASSIGN(AppListServiceImpl); | 89 DISALLOW_COPY_AND_ASSIGN(AppListServiceImpl); |
| 91 }; | 90 }; |
| 92 | 91 |
| 93 #endif // CHROME_BROWSER_UI_APP_LIST_APP_LIST_SERVICE_IMPL_H_ | 92 #endif // CHROME_BROWSER_UI_APP_LIST_APP_LIST_SERVICE_IMPL_H_ |
| OLD | NEW |