Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(191)

Side by Side Diff: chrome/browser/apps/drive/drive_app_provider.h

Issue 308003005: app_list: Drive app integration. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: pref is_syancable -> do_not_sync, remove AppListModel deps and no auto uninstall new_app Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_APPS_DRIVE_DRIVE_APP_PROVIDER_H_
6 #define CHROME_BROWSER_APPS_DRIVE_DRIVE_APP_PROVIDER_H_
7
8 #include <set>
9 #include <string>
10 #include <vector>
11
12 #include "base/macros.h"
13 #include "base/memory/scoped_ptr.h"
14 #include "base/memory/scoped_vector.h"
15 #include "base/memory/weak_ptr.h"
16 #include "chrome/browser/drive/drive_app_registry_observer.h"
17 #include "chrome/browser/extensions/install_observer.h"
18
19 namespace drive {
20 struct DriveAppInfo;
21 }
22
23 class BrowserContextKeyedServiceFactory;
24 class DriveAppConverter;
25 class DriveAppMapping;
26 class DriveServiceBridge;
27 class ExtensionService;
28 class Profile;
29
30 // DriveAppProvider is the integration point for Drive apps. It ensures each
31 // Drive app has a corresponding Chrome app in the extension system. If there
32 // is no matching Chrome app, a local URL app would be created. The class
33 // processes app changes from both DriveAppRegistry and extension system to
34 // keep the two in sync.
35 class DriveAppProvider : public drive::DriveAppRegistryObserver,
36 public extensions::InstallObserver {
37 public:
38 explicit DriveAppProvider(Profile* profile);
39 virtual ~DriveAppProvider();
40
41 // Appends PKS factories this class depends on.
42 static void AppendDependsOnFactories(
43 std::set<BrowserContextKeyedServiceFactory*>* factories);
44
45 void SetDriveServiceBridgeForTest(scoped_ptr<DriveServiceBridge> test_bridge);
46
47 private:
48 friend class DriveAppProviderTest;
49
50 typedef std::set<std::string> IdSet;
51 typedef std::vector<drive::DriveAppInfo> DriveAppInfos;
52
53 // Maps |drive_app_id| to |new_app|'s id in mapping. Auto uninstall existing
54 // mapped app if it is an URL app.
55 void UpdateMappingAndExtensionSystem(const std::string& drive_app_id,
56 const extensions::Extension* new_app);
57
58 // Deferred processing of relevant extension installed message.
59 void ProcessDeferredOnExtensionInstalled(const std::string drive_app_id,
60 const std::string chrome_app_id);
61
62 void SchedulePendingConverters();
63 void OnLocalAppConverted(const DriveAppConverter* converter, bool success);
64
65 bool IsDriveAppUpToDate(const drive::DriveAppInfo& drive_app) const;
66
67 void AddOrUpdateDriveApp(const drive::DriveAppInfo& drive_app);
68 void RemoveDriveApp(const std::string& drive_app_id);
69
70 // drive::DriveAppRegistryObserver overrides:
71 virtual void OnDriveAppRegistryUpdated() OVERRIDE;
72
73 // extensions::InstallObserver overrides:
74 virtual void OnExtensionInstalled(
75 const extensions::Extension* extension) OVERRIDE;
76 virtual void OnExtensionUninstalled(
77 const extensions::Extension* extension) OVERRIDE;
78
79 Profile* profile_;
80
81 scoped_ptr<DriveServiceBridge> service_bridge_;
82 scoped_ptr<DriveAppMapping> mapping_;
83 DriveAppInfos drive_apps_;
84
85 // Tracks the pending web app convertions.
86 ScopedVector<DriveAppConverter> pending_converters_;
87
88 base::WeakPtrFactory<DriveAppProvider> weak_ptr_factory_;
89
90 DISALLOW_COPY_AND_ASSIGN(DriveAppProvider);
91 };
92
93 #endif // CHROME_BROWSER_APPS_DRIVE_DRIVE_APP_PROVIDER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698