| 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 14 matching lines...) Expand all Loading... |
| 25 } | 25 } |
| 26 | 26 |
| 27 namespace test { | 27 namespace test { |
| 28 class AppListServiceImplTestApi; | 28 class AppListServiceImplTestApi; |
| 29 } | 29 } |
| 30 | 30 |
| 31 // Parts of the AppListService implementation shared between platforms. | 31 // Parts of the AppListService implementation shared between platforms. |
| 32 class AppListServiceImpl : public AppListService, | 32 class AppListServiceImpl : public AppListService, |
| 33 public ProfileInfoCacheObserver { | 33 public ProfileInfoCacheObserver { |
| 34 public: | 34 public: |
| 35 virtual ~AppListServiceImpl(); | 35 ~AppListServiceImpl() override; |
| 36 | 36 |
| 37 // Constructor used for testing. | 37 // Constructor used for testing. |
| 38 AppListServiceImpl(const base::CommandLine& command_line, | 38 AppListServiceImpl(const base::CommandLine& command_line, |
| 39 PrefService* local_state, | 39 PrefService* local_state, |
| 40 scoped_ptr<ProfileStore> profile_store); | 40 scoped_ptr<ProfileStore> profile_store); |
| 41 | 41 |
| 42 // Lazily create the Chrome AppListViewDelegate and ensure it is set to the | 42 // Lazily create the Chrome AppListViewDelegate and ensure it is set to the |
| 43 // given |profile|. | 43 // given |profile|. |
| 44 AppListViewDelegate* GetViewDelegate(Profile* profile); | 44 AppListViewDelegate* GetViewDelegate(Profile* profile); |
| 45 | 45 |
| 46 void RecordAppListLaunch(); | 46 void RecordAppListLaunch(); |
| 47 static void RecordAppListAppLaunch(); | 47 static void RecordAppListAppLaunch(); |
| 48 | 48 |
| 49 // AppListService overrides: | 49 // AppListService overrides: |
| 50 virtual void SetAppListNextPaintCallback(void (*callback)()) override; | 50 void SetAppListNextPaintCallback(void (*callback)()) override; |
| 51 virtual void HandleFirstRun() override; | 51 void HandleFirstRun() override; |
| 52 virtual void Init(Profile* initial_profile) override; | 52 void Init(Profile* initial_profile) override; |
| 53 virtual base::FilePath GetProfilePath( | 53 base::FilePath GetProfilePath(const base::FilePath& user_data_dir) override; |
| 54 const base::FilePath& user_data_dir) override; | 54 void SetProfilePath(const base::FilePath& profile_path) override; |
| 55 virtual void SetProfilePath(const base::FilePath& profile_path) override; | 55 void Show() override; |
| 56 virtual void Show() override; | 56 void ShowForVoiceSearch(Profile* profile) override; |
| 57 virtual void ShowForVoiceSearch(Profile* profile) override; | 57 void ShowForAppInstall(Profile* profile, |
| 58 virtual void ShowForAppInstall(Profile* profile, | 58 const std::string& extension_id, |
| 59 const std::string& extension_id, | 59 bool start_discovery_tracking) override; |
| 60 bool start_discovery_tracking) override; | 60 void EnableAppList(Profile* initial_profile, |
| 61 virtual void EnableAppList(Profile* initial_profile, | 61 AppListEnableSource enable_source) override; |
| 62 AppListEnableSource enable_source) override; | 62 void CreateShortcut() override; |
| 63 virtual void CreateShortcut() override; | |
| 64 | 63 |
| 65 protected: | 64 protected: |
| 66 AppListServiceImpl(); | 65 AppListServiceImpl(); |
| 67 | 66 |
| 68 // Create the app list UI, and maintain its state, but do not show it. | 67 // Create the app list UI, and maintain its state, but do not show it. |
| 69 virtual void CreateForProfile(Profile* requested_profile) = 0; | 68 virtual void CreateForProfile(Profile* requested_profile) = 0; |
| 70 | 69 |
| 71 // Destroy the app list. Called when the profile that the app list is showing | 70 // Destroy the app list. Called when the profile that the app list is showing |
| 72 // is being deleted. | 71 // is being deleted. |
| 73 virtual void DestroyAppList() = 0; | 72 virtual void DestroyAppList() = 0; |
| (...skipping 13 matching lines...) Expand all Loading... |
| 87 | 86 |
| 88 // Loads a profile asynchronously and calls OnProfileLoaded() when done. | 87 // Loads a profile asynchronously and calls OnProfileLoaded() when done. |
| 89 void LoadProfileAsync(const base::FilePath& profile_file_path); | 88 void LoadProfileAsync(const base::FilePath& profile_file_path); |
| 90 | 89 |
| 91 // Callback for asynchronous profile load. | 90 // Callback for asynchronous profile load. |
| 92 void OnProfileLoaded(int profile_load_sequence_id, | 91 void OnProfileLoaded(int profile_load_sequence_id, |
| 93 Profile* profile, | 92 Profile* profile, |
| 94 Profile::CreateStatus status); | 93 Profile::CreateStatus status); |
| 95 | 94 |
| 96 // ProfileInfoCacheObserver overrides: | 95 // ProfileInfoCacheObserver overrides: |
| 97 virtual void OnProfileWillBeRemoved( | 96 void OnProfileWillBeRemoved(const base::FilePath& profile_path) override; |
| 98 const base::FilePath& profile_path) override; | |
| 99 | 97 |
| 100 scoped_ptr<ProfileStore> profile_store_; | 98 scoped_ptr<ProfileStore> profile_store_; |
| 101 base::CommandLine command_line_; | 99 base::CommandLine command_line_; |
| 102 PrefService* local_state_; | 100 PrefService* local_state_; |
| 103 scoped_ptr<ProfileLoader> profile_loader_; | 101 scoped_ptr<ProfileLoader> profile_loader_; |
| 104 scoped_ptr<AppListViewDelegate> view_delegate_; | 102 scoped_ptr<AppListViewDelegate> view_delegate_; |
| 105 | 103 |
| 106 base::WeakPtrFactory<AppListServiceImpl> weak_factory_; | 104 base::WeakPtrFactory<AppListServiceImpl> weak_factory_; |
| 107 | 105 |
| 108 DISALLOW_COPY_AND_ASSIGN(AppListServiceImpl); | 106 DISALLOW_COPY_AND_ASSIGN(AppListServiceImpl); |
| 109 }; | 107 }; |
| 110 | 108 |
| 111 #endif // CHROME_BROWSER_UI_APP_LIST_APP_LIST_SERVICE_IMPL_H_ | 109 #endif // CHROME_BROWSER_UI_APP_LIST_APP_LIST_SERVICE_IMPL_H_ |
| OLD | NEW |