| 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/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
| 12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
| 13 #include "base/memory/weak_ptr.h" | 13 #include "base/memory/weak_ptr.h" |
| 14 #include "chrome/browser/profiles/profile.h" | 14 #include "chrome/browser/profiles/profile.h" |
| 15 #include "chrome/browser/profiles/profile_info_cache_observer.h" | 15 #include "chrome/browser/profiles/profile_info_cache_observer.h" |
| 16 #include "chrome/browser/profiles/profile_loader.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 "content/public/browser/notification_observer.h" | |
| 19 #include "content/public/browser/notification_registrar.h" | |
| 20 | 18 |
| 21 namespace base { | 19 namespace base { |
| 22 class FilePath; | 20 class FilePath; |
| 23 } | 21 } |
| 24 | 22 |
| 25 namespace content { | |
| 26 class NotificationSource; | |
| 27 class NotificationDetails; | |
| 28 } | |
| 29 | |
| 30 // Parts of the AppListService implementation shared between platforms. | 23 // Parts of the AppListService implementation shared between platforms. |
| 31 class AppListServiceImpl : public AppListService, | 24 class AppListServiceImpl : public AppListService, |
| 32 public ProfileInfoCacheObserver, | 25 public ProfileInfoCacheObserver { |
| 33 public content::NotificationObserver { | |
| 34 public: | 26 public: |
| 35 static void RecordAppListLaunch(); | 27 static void RecordAppListLaunch(); |
| 36 static void RecordAppListAppLaunch(); | 28 static void RecordAppListAppLaunch(); |
| 37 static void SendAppListStats(); | 29 static void SendAppListStats(); |
| 38 | 30 |
| 39 protected: | 31 protected: |
| 40 AppListServiceImpl(); | 32 AppListServiceImpl(); |
| 41 virtual ~AppListServiceImpl(); | 33 virtual ~AppListServiceImpl(); |
| 42 | 34 |
| 43 Profile* profile() const { return profile_; } | 35 Profile* profile() const { return profile_; } |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 void OnProfileLoaded(int profile_load_sequence_id, | 68 void OnProfileLoaded(int profile_load_sequence_id, |
| 77 Profile* profile, | 69 Profile* profile, |
| 78 Profile::CreateStatus status); | 70 Profile::CreateStatus status); |
| 79 | 71 |
| 80 virtual Profile* GetCurrentAppListProfile() OVERRIDE; | 72 virtual Profile* GetCurrentAppListProfile() OVERRIDE; |
| 81 | 73 |
| 82 // ProfileInfoCacheObserver overrides: | 74 // ProfileInfoCacheObserver overrides: |
| 83 virtual void OnProfileWillBeRemoved( | 75 virtual void OnProfileWillBeRemoved( |
| 84 const base::FilePath& profile_path) OVERRIDE; | 76 const base::FilePath& profile_path) OVERRIDE; |
| 85 | 77 |
| 86 // content::NotificationObserver | |
| 87 virtual void Observe(int type, | |
| 88 const content::NotificationSource& source, | |
| 89 const content::NotificationDetails& details) OVERRIDE; | |
| 90 | |
| 91 // The profile the AppList is currently displaying. | 78 // The profile the AppList is currently displaying. |
| 92 Profile* profile_; | 79 Profile* profile_; |
| 93 | 80 |
| 94 // Incremented to indicate that pending profile loads are no longer valid. | 81 // Incremented to indicate that pending profile loads are no longer valid. |
| 95 int profile_load_sequence_id_; | 82 int profile_load_sequence_id_; |
| 96 | 83 |
| 97 // How many profile loads are pending. | 84 // How many profile loads are pending. |
| 98 int pending_profile_loads_; | 85 int pending_profile_loads_; |
| 99 | 86 |
| 100 base::WeakPtrFactory<AppListServiceImpl> weak_factory_; | 87 base::WeakPtrFactory<AppListServiceImpl> weak_factory_; |
| 101 content::NotificationRegistrar registrar_; | |
| 102 | 88 |
| 103 ProfileLoader profile_loader_; | 89 ProfileLoader profile_loader_; |
| 104 | 90 |
| 105 DISALLOW_COPY_AND_ASSIGN(AppListServiceImpl); | 91 DISALLOW_COPY_AND_ASSIGN(AppListServiceImpl); |
| 106 }; | 92 }; |
| 107 | 93 |
| 108 #endif // CHROME_BROWSER_UI_APP_LIST_APP_LIST_SERVICE_IMPL_H_ | 94 #endif // CHROME_BROWSER_UI_APP_LIST_APP_LIST_SERVICE_IMPL_H_ |
| OLD | NEW |