OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_ARC_ARC_APP_LIST_PREFS_H_ | 5 #ifndef CHROME_BROWSER_UI_APP_LIST_ARC_ARC_APP_LIST_PREFS_H_ |
6 #define CHROME_BROWSER_UI_APP_LIST_ARC_ARC_APP_LIST_PREFS_H_ | 6 #define CHROME_BROWSER_UI_APP_LIST_ARC_ARC_APP_LIST_PREFS_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <map> | 10 #include <map> |
(...skipping 26 matching lines...) Expand all Loading... |
37 | 37 |
38 namespace user_prefs { | 38 namespace user_prefs { |
39 class PrefRegistrySyncable; | 39 class PrefRegistrySyncable; |
40 } // namespace user_prefs | 40 } // namespace user_prefs |
41 | 41 |
42 // Declares shareable ARC app specific preferences, that keep information | 42 // Declares shareable ARC app specific preferences, that keep information |
43 // about app attributes (name, package_name, activity) and its state. This | 43 // about app attributes (name, package_name, activity) and its state. This |
44 // information is used to pre-create non-ready app items while ARC bridge | 44 // information is used to pre-create non-ready app items while ARC bridge |
45 // service is not ready to provide information about available ARC apps. | 45 // service is not ready to provide information about available ARC apps. |
46 // NOTE: ArcAppListPrefs is only created for the primary user. | 46 // NOTE: ArcAppListPrefs is only created for the primary user. |
47 class ArcAppListPrefs : public KeyedService, | 47 class ArcAppListPrefs |
48 public arc::mojom::AppHost, | 48 : public KeyedService, |
49 public arc::ArcBridgeService::Observer, | 49 public arc::mojom::AppHost, |
50 public arc::ArcAuthService::Observer { | 50 public arc::ArcBridgeService::Observer, |
| 51 public arc::ArcBridgeService::InstanceObserver<arc::mojom::AppInstance>, |
| 52 public arc::ArcAuthService::Observer { |
51 public: | 53 public: |
52 struct AppInfo { | 54 struct AppInfo { |
53 AppInfo(const std::string& name, | 55 AppInfo(const std::string& name, |
54 const std::string& package_name, | 56 const std::string& package_name, |
55 const std::string& activity, | 57 const std::string& activity, |
56 const std::string& intent_uri, | 58 const std::string& intent_uri, |
57 const std::string& icon_resource_id, | 59 const std::string& icon_resource_id, |
58 const base::Time& last_launch_time, | 60 const base::Time& last_launch_time, |
59 bool sticky, | 61 bool sticky, |
60 bool notifications_enabled, | 62 bool notifications_enabled, |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
199 // Removes app with the given app_id. | 201 // Removes app with the given app_id. |
200 void RemoveApp(const std::string& app_id); | 202 void RemoveApp(const std::string& app_id); |
201 | 203 |
202 private: | 204 private: |
203 friend class ChromeLauncherControllerImplTest; | 205 friend class ChromeLauncherControllerImplTest; |
204 | 206 |
205 // See the Create methods. | 207 // See the Create methods. |
206 ArcAppListPrefs(const base::FilePath& base_path, PrefService* prefs); | 208 ArcAppListPrefs(const base::FilePath& base_path, PrefService* prefs); |
207 | 209 |
208 // arc::ArcBridgeService::Observer: | 210 // arc::ArcBridgeService::Observer: |
209 void OnStateChanged(arc::ArcBridgeService::State state) override; | 211 void OnBridgeStopped() override; |
210 void OnAppInstanceReady() override; | 212 |
211 void OnAppInstanceClosed() override; | 213 // arc::ArcBridgeService::InstanceObserver<arc::mojom::AppInstance>: |
| 214 void OnInstanceReady(arc::mojom::AppInstance* app_instance, |
| 215 uint32_t version) override; |
| 216 void OnInstanceClosed(arc::mojom::AppInstance*) override; |
212 | 217 |
213 // arc::mojom::AppHost: | 218 // arc::mojom::AppHost: |
214 void OnAppListRefreshed(mojo::Array<arc::mojom::AppInfoPtr> apps) override; | 219 void OnAppListRefreshed(mojo::Array<arc::mojom::AppInfoPtr> apps) override; |
215 void OnAppAdded(arc::mojom::AppInfoPtr app) override; | 220 void OnAppAdded(arc::mojom::AppInfoPtr app) override; |
216 void OnInstallShortcut(arc::mojom::ShortcutInfoPtr app) override; | 221 void OnInstallShortcut(arc::mojom::ShortcutInfoPtr app) override; |
217 void OnPackageRemoved(const mojo::String& package_name) override; | 222 void OnPackageRemoved(const mojo::String& package_name) override; |
218 void OnAppIcon(const mojo::String& package_name, | 223 void OnAppIcon(const mojo::String& package_name, |
219 const mojo::String& activity, | 224 const mojo::String& activity, |
220 arc::mojom::ScaleFactor scale_factor, | 225 arc::mojom::ScaleFactor scale_factor, |
221 mojo::Array<uint8_t> icon_png_data) override; | 226 mojo::Array<uint8_t> icon_png_data) override; |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
283 bool apps_restored_ = false; | 288 bool apps_restored_ = false; |
284 | 289 |
285 mojo::Binding<arc::mojom::AppHost> binding_; | 290 mojo::Binding<arc::mojom::AppHost> binding_; |
286 | 291 |
287 base::WeakPtrFactory<ArcAppListPrefs> weak_ptr_factory_; | 292 base::WeakPtrFactory<ArcAppListPrefs> weak_ptr_factory_; |
288 | 293 |
289 DISALLOW_COPY_AND_ASSIGN(ArcAppListPrefs); | 294 DISALLOW_COPY_AND_ASSIGN(ArcAppListPrefs); |
290 }; | 295 }; |
291 | 296 |
292 #endif // CHROME_BROWSER_UI_APP_LIST_ARC_ARC_APP_LIST_PREFS_H_ | 297 #endif // CHROME_BROWSER_UI_APP_LIST_ARC_ARC_APP_LIST_PREFS_H_ |
OLD | NEW |