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

Side by Side Diff: chrome/browser/extensions/extensions_service.h

Issue 345023: Get rid of MessageLoop* caching in extensions code. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 1 month 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
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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_EXTENSIONS_EXTENSIONS_SERVICE_H_ 5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSIONS_SERVICE_H_
6 #define CHROME_BROWSER_EXTENSIONS_EXTENSIONS_SERVICE_H_ 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSIONS_SERVICE_H_
7 7
8 #include <map> 8 #include <map>
9 #include <set> 9 #include <set>
10 #include <string> 10 #include <string>
(...skipping 11 matching lines...) Expand all
22 #include "chrome/browser/extensions/external_extension_provider.h" 22 #include "chrome/browser/extensions/external_extension_provider.h"
23 #include "chrome/browser/extensions/sandboxed_extension_unpacker.h" 23 #include "chrome/browser/extensions/sandboxed_extension_unpacker.h"
24 #include "chrome/common/extensions/extension.h" 24 #include "chrome/common/extensions/extension.h"
25 25
26 class Browser; 26 class Browser;
27 class DictionaryValue; 27 class DictionaryValue;
28 class Extension; 28 class Extension;
29 class ExtensionsServiceBackend; 29 class ExtensionsServiceBackend;
30 class ExtensionUpdater; 30 class ExtensionUpdater;
31 class GURL; 31 class GURL;
32 class MessageLoop;
33 class PrefService; 32 class PrefService;
34 class Profile; 33 class Profile;
35 class ResourceDispatcherHost; 34 class ResourceDispatcherHost;
36 class SiteInstance; 35 class SiteInstance;
37 36
38 typedef std::vector<Extension*> ExtensionList; 37 typedef std::vector<Extension*> ExtensionList;
39 38
40 // This is an interface class to encapsulate the dependencies that 39 // This is an interface class to encapsulate the dependencies that
41 // ExtensionUpdater has on ExtensionsService. This allows easy mocking. 40 // ExtensionUpdater has on ExtensionsService. This allows easy mocking.
42 class ExtensionUpdateService { 41 class ExtensionUpdateService {
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 73
75 // Determine if a given extension download should be treated as if it came 74 // Determine if a given extension download should be treated as if it came
76 // from the gallery. 75 // from the gallery.
77 static bool IsDownloadFromGallery(const GURL& download_url, 76 static bool IsDownloadFromGallery(const GURL& download_url,
78 const GURL& referrer_url); 77 const GURL& referrer_url);
79 78
80 ExtensionsService(Profile* profile, 79 ExtensionsService(Profile* profile,
81 const CommandLine* command_line, 80 const CommandLine* command_line,
82 PrefService* prefs, 81 PrefService* prefs,
83 const FilePath& install_directory, 82 const FilePath& install_directory,
84 MessageLoop* frontend_loop,
85 MessageLoop* backend_loop,
86 bool autoupdate_enabled); 83 bool autoupdate_enabled);
87 virtual ~ExtensionsService(); 84 virtual ~ExtensionsService();
88 85
89 // Gets the list of currently installed extensions. 86 // Gets the list of currently installed extensions.
90 virtual const ExtensionList* extensions() const { return &extensions_; } 87 virtual const ExtensionList* extensions() const { return &extensions_; }
91 virtual const ExtensionList* disabled_extensions() const { 88 virtual const ExtensionList* disabled_extensions() const {
92 return &disabled_extensions_; 89 return &disabled_extensions_;
93 } 90 }
94 91
95 const FilePath& install_directory() const { return install_directory_; } 92 const FilePath& install_directory() const { return install_directory_; }
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
240 237
241 // Handles sending notification that |extension| was unloaded. 238 // Handles sending notification that |extension| was unloaded.
242 void NotifyExtensionUnloaded(Extension* extension); 239 void NotifyExtensionUnloaded(Extension* extension);
243 240
244 // The profile this ExtensionsService is part of. 241 // The profile this ExtensionsService is part of.
245 Profile* profile_; 242 Profile* profile_;
246 243
247 // Preferences for the owning profile. 244 // Preferences for the owning profile.
248 scoped_ptr<ExtensionPrefs> extension_prefs_; 245 scoped_ptr<ExtensionPrefs> extension_prefs_;
249 246
250 // The message loop to use with the backend.
251 MessageLoop* backend_loop_;
252
253 // The current list of installed extensions. 247 // The current list of installed extensions.
254 ExtensionList extensions_; 248 ExtensionList extensions_;
255 249
256 // The list of installed extensions that have been disabled. 250 // The list of installed extensions that have been disabled.
257 ExtensionList disabled_extensions_; 251 ExtensionList disabled_extensions_;
258 252
259 // The full path to the directory where extensions are installed. 253 // The full path to the directory where extensions are installed.
260 FilePath install_directory_; 254 FilePath install_directory_;
261 255
262 // Whether or not extensions are enabled. 256 // Whether or not extensions are enabled.
(...skipping 16 matching lines...) Expand all
279 273
280 // Implements IO for the ExtensionsService. 274 // Implements IO for the ExtensionsService.
281 // TODO(aa): This can probably move into the .cc file. 275 // TODO(aa): This can probably move into the .cc file.
282 class ExtensionsServiceBackend 276 class ExtensionsServiceBackend
283 : public base::RefCountedThreadSafe<ExtensionsServiceBackend>, 277 : public base::RefCountedThreadSafe<ExtensionsServiceBackend>,
284 public ExternalExtensionProvider::Visitor { 278 public ExternalExtensionProvider::Visitor {
285 public: 279 public:
286 // |rdh| can be NULL in the case of test environment. 280 // |rdh| can be NULL in the case of test environment.
287 // |extension_prefs| contains a dictionary value that points to the extension 281 // |extension_prefs| contains a dictionary value that points to the extension
288 // preferences. 282 // preferences.
289 ExtensionsServiceBackend(const FilePath& install_directory, 283 ExtensionsServiceBackend(const FilePath& install_directory);
290 MessageLoop* frontend_loop);
291 284
292 virtual ~ExtensionsServiceBackend(); 285 virtual ~ExtensionsServiceBackend();
293 286
294 // Loads a single extension from |path| where |path| is the top directory of 287 // Loads a single extension from |path| where |path| is the top directory of
295 // a specific extension where its manifest file lives. 288 // a specific extension where its manifest file lives.
296 // Errors are reported through ExtensionErrorReporter. On success, 289 // Errors are reported through ExtensionErrorReporter. On success,
297 // OnExtensionLoaded() is called. 290 // OnExtensionLoaded() is called.
298 // TODO(erikkay): It might be useful to be able to load a packed extension 291 // TODO(erikkay): It might be useful to be able to load a packed extension
299 // (presumably into memory) without installing it. 292 // (presumably into memory) without installing it.
300 void LoadSingleExtension(const FilePath &path, 293 void LoadSingleExtension(const FilePath &path,
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
359 // This is a naked pointer which is set by each entry point. 352 // This is a naked pointer which is set by each entry point.
360 // The entry point is responsible for ensuring lifetime. 353 // The entry point is responsible for ensuring lifetime.
361 ExtensionsService* frontend_; 354 ExtensionsService* frontend_;
362 355
363 // The top-level extensions directory being installed to. 356 // The top-level extensions directory being installed to.
364 FilePath install_directory_; 357 FilePath install_directory_;
365 358
366 // Whether errors result in noisy alerts. 359 // Whether errors result in noisy alerts.
367 bool alert_on_error_; 360 bool alert_on_error_;
368 361
369 // The message loop to use to call the frontend.
370 MessageLoop* frontend_loop_;
371
372 // A map of all external extension providers. 362 // A map of all external extension providers.
373 typedef std::map<Extension::Location, 363 typedef std::map<Extension::Location,
374 linked_ptr<ExternalExtensionProvider> > ProviderMap; 364 linked_ptr<ExternalExtensionProvider> > ProviderMap;
375 ProviderMap external_extension_providers_; 365 ProviderMap external_extension_providers_;
376 366
377 DISALLOW_COPY_AND_ASSIGN(ExtensionsServiceBackend); 367 DISALLOW_COPY_AND_ASSIGN(ExtensionsServiceBackend);
378 }; 368 };
379 369
380 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSIONS_SERVICE_H_ 370 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSIONS_SERVICE_H_
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_updater_unittest.cc ('k') | chrome/browser/extensions/extensions_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698