| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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_ |
| OLD | NEW |