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

Side by Side Diff: chrome/browser/policy/app_pack_updater.h

Issue 10692168: Moved ExternalExtensionLoaders/Providers into extensions namespace (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Even later master Created 8 years, 5 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_POLICY_APP_PACK_UPDATER_H_ 5 #ifndef CHROME_BROWSER_POLICY_APP_PACK_UPDATER_H_
6 #define CHROME_BROWSER_POLICY_APP_PACK_UPDATER_H_ 6 #define CHROME_BROWSER_POLICY_APP_PACK_UPDATER_H_
7 7
8 #include <map> 8 #include <map>
9 #include <set> 9 #include <set>
10 #include <string> 10 #include <string>
11 11
12 #include "base/basictypes.h" 12 #include "base/basictypes.h"
13 #include "base/callback.h" 13 #include "base/callback.h"
14 #include "base/compiler_specific.h" 14 #include "base/compiler_specific.h"
15 #include "base/file_path.h" 15 #include "base/file_path.h"
16 #include "base/memory/weak_ptr.h" 16 #include "base/memory/weak_ptr.h"
17 #include "base/threading/sequenced_worker_pool.h" 17 #include "base/threading/sequenced_worker_pool.h"
18 #include "chrome/browser/extensions/updater/extension_downloader_delegate.h" 18 #include "chrome/browser/extensions/updater/extension_downloader_delegate.h"
19 #include "chrome/browser/policy/cloud_policy_subsystem.h" 19 #include "chrome/browser/policy/cloud_policy_subsystem.h"
20 #include "content/public/browser/notification_observer.h" 20 #include "content/public/browser/notification_observer.h"
21 #include "content/public/browser/notification_registrar.h" 21 #include "content/public/browser/notification_registrar.h"
22 #include "net/base/network_change_notifier.h" 22 #include "net/base/network_change_notifier.h"
23 23
24 class CrxInstaller; 24 class CrxInstaller;
25 class ExternalExtensionLoader;
26 class FilePath;
27 class GURL; 25 class GURL;
28 26
29 namespace extensions { 27 namespace extensions {
30 class ExtensionDownloader; 28 class ExtensionDownloader;
29 class ExternalLoader;
31 } 30 }
32 31
33 namespace net { 32 namespace net {
34 class URLRequestContextGetter; 33 class URLRequestContextGetter;
35 } 34 }
36 35
37 namespace tracked_objects { 36 namespace tracked_objects {
38 class Location; 37 class Location;
39 } 38 }
40 39
41 namespace policy { 40 namespace policy {
42 41
43 class AppPackExternalExtensionLoader; 42 class AppPackExternalLoader;
44 class BrowserPolicyConnector; 43 class BrowserPolicyConnector;
45 44
46 // The AppPackUpdater manages a set of extensions that are configured via a 45 // The AppPackUpdater manages a set of extensions that are configured via a
47 // device policy to be locally cached and installed into the Demo user account 46 // device policy to be locally cached and installed into the Demo user account
48 // at login time. 47 // at login time.
49 class AppPackUpdater : public CloudPolicySubsystem::Observer, 48 class AppPackUpdater : public CloudPolicySubsystem::Observer,
50 public content::NotificationObserver, 49 public content::NotificationObserver,
51 public net::NetworkChangeNotifier::IPAddressObserver, 50 public net::NetworkChangeNotifier::IPAddressObserver,
52 public extensions::ExtensionDownloaderDelegate { 51 public extensions::ExtensionDownloaderDelegate {
53 public: 52 public:
54 // Callback to listen for updates to the screensaver extension's path. 53 // Callback to listen for updates to the screensaver extension's path.
55 typedef base::Callback<void(const FilePath&)> ScreenSaverUpdateCallback; 54 typedef base::Callback<void(const FilePath&)> ScreenSaverUpdateCallback;
56 55
57 // Keys for the entries in the AppPack dictionary policy. 56 // Keys for the entries in the AppPack dictionary policy.
58 static const char kExtensionId[]; 57 static const char kExtensionId[];
59 static const char kUpdateUrl[]; 58 static const char kUpdateUrl[];
60 59
61 // The |request_context| is used for the update checks. 60 // The |request_context| is used for the update checks.
62 AppPackUpdater(net::URLRequestContextGetter* request_context, 61 AppPackUpdater(net::URLRequestContextGetter* request_context,
63 BrowserPolicyConnector* connector); 62 BrowserPolicyConnector* connector);
64 virtual ~AppPackUpdater(); 63 virtual ~AppPackUpdater();
65 64
66 // Creates an ExternalExtensionLoader that will load the crx files downloaded 65 // Creates an extensions::ExternalLoader that will load the crx files
67 // by the AppPackUpdater. This can be called at most once, and the caller 66 // downloaded by the AppPackUpdater. This can be called at most once, and the
68 // owns the returned value. 67 // caller owns the returned value.
69 ExternalExtensionLoader* CreateExternalExtensionLoader(); 68 extensions::ExternalLoader* CreateExternalLoader();
70 69
71 // |callback| will be invoked whenever the screen saver extension's path 70 // |callback| will be invoked whenever the screen saver extension's path
72 // changes. It will be invoked "soon" after this call if a valid path already 71 // changes. It will be invoked "soon" after this call if a valid path already
73 // exists. Subsequent calls will override the previous |callback|. A null 72 // exists. Subsequent calls will override the previous |callback|. A null
74 // |callback| can be used to remove a previous callback. 73 // |callback| can be used to remove a previous callback.
75 void SetScreenSaverUpdateCallback(const ScreenSaverUpdateCallback& callback); 74 void SetScreenSaverUpdateCallback(const ScreenSaverUpdateCallback& callback);
76 75
77 private: 76 private:
78 struct AppPackEntry { 77 struct AppPackEntry {
79 std::string update_url; 78 std::string update_url;
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
215 std::string screen_saver_id_; 214 std::string screen_saver_id_;
216 FilePath screen_saver_path_; 215 FilePath screen_saver_path_;
217 216
218 // Callback to invoke whenever the screen saver's extension path changes. 217 // Callback to invoke whenever the screen saver's extension path changes.
219 // Can be null. 218 // Can be null.
220 ScreenSaverUpdateCallback screen_saver_update_callback_; 219 ScreenSaverUpdateCallback screen_saver_update_callback_;
221 220
222 // The extension loader wires the AppPackUpdater to the extensions system, and 221 // The extension loader wires the AppPackUpdater to the extensions system, and
223 // makes it install the currently cached extensions. 222 // makes it install the currently cached extensions.
224 bool created_extension_loader_; 223 bool created_extension_loader_;
225 base::WeakPtr<AppPackExternalExtensionLoader> extension_loader_; 224 base::WeakPtr<AppPackExternalLoader> extension_loader_;
226 225
227 // Used to download the extensions configured via policy, and to check for 226 // Used to download the extensions configured via policy, and to check for
228 // updates. 227 // updates.
229 scoped_ptr<extensions::ExtensionDownloader> downloader_; 228 scoped_ptr<extensions::ExtensionDownloader> downloader_;
230 229
231 // Request context used by the |downloader_|. 230 // Request context used by the |downloader_|.
232 net::URLRequestContextGetter* request_context_; 231 net::URLRequestContextGetter* request_context_;
233 232
234 DISALLOW_COPY_AND_ASSIGN(AppPackUpdater); 233 DISALLOW_COPY_AND_ASSIGN(AppPackUpdater);
235 }; 234 };
236 235
237 } // namespace policy 236 } // namespace policy
238 237
239 #endif // CHROME_BROWSER_POLICY_APP_PACK_UPDATER_H_ 238 #endif // CHROME_BROWSER_POLICY_APP_PACK_UPDATER_H_
OLDNEW
« no previous file with comments | « chrome/browser/extensions/external_registry_loader_win.cc ('k') | chrome/browser/policy/app_pack_updater.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698