| 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 28 matching lines...) Expand all Loading... |
| 39 protected: | 39 protected: |
| 40 AppListServiceImpl(); | 40 AppListServiceImpl(); |
| 41 virtual ~AppListServiceImpl(); | 41 virtual ~AppListServiceImpl(); |
| 42 | 42 |
| 43 Profile* profile() const { return profile_; } | 43 Profile* profile() const { return profile_; } |
| 44 void SetProfile(Profile* new_profile); | 44 void SetProfile(Profile* new_profile); |
| 45 void InvalidatePendingProfileLoads(); | 45 void InvalidatePendingProfileLoads(); |
| 46 ProfileLoader& profile_loader() { return profile_loader_; } | 46 ProfileLoader& profile_loader() { return profile_loader_; } |
| 47 const ProfileLoader& profile_loader() const { return profile_loader_; } | 47 const ProfileLoader& profile_loader() const { return profile_loader_; } |
| 48 | 48 |
| 49 // Save |profile_file_path| as the app list profile in local state. | 49 // Perform shared initialization tasks for desktop app list implementations. |
| 50 void SaveProfilePathToLocalState(const base::FilePath& profile_file_path); | 50 void SharedDesktopInit(Profile* initial_profile); |
| 51 |
| 52 // Create a platform-specific shortcut for the app list. |
| 53 virtual void CreateShortcut(); |
| 51 | 54 |
| 52 // Called in response to observed successful and unsuccessful signin changes. | 55 // Called in response to observed successful and unsuccessful signin changes. |
| 53 virtual void OnSigninStatusChanged(); | 56 virtual void OnSigninStatusChanged(); |
| 54 | 57 |
| 55 // AppListService overrides: | 58 // AppListService overrides: |
| 56 virtual void Init(Profile* initial_profile) OVERRIDE; | 59 virtual void Init(Profile* initial_profile) OVERRIDE; |
| 60 |
| 57 virtual base::FilePath GetProfilePath( | 61 virtual base::FilePath GetProfilePath( |
| 58 const base::FilePath& user_data_dir) OVERRIDE; | 62 const base::FilePath& user_data_dir) OVERRIDE; |
| 63 virtual void SetProfilePath(const base::FilePath& profile_path) OVERRIDE; |
| 59 | 64 |
| 60 virtual void ShowForSavedProfile() OVERRIDE; | 65 virtual void ShowForSavedProfile() OVERRIDE; |
| 66 virtual void EnableAppList(Profile* initial_profile) OVERRIDE; |
| 61 virtual AppListControllerDelegate* CreateControllerDelegate() OVERRIDE; | 67 virtual AppListControllerDelegate* CreateControllerDelegate() OVERRIDE; |
| 62 | 68 |
| 63 private: | 69 private: |
| 64 // Loads a profile asynchronously and calls OnProfileLoaded() when done. | 70 // Loads a profile asynchronously and calls OnProfileLoaded() when done. |
| 65 void LoadProfileAsync(const base::FilePath& profile_file_path); | 71 void LoadProfileAsync(const base::FilePath& profile_file_path); |
| 66 | 72 |
| 67 // Callback for asynchronous profile load. | 73 // Callback for asynchronous profile load. |
| 68 void OnProfileLoaded(int profile_load_sequence_id, | 74 void OnProfileLoaded(int profile_load_sequence_id, |
| 69 Profile* profile, | 75 Profile* profile, |
| 70 Profile::CreateStatus status); | 76 Profile::CreateStatus status); |
| 71 | 77 |
| 72 // AppListService overrides: | |
| 73 // Update the profile path stored in local prefs, load it (if not already | |
| 74 // loaded), and show the app list. | |
| 75 virtual void SetAppListProfile( | |
| 76 const base::FilePath& profile_file_path) OVERRIDE; | |
| 77 | |
| 78 virtual Profile* GetCurrentAppListProfile() OVERRIDE; | 78 virtual Profile* GetCurrentAppListProfile() OVERRIDE; |
| 79 | 79 |
| 80 // ProfileInfoCacheObserver overrides: | 80 // ProfileInfoCacheObserver overrides: |
| 81 virtual void OnProfileWillBeRemoved( | 81 virtual void OnProfileWillBeRemoved( |
| 82 const base::FilePath& profile_path) OVERRIDE; | 82 const base::FilePath& profile_path) OVERRIDE; |
| 83 | 83 |
| 84 // content::NotificationObserver | 84 // content::NotificationObserver |
| 85 virtual void Observe(int type, | 85 virtual void Observe(int type, |
| 86 const content::NotificationSource& source, | 86 const content::NotificationSource& source, |
| 87 const content::NotificationDetails& details) OVERRIDE; | 87 const content::NotificationDetails& details) OVERRIDE; |
| 88 | 88 |
| 89 // The profile the AppList is currently displaying. | 89 // The profile the AppList is currently displaying. |
| 90 Profile* profile_; | 90 Profile* profile_; |
| 91 | 91 |
| 92 // Incremented to indicate that pending profile loads are no longer valid. | 92 // Incremented to indicate that pending profile loads are no longer valid. |
| 93 int profile_load_sequence_id_; | 93 int profile_load_sequence_id_; |
| 94 | 94 |
| 95 // How many profile loads are pending. | 95 // How many profile loads are pending. |
| 96 int pending_profile_loads_; | 96 int pending_profile_loads_; |
| 97 | 97 |
| 98 base::WeakPtrFactory<AppListServiceImpl> weak_factory_; | 98 base::WeakPtrFactory<AppListServiceImpl> weak_factory_; |
| 99 content::NotificationRegistrar registrar_; | 99 content::NotificationRegistrar registrar_; |
| 100 | 100 |
| 101 ProfileLoader profile_loader_; | 101 ProfileLoader profile_loader_; |
| 102 | 102 |
| 103 DISALLOW_COPY_AND_ASSIGN(AppListServiceImpl); | 103 DISALLOW_COPY_AND_ASSIGN(AppListServiceImpl); |
| 104 }; | 104 }; |
| 105 | 105 |
| 106 #endif // CHROME_BROWSER_UI_APP_LIST_APP_LIST_SERVICE_IMPL_H_ | 106 #endif // CHROME_BROWSER_UI_APP_LIST_APP_LIST_SERVICE_IMPL_H_ |
| OLD | NEW |