OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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 EXTENSIONS_COMMON_MANIFEST_HANDLERS_BACKGROUND_INFO_H_ | 5 #ifndef EXTENSIONS_COMMON_MANIFEST_HANDLERS_BACKGROUND_INFO_H_ |
6 #define EXTENSIONS_COMMON_MANIFEST_HANDLERS_BACKGROUND_INFO_H_ | 6 #define EXTENSIONS_COMMON_MANIFEST_HANDLERS_BACKGROUND_INFO_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 23 matching lines...) Expand all Loading... |
34 } | 34 } |
35 | 35 |
36 bool has_persistent_background_page() const { | 36 bool has_persistent_background_page() const { |
37 return has_background_page() && is_persistent_; | 37 return has_background_page() && is_persistent_; |
38 } | 38 } |
39 | 39 |
40 bool has_lazy_background_page() const { | 40 bool has_lazy_background_page() const { |
41 return has_background_page() && !is_persistent_; | 41 return has_background_page() && !is_persistent_; |
42 } | 42 } |
43 | 43 |
44 bool Parse(const Extension* extension, string16* error); | 44 bool Parse(const Extension* extension, base::string16* error); |
45 | 45 |
46 private: | 46 private: |
47 bool LoadBackgroundScripts(const Extension* extension, | 47 bool LoadBackgroundScripts(const Extension* extension, |
48 const std::string& key, | 48 const std::string& key, |
49 string16* error); | 49 base::string16* error); |
50 bool LoadBackgroundPage(const Extension* extension, | 50 bool LoadBackgroundPage(const Extension* extension, |
51 const std::string& key, | 51 const std::string& key, |
52 string16* error); | 52 base::string16* error); |
53 bool LoadBackgroundPage(const Extension* extension, string16* error); | 53 bool LoadBackgroundPage(const Extension* extension, base::string16* error); |
54 bool LoadBackgroundPersistent(const Extension* extension, string16* error); | 54 bool LoadBackgroundPersistent(const Extension* extension, |
55 bool LoadAllowJSAccess(const Extension* extension, string16* error); | 55 base::string16* error); |
| 56 bool LoadAllowJSAccess(const Extension* extension, base::string16* error); |
56 | 57 |
57 // Optional URL to a master page of which a single instance should be always | 58 // Optional URL to a master page of which a single instance should be always |
58 // loaded in the background. | 59 // loaded in the background. |
59 GURL background_url_; | 60 GURL background_url_; |
60 | 61 |
61 // Optional list of scripts to use to generate a background page. If this is | 62 // Optional list of scripts to use to generate a background page. If this is |
62 // present, background_url_ will be empty and generated by GetBackgroundURL(). | 63 // present, background_url_ will be empty and generated by GetBackgroundURL(). |
63 std::vector<std::string> background_scripts_; | 64 std::vector<std::string> background_scripts_; |
64 | 65 |
65 // True if the background page should stay loaded forever; false if it should | 66 // True if the background page should stay loaded forever; false if it should |
66 // load on-demand (when it needs to handle an event). Defaults to true. | 67 // load on-demand (when it needs to handle an event). Defaults to true. |
67 bool is_persistent_; | 68 bool is_persistent_; |
68 | 69 |
69 // True if the background page can be scripted by pages of the app or | 70 // True if the background page can be scripted by pages of the app or |
70 // extension, in which case all such pages must run in the same process. | 71 // extension, in which case all such pages must run in the same process. |
71 // False if such pages are not permitted to script the background page, | 72 // False if such pages are not permitted to script the background page, |
72 // allowing them to run in different processes. | 73 // allowing them to run in different processes. |
73 // Defaults to true. | 74 // Defaults to true. |
74 bool allow_js_access_; | 75 bool allow_js_access_; |
75 | 76 |
76 DISALLOW_COPY_AND_ASSIGN(BackgroundInfo); | 77 DISALLOW_COPY_AND_ASSIGN(BackgroundInfo); |
77 }; | 78 }; |
78 | 79 |
79 // Parses all background/event page-related keys in the manifest. | 80 // Parses all background/event page-related keys in the manifest. |
80 class BackgroundManifestHandler : public ManifestHandler { | 81 class BackgroundManifestHandler : public ManifestHandler { |
81 public: | 82 public: |
82 BackgroundManifestHandler(); | 83 BackgroundManifestHandler(); |
83 virtual ~BackgroundManifestHandler(); | 84 virtual ~BackgroundManifestHandler(); |
84 | 85 |
85 virtual bool Parse(Extension* extension, string16* error) OVERRIDE; | 86 virtual bool Parse(Extension* extension, base::string16* error) OVERRIDE; |
86 virtual bool Validate(const Extension* extension, | 87 virtual bool Validate(const Extension* extension, |
87 std::string* error, | 88 std::string* error, |
88 std::vector<InstallWarning>* warnings) const OVERRIDE; | 89 std::vector<InstallWarning>* warnings) const OVERRIDE; |
89 virtual bool AlwaysParseForType(Manifest::Type type) const OVERRIDE; | 90 virtual bool AlwaysParseForType(Manifest::Type type) const OVERRIDE; |
90 | 91 |
91 private: | 92 private: |
92 virtual const std::vector<std::string> Keys() const OVERRIDE; | 93 virtual const std::vector<std::string> Keys() const OVERRIDE; |
93 | 94 |
94 DISALLOW_COPY_AND_ASSIGN(BackgroundManifestHandler); | 95 DISALLOW_COPY_AND_ASSIGN(BackgroundManifestHandler); |
95 }; | 96 }; |
96 | 97 |
97 } // namespace extensions | 98 } // namespace extensions |
98 | 99 |
99 #endif // EXTENSIONS_COMMON_MANIFEST_HANDLERS_BACKGROUND_INFO_H_ | 100 #endif // EXTENSIONS_COMMON_MANIFEST_HANDLERS_BACKGROUND_INFO_H_ |
OLD | NEW |