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

Side by Side Diff: chrome/common/extensions/background_info.h

Issue 16398010: Move some extension manifest consistency checks to BackgroundManifestHandler. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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_COMMON_EXTENSIONS_BACKGROUND_INFO_H_ 5 #ifndef CHROME_COMMON_EXTENSIONS_BACKGROUND_INFO_H_
6 #define CHROME_COMMON_EXTENSIONS_BACKGROUND_INFO_H_ 6 #define CHROME_COMMON_EXTENSIONS_BACKGROUND_INFO_H_
7 7
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 14 matching lines...) Expand all
25 const Extension* extension); 25 const Extension* extension);
26 static bool HasBackgroundPage(const Extension* extension); 26 static bool HasBackgroundPage(const Extension* extension);
27 static bool HasPersistentBackgroundPage(const Extension* extension); 27 static bool HasPersistentBackgroundPage(const Extension* extension);
28 static bool HasLazyBackgroundPage(const Extension* extension); 28 static bool HasLazyBackgroundPage(const Extension* extension);
29 static bool AllowJSAccess(const Extension* extension); 29 static bool AllowJSAccess(const Extension* extension);
30 30
31 bool has_background_page() const { 31 bool has_background_page() const {
32 return background_url_.is_valid() || !background_scripts_.empty(); 32 return background_url_.is_valid() || !background_scripts_.empty();
33 } 33 }
34 34
35 bool has_persistent_background_page() const {
36 return has_background_page() && is_persistent_;
37 }
38
39 bool has_lazy_background_page() const {
40 return has_background_page() && !is_persistent_;
41 }
42
35 bool Parse(const Extension* extension, string16* error); 43 bool Parse(const Extension* extension, string16* error);
36 44
37 private: 45 private:
38 bool LoadBackgroundScripts(const Extension* extension, 46 bool LoadBackgroundScripts(const Extension* extension,
39 const std::string& key, 47 const std::string& key,
40 string16* error); 48 string16* error);
41 bool LoadBackgroundPage(const Extension* extension, 49 bool LoadBackgroundPage(const Extension* extension,
42 const std::string& key, 50 const std::string& key,
43 string16* error); 51 string16* error);
44 bool LoadBackgroundPage(const Extension* extension, string16* error); 52 bool LoadBackgroundPage(const Extension* extension, string16* error);
(...skipping 23 matching lines...) Expand all
68 // Parses all background/event page-related keys in the manifest. 76 // Parses all background/event page-related keys in the manifest.
69 class BackgroundManifestHandler : public ManifestHandler { 77 class BackgroundManifestHandler : public ManifestHandler {
70 public: 78 public:
71 BackgroundManifestHandler(); 79 BackgroundManifestHandler();
72 virtual ~BackgroundManifestHandler(); 80 virtual ~BackgroundManifestHandler();
73 81
74 virtual bool Parse(Extension* extension, string16* error) OVERRIDE; 82 virtual bool Parse(Extension* extension, string16* error) OVERRIDE;
75 virtual bool Validate(const Extension* extension, 83 virtual bool Validate(const Extension* extension,
76 std::string* error, 84 std::string* error,
77 std::vector<InstallWarning>* warnings) const OVERRIDE; 85 std::vector<InstallWarning>* warnings) const OVERRIDE;
86 virtual bool AlwaysParseForType(Manifest::Type type) const OVERRIDE;
78 87
79 private: 88 private:
80 virtual const std::vector<std::string> Keys() const OVERRIDE; 89 virtual const std::vector<std::string> Keys() const OVERRIDE;
81 }; 90 };
82 91
83 } // namespace extensions 92 } // namespace extensions
84 93
85 #endif // CHROME_COMMON_EXTENSIONS_BACKGROUND_INFO_H_ 94 #endif // CHROME_COMMON_EXTENSIONS_BACKGROUND_INFO_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698