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 <memory> |
8 #include <string> | 9 #include <string> |
9 | 10 |
10 #include "base/command_line.h" | 11 #include "base/command_line.h" |
11 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
12 #include "base/macros.h" | 13 #include "base/macros.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_attributes_storage.h" | 16 #include "chrome/browser/profiles/profile_attributes_storage.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 AppListViewDelegate; |
21 class ProfileStore; | 21 class ProfileStore; |
22 | 22 |
23 namespace base { | 23 namespace base { |
24 class FilePath; | 24 class FilePath; |
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 ProfileAttributesStorage::Observer { | 33 public ProfileAttributesStorage::Observer { |
34 public: | 34 public: |
35 ~AppListServiceImpl() override; | 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 std::unique_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 static void RecordAppListLastLaunch(); | 48 static void RecordAppListLastLaunch(); |
49 | 49 |
50 // AppListService overrides: | 50 // AppListService overrides: |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 | 85 |
86 private: | 86 private: |
87 friend class test::AppListServiceImplTestApi; | 87 friend class test::AppListServiceImplTestApi; |
88 static void SendAppListStats(); | 88 static void SendAppListStats(); |
89 | 89 |
90 std::string GetProfileName(); | 90 std::string GetProfileName(); |
91 | 91 |
92 // ProfileAttributesStorage::Observer overrides: | 92 // ProfileAttributesStorage::Observer overrides: |
93 void OnProfileWillBeRemoved(const base::FilePath& profile_path) override; | 93 void OnProfileWillBeRemoved(const base::FilePath& profile_path) override; |
94 | 94 |
95 scoped_ptr<ProfileStore> profile_store_; | 95 std::unique_ptr<ProfileStore> profile_store_; |
96 base::CommandLine command_line_; | 96 base::CommandLine command_line_; |
97 PrefService* local_state_; | 97 PrefService* local_state_; |
98 scoped_ptr<ProfileLoader> profile_loader_; | 98 std::unique_ptr<ProfileLoader> profile_loader_; |
99 scoped_ptr<AppListViewDelegate> view_delegate_; | 99 std::unique_ptr<AppListViewDelegate> view_delegate_; |
100 | 100 |
101 base::WeakPtrFactory<AppListServiceImpl> weak_factory_; | 101 base::WeakPtrFactory<AppListServiceImpl> weak_factory_; |
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 |