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

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: more DCHECKS! 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.
jochen (gone - plz use gerrit) 2010/12/15 08:57:49 please add a comment that the object must be creat
gfeher 2010/12/15 13:44:58 Done.
23 class StatefulExternalExtensionProvider : public ExternalExtensionProvider { 23 class StatefulExternalExtensionProvider : public ExternalExtensionProvider {
24 public: 24 public:
25 // Initialize the location for external extensions originating from crx 25 // Initialize the location for external extensions originating from crx
26 // files: |crx_location|, and originating from update URLs: 26 // files: |crx_location|, and originating from update URLs:
27 // |download_location|. If either of the origins is not supported by this 27 // |download_location|. If either of the origins is not supported by this
28 // provider, then it should be initialized as Extensions::INVALID. 28 // provider, then it should be initialized as Extensions::INVALID.
29 StatefulExternalExtensionProvider( 29 StatefulExternalExtensionProvider(
30 Extension::Location crx_location, 30 Extension::Location crx_location,
31 Extension::Location download_location); 31 Extension::Location download_location);
32 virtual ~StatefulExternalExtensionProvider(); 32 virtual ~StatefulExternalExtensionProvider();
33 33
34 // ExternalExtensionProvider implementation: 34 // ExternalExtensionProvider implementation:
35 virtual void VisitRegisteredExtension(Visitor* visitor) const; 35 virtual void VisitRegisteredExtension(Visitor* visitor) const;
36 36
37 virtual bool HasExtension(const std::string& id) const; 37 virtual bool HasExtension(const std::string& id) const;
38 38
39 virtual bool GetExtensionDetails(const std::string& id, 39 virtual bool GetExtensionDetails(const std::string& id,
40 Extension::Location* location, 40 Extension::Location* location,
41 scoped_ptr<Version>* version) const; 41 scoped_ptr<Version>* version) const;
42 protected: 42 protected:
43 // Location for external extensions that are provided by this provider from 43 // Location for external extensions that are provided by this provider from
44 // local crx files. 44 // local crx files.
45 const Extension::Location crx_location_; 45 const Extension::Location crx_location_;
46 // Location for external extensions that are provided by this provider from 46 // Location for external extensions that are provided by this provider from
47 // update URLs. 47 // update URLs.
48 const Extension::Location download_location_; 48 const Extension::Location download_location_;
49
50 // Stores the dictionary of external extensions internally. Takes ownership
51 // of |prefs|.
52 void set_prefs(DictionaryValue* prefs);
53
54 private:
49 // Dictionary of the external extensions that are provided by this provider. 55 // Dictionary of the external extensions that are provided by this provider.
50 scoped_ptr<DictionaryValue> prefs_; 56 scoped_ptr<DictionaryValue> prefs_;
51 }; 57 };
52 58
53 #endif // CHROME_BROWSER_EXTENSIONS_STATEFUL_EXTERNAL_EXTENSION_PROVIDER_H_ 59 #endif // CHROME_BROWSER_EXTENSIONS_STATEFUL_EXTERNAL_EXTENSION_PROVIDER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698