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 AppListViewDelegate; |
20 class ProfileStore; | 21 class ProfileStore; |
21 | 22 |
22 namespace base { | 23 namespace base { |
23 class FilePath; | 24 class FilePath; |
24 } | 25 } |
25 | 26 |
26 namespace test { | 27 namespace test { |
27 class AppListServiceImplTestApi; | 28 class AppListServiceImplTestApi; |
28 } | 29 } |
29 | 30 |
30 // Parts of the AppListService implementation shared between platforms. | 31 // Parts of the AppListService implementation shared between platforms. |
31 class AppListServiceImpl : public AppListService, | 32 class AppListServiceImpl : public AppListService, |
32 public ProfileInfoCacheObserver { | 33 public ProfileInfoCacheObserver { |
33 public: | 34 public: |
34 virtual ~AppListServiceImpl(); | 35 virtual ~AppListServiceImpl(); |
35 | 36 |
36 // Constructor used for testing. | 37 // Constructor used for testing. |
37 AppListServiceImpl(const base::CommandLine& command_line, | 38 AppListServiceImpl(const base::CommandLine& command_line, |
38 PrefService* local_state, | 39 PrefService* local_state, |
39 scoped_ptr<ProfileStore> profile_store); | 40 scoped_ptr<ProfileStore> profile_store); |
40 | 41 |
| 42 // Lazily create the Chrome AppListViewDelegate and ensure it is set to the |
| 43 // given |profile|. |
| 44 AppListViewDelegate* GetViewDelegate(Profile* profile); |
| 45 |
41 void RecordAppListLaunch(); | 46 void RecordAppListLaunch(); |
42 static void RecordAppListAppLaunch(); | 47 static void RecordAppListAppLaunch(); |
43 | 48 |
44 // AppListService overrides: | 49 // AppListService overrides: |
45 virtual void SetAppListNextPaintCallback(void (*callback)()) OVERRIDE; | 50 virtual void SetAppListNextPaintCallback(void (*callback)()) OVERRIDE; |
46 virtual void HandleFirstRun() OVERRIDE; | 51 virtual void HandleFirstRun() OVERRIDE; |
47 virtual void Init(Profile* initial_profile) OVERRIDE; | 52 virtual void Init(Profile* initial_profile) OVERRIDE; |
48 virtual base::FilePath GetProfilePath( | 53 virtual base::FilePath GetProfilePath( |
49 const base::FilePath& user_data_dir) OVERRIDE; | 54 const base::FilePath& user_data_dir) OVERRIDE; |
50 virtual void SetProfilePath(const base::FilePath& profile_path) OVERRIDE; | 55 virtual void SetProfilePath(const base::FilePath& profile_path) OVERRIDE; |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 Profile::CreateStatus status); | 88 Profile::CreateStatus status); |
84 | 89 |
85 // ProfileInfoCacheObserver overrides: | 90 // ProfileInfoCacheObserver overrides: |
86 virtual void OnProfileWillBeRemoved( | 91 virtual void OnProfileWillBeRemoved( |
87 const base::FilePath& profile_path) OVERRIDE; | 92 const base::FilePath& profile_path) OVERRIDE; |
88 | 93 |
89 scoped_ptr<ProfileStore> profile_store_; | 94 scoped_ptr<ProfileStore> profile_store_; |
90 base::CommandLine command_line_; | 95 base::CommandLine command_line_; |
91 PrefService* local_state_; | 96 PrefService* local_state_; |
92 scoped_ptr<ProfileLoader> profile_loader_; | 97 scoped_ptr<ProfileLoader> profile_loader_; |
| 98 scoped_ptr<AppListViewDelegate> view_delegate_; |
93 | 99 |
94 base::WeakPtrFactory<AppListServiceImpl> weak_factory_; | 100 base::WeakPtrFactory<AppListServiceImpl> weak_factory_; |
95 | 101 |
96 DISALLOW_COPY_AND_ASSIGN(AppListServiceImpl); | 102 DISALLOW_COPY_AND_ASSIGN(AppListServiceImpl); |
97 }; | 103 }; |
98 | 104 |
99 #endif // CHROME_BROWSER_UI_APP_LIST_APP_LIST_SERVICE_IMPL_H_ | 105 #endif // CHROME_BROWSER_UI_APP_LIST_APP_LIST_SERVICE_IMPL_H_ |
OLD | NEW |