| 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/command_line.h" |
| 12 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
| 13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
| 14 #include "base/memory/weak_ptr.h" | 14 #include "base/memory/weak_ptr.h" |
| 15 #include "chrome/browser/profiles/profile.h" | 15 #include "chrome/browser/profiles/profile.h" |
| 16 #include "chrome/browser/profiles/profile_info_cache_observer.h" | 16 #include "chrome/browser/profiles/profile_info_cache_observer.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/profile_loader.h" | 18 #include "chrome/browser/ui/app_list/profile_loader.h" |
| 19 | 19 |
| 20 class ProfileStore; | 20 class ProfileStore; |
| 21 | 21 |
| 22 namespace base { | 22 namespace base { |
| 23 class FilePath; | 23 class FilePath; |
| 24 } | 24 } |
| 25 | 25 |
| 26 namespace test { |
| 27 class AppListServiceImplTestApi; |
| 28 } |
| 29 |
| 26 // Parts of the AppListService implementation shared between platforms. | 30 // Parts of the AppListService implementation shared between platforms. |
| 27 class AppListServiceImpl : public AppListService, | 31 class AppListServiceImpl : public AppListService, |
| 28 public ProfileInfoCacheObserver { | 32 public ProfileInfoCacheObserver { |
| 29 public: | 33 public: |
| 30 virtual ~AppListServiceImpl(); | 34 virtual ~AppListServiceImpl(); |
| 31 | 35 |
| 32 // Constructor used for testing. | 36 // Constructor used for testing. |
| 33 AppListServiceImpl(const base::CommandLine& command_line, | 37 AppListServiceImpl(const base::CommandLine& command_line, |
| 34 PrefService* local_state, | 38 PrefService* local_state, |
| 35 scoped_ptr<ProfileStore> profile_store); | 39 scoped_ptr<ProfileStore> profile_store); |
| (...skipping 24 matching lines...) Expand all Loading... |
| 60 void InvalidatePendingProfileLoads(); | 64 void InvalidatePendingProfileLoads(); |
| 61 ProfileLoader& profile_loader() { return *profile_loader_; } | 65 ProfileLoader& profile_loader() { return *profile_loader_; } |
| 62 const ProfileLoader& profile_loader() const { return *profile_loader_; } | 66 const ProfileLoader& profile_loader() const { return *profile_loader_; } |
| 63 | 67 |
| 64 // Perform startup checks shared between desktop implementations of the app | 68 // Perform startup checks shared between desktop implementations of the app |
| 65 // list. Currently this checks command line flags to enable or disable the app | 69 // list. Currently this checks command line flags to enable or disable the app |
| 66 // list, and records UMA stats delayed from a previous Chrome process. | 70 // list, and records UMA stats delayed from a previous Chrome process. |
| 67 void PerformStartupChecks(Profile* initial_profile); | 71 void PerformStartupChecks(Profile* initial_profile); |
| 68 | 72 |
| 69 private: | 73 private: |
| 74 friend class test::AppListServiceImplTestApi; |
| 70 static void SendAppListStats(); | 75 static void SendAppListStats(); |
| 71 | 76 |
| 72 // Loads a profile asynchronously and calls OnProfileLoaded() when done. | 77 // Loads a profile asynchronously and calls OnProfileLoaded() when done. |
| 73 void LoadProfileAsync(const base::FilePath& profile_file_path); | 78 void LoadProfileAsync(const base::FilePath& profile_file_path); |
| 74 | 79 |
| 75 // Callback for asynchronous profile load. | 80 // Callback for asynchronous profile load. |
| 76 void OnProfileLoaded(int profile_load_sequence_id, | 81 void OnProfileLoaded(int profile_load_sequence_id, |
| 77 Profile* profile, | 82 Profile* profile, |
| 78 Profile::CreateStatus status); | 83 Profile::CreateStatus status); |
| 79 | 84 |
| 80 // ProfileInfoCacheObserver overrides: | 85 // ProfileInfoCacheObserver overrides: |
| 81 virtual void OnProfileWillBeRemoved( | 86 virtual void OnProfileWillBeRemoved( |
| 82 const base::FilePath& profile_path) OVERRIDE; | 87 const base::FilePath& profile_path) OVERRIDE; |
| 83 | 88 |
| 84 scoped_ptr<ProfileStore> profile_store_; | 89 scoped_ptr<ProfileStore> profile_store_; |
| 85 base::WeakPtrFactory<AppListServiceImpl> weak_factory_; | 90 base::WeakPtrFactory<AppListServiceImpl> weak_factory_; |
| 86 base::CommandLine command_line_; | 91 base::CommandLine command_line_; |
| 87 PrefService* local_state_; | 92 PrefService* local_state_; |
| 88 scoped_ptr<ProfileLoader> profile_loader_; | 93 scoped_ptr<ProfileLoader> profile_loader_; |
| 89 | 94 |
| 90 DISALLOW_COPY_AND_ASSIGN(AppListServiceImpl); | 95 DISALLOW_COPY_AND_ASSIGN(AppListServiceImpl); |
| 91 }; | 96 }; |
| 92 | 97 |
| 93 #endif // CHROME_BROWSER_UI_APP_LIST_APP_LIST_SERVICE_IMPL_H_ | 98 #endif // CHROME_BROWSER_UI_APP_LIST_APP_LIST_SERVICE_IMPL_H_ |
| OLD | NEW |