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

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

Issue 5784004: Add DCHECKs to StatefulExternalExtensionProvider (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase before commit Created 10 years 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_STATEFUL_EXTERNAL_EXTENSION_PROVIDER_H_ 5 #ifndef CHROME_BROWSER_EXTENSIONS_STATEFUL_EXTERNAL_EXTENSION_PROVIDER_H_
6 #define CHROME_BROWSER_EXTENSIONS_STATEFUL_EXTERNAL_EXTENSION_PROVIDER_H_ 6 #define CHROME_BROWSER_EXTENSIONS_STATEFUL_EXTERNAL_EXTENSION_PROVIDER_H_
7 #pragma once 7 #pragma once
8 8
9 #include "chrome/browser/extensions/external_extension_provider.h" 9 #include "chrome/browser/extensions/external_extension_provider.h"
10 10
11 class DictionaryValue; 11 class DictionaryValue;
12 class ValueSerializer; 12 class ValueSerializer;
13 class Version; 13 class Version;
14 14
15 // A specialization of the ExternalExtensionProvider that stores the registered 15 // A specialization of the ExternalExtensionProvider that stores the registered
16 // external extensions in a dictionary. This dictionary (|prefs_|) will be used 16 // external extensions in a dictionary. This dictionary (|prefs_|) will be used
17 // by HasExtension() and GetExtensionDetails() to return information about the 17 // by HasExtension() and GetExtensionDetails() to return information about the
18 // stored external extensions. It is the responsibility of specialized 18 // stored external extensions. It is the responsibility of specialized
19 // subclasses to initialize this internal dictionary. 19 // subclasses to initialize this internal dictionary.
20 // This provider can provide external extensions from two sources: crx files 20 // This provider can provide external extensions from two sources: crx files
21 // and udpate URLs. The locations that the provider will report for these 21 // and udpate URLs. The locations that the provider will report for these
22 // are specified at the constructor. 22 // are specified at the constructor.
23 // Instances of this class are expected to be created and destroyed on the UI
24 // thread and they are expecting public method calls from the FILE thread.
23 class StatefulExternalExtensionProvider : public ExternalExtensionProvider { 25 class StatefulExternalExtensionProvider : public ExternalExtensionProvider {
24 public: 26 public:
25 // Initialize the location for external extensions originating from crx 27 // Initialize the location for external extensions originating from crx
26 // files: |crx_location|, and originating from update URLs: 28 // files: |crx_location|, and originating from update URLs:
27 // |download_location|. If either of the origins is not supported by this 29 // |download_location|. If either of the origins is not supported by this
28 // provider, then it should be initialized as Extensions::INVALID. 30 // provider, then it should be initialized as Extensions::INVALID.
29 StatefulExternalExtensionProvider( 31 StatefulExternalExtensionProvider(
30 Extension::Location crx_location, 32 Extension::Location crx_location,
31 Extension::Location download_location); 33 Extension::Location download_location);
32 virtual ~StatefulExternalExtensionProvider(); 34 virtual ~StatefulExternalExtensionProvider();
33 35
34 // ExternalExtensionProvider implementation: 36 // ExternalExtensionProvider implementation:
35 virtual void VisitRegisteredExtension(Visitor* visitor) const; 37 virtual void VisitRegisteredExtension(Visitor* visitor) const;
36 38
37 virtual bool HasExtension(const std::string& id) const; 39 virtual bool HasExtension(const std::string& id) const;
38 40
39 virtual bool GetExtensionDetails(const std::string& id, 41 virtual bool GetExtensionDetails(const std::string& id,
40 Extension::Location* location, 42 Extension::Location* location,
41 scoped_ptr<Version>* version) const; 43 scoped_ptr<Version>* version) const;
42 protected: 44 protected:
43 // Location for external extensions that are provided by this provider from 45 // Location for external extensions that are provided by this provider from
44 // local crx files. 46 // local crx files.
45 const Extension::Location crx_location_; 47 const Extension::Location crx_location_;
46 // Location for external extensions that are provided by this provider from 48 // Location for external extensions that are provided by this provider from
47 // update URLs. 49 // update URLs.
48 const Extension::Location download_location_; 50 const Extension::Location download_location_;
51
52 // Stores the dictionary of external extensions internally. Takes ownership
53 // of |prefs|.
54 void set_prefs(DictionaryValue* prefs);
55
56 private:
49 // Dictionary of the external extensions that are provided by this provider. 57 // Dictionary of the external extensions that are provided by this provider.
50 scoped_ptr<DictionaryValue> prefs_; 58 scoped_ptr<DictionaryValue> prefs_;
51 }; 59 };
52 60
53 #endif // CHROME_BROWSER_EXTENSIONS_STATEFUL_EXTERNAL_EXTENSION_PROVIDER_H_ 61 #endif // CHROME_BROWSER_EXTENSIONS_STATEFUL_EXTERNAL_EXTENSION_PROVIDER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698