OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_APPS_DRIVE_DRIVE_APP_PROVIDER_H_ | 5 #ifndef CHROME_BROWSER_APPS_DRIVE_DRIVE_APP_PROVIDER_H_ |
6 #define CHROME_BROWSER_APPS_DRIVE_DRIVE_APP_PROVIDER_H_ | 6 #define CHROME_BROWSER_APPS_DRIVE_DRIVE_APP_PROVIDER_H_ |
7 | 7 |
8 #include <set> | 8 #include <set> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 20 matching lines...) Expand all Loading... |
31 // DriveAppProvider is the integration point for Drive apps. It ensures each | 31 // DriveAppProvider is the integration point for Drive apps. It ensures each |
32 // Drive app has a corresponding Chrome app in the extension system. If there | 32 // Drive app has a corresponding Chrome app in the extension system. If there |
33 // is no matching Chrome app, a local URL app would be created. The class | 33 // is no matching Chrome app, a local URL app would be created. The class |
34 // processes app changes from both DriveAppRegistry and extension system to | 34 // processes app changes from both DriveAppRegistry and extension system to |
35 // keep the two in sync. | 35 // keep the two in sync. |
36 class DriveAppProvider : public drive::DriveAppRegistryObserver, | 36 class DriveAppProvider : public drive::DriveAppRegistryObserver, |
37 public extensions::ExtensionRegistryObserver { | 37 public extensions::ExtensionRegistryObserver { |
38 public: | 38 public: |
39 DriveAppProvider(Profile* profile, | 39 DriveAppProvider(Profile* profile, |
40 DriveAppUninstallSyncService* uninstall_sync_service); | 40 DriveAppUninstallSyncService* uninstall_sync_service); |
41 virtual ~DriveAppProvider(); | 41 ~DriveAppProvider() override; |
42 | 42 |
43 // Appends PKS factories this class depends on. | 43 // Appends PKS factories this class depends on. |
44 static void AppendDependsOnFactories( | 44 static void AppendDependsOnFactories( |
45 std::set<BrowserContextKeyedServiceFactory*>* factories); | 45 std::set<BrowserContextKeyedServiceFactory*>* factories); |
46 | 46 |
47 void SetDriveServiceBridgeForTest(scoped_ptr<DriveServiceBridge> test_bridge); | 47 void SetDriveServiceBridgeForTest(scoped_ptr<DriveServiceBridge> test_bridge); |
48 | 48 |
49 // Adds/removes uninstalled Drive app id from DriveAppUninstallSyncService. | 49 // Adds/removes uninstalled Drive app id from DriveAppUninstallSyncService. |
50 // If a Drive app id is added as uninstalled Drive app, DriveAppProvider | 50 // If a Drive app id is added as uninstalled Drive app, DriveAppProvider |
51 // would not auto create the local URL app for it until the uninstall record | 51 // would not auto create the local URL app for it until the uninstall record |
(...skipping 21 matching lines...) Expand all Loading... |
73 void OnLocalAppConverted(const DriveAppConverter* converter, bool success); | 73 void OnLocalAppConverted(const DriveAppConverter* converter, bool success); |
74 | 74 |
75 bool IsMappedUrlAppUpToDate(const drive::DriveAppInfo& drive_app) const; | 75 bool IsMappedUrlAppUpToDate(const drive::DriveAppInfo& drive_app) const; |
76 | 76 |
77 void AddOrUpdateDriveApp(const drive::DriveAppInfo& drive_app); | 77 void AddOrUpdateDriveApp(const drive::DriveAppInfo& drive_app); |
78 void ProcessRemovedDriveApp(const std::string& drive_app_id); | 78 void ProcessRemovedDriveApp(const std::string& drive_app_id); |
79 | 79 |
80 void UpdateDriveApps(); | 80 void UpdateDriveApps(); |
81 | 81 |
82 // drive::DriveAppRegistryObserver overrides: | 82 // drive::DriveAppRegistryObserver overrides: |
83 virtual void OnDriveAppRegistryUpdated() override; | 83 void OnDriveAppRegistryUpdated() override; |
84 | 84 |
85 // extensions::ExtensionRegistryObserver overrides: | 85 // extensions::ExtensionRegistryObserver overrides: |
86 virtual void OnExtensionInstalled( | 86 void OnExtensionInstalled(content::BrowserContext* browser_context, |
87 content::BrowserContext* browser_context, | 87 const extensions::Extension* extension, |
88 const extensions::Extension* extension, | 88 bool is_update) override; |
89 bool is_update) override; | 89 void OnExtensionUninstalled(content::BrowserContext* browser_context, |
90 virtual void OnExtensionUninstalled( | 90 const extensions::Extension* extension, |
91 content::BrowserContext* browser_context, | 91 extensions::UninstallReason reason) override; |
92 const extensions::Extension* extension, | |
93 extensions::UninstallReason reason) override; | |
94 | 92 |
95 Profile* profile_; | 93 Profile* profile_; |
96 DriveAppUninstallSyncService* uninstall_sync_service_; | 94 DriveAppUninstallSyncService* uninstall_sync_service_; |
97 | 95 |
98 scoped_ptr<DriveServiceBridge> service_bridge_; | 96 scoped_ptr<DriveServiceBridge> service_bridge_; |
99 scoped_ptr<DriveAppMapping> mapping_; | 97 scoped_ptr<DriveAppMapping> mapping_; |
100 DriveAppInfos drive_apps_; | 98 DriveAppInfos drive_apps_; |
101 | 99 |
102 // Tracks the pending web app convertions. | 100 // Tracks the pending web app convertions. |
103 ScopedVector<DriveAppConverter> pending_converters_; | 101 ScopedVector<DriveAppConverter> pending_converters_; |
104 | 102 |
105 base::WeakPtrFactory<DriveAppProvider> weak_ptr_factory_; | 103 base::WeakPtrFactory<DriveAppProvider> weak_ptr_factory_; |
106 | 104 |
107 DISALLOW_COPY_AND_ASSIGN(DriveAppProvider); | 105 DISALLOW_COPY_AND_ASSIGN(DriveAppProvider); |
108 }; | 106 }; |
109 | 107 |
110 #endif // CHROME_BROWSER_APPS_DRIVE_DRIVE_APP_PROVIDER_H_ | 108 #endif // CHROME_BROWSER_APPS_DRIVE_DRIVE_APP_PROVIDER_H_ |
OLD | NEW |