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

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

Issue 12253022: Manifest handler for all keys background-related. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 10 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CHROME_COMMON_EXTENSIONS_BACKGROUND_INFO_H_
6 #define CHROME_COMMON_EXTENSIONS_BACKGROUND_INFO_H_
7
8 #include <string>
9 #include <vector>
10
11 #include "base/values.h"
12 #include "chrome/common/extensions/extension.h"
13 #include "chrome/common/extensions/manifest_handler.h"
14 #include "googleurl/src/gurl.h"
15
16 namespace extensions {
17
18 struct BackgroundInfo : public Extension::ManifestData {
Matt Perry 2013/02/15 20:15:02 Make this a class.
Yoyo Zhou 2013/02/16 00:54:04 Done.
19 BackgroundInfo();
20 virtual ~BackgroundInfo();
21
22 static GURL GetBackgroundURL(const Extension* extension);
23 static const std::vector<std::string>& GetBackgroundScripts(
24 const Extension* extension);
25 static bool HasBackgroundPage(const Extension* extension);
26 static bool HasPersistentBackgroundPage(const Extension* extension);
27 static bool HasLazyBackgroundPage(const Extension* extension);
28 static bool AllowJSAccess(const Extension* extension);
29
30 bool has_background_page() const {
31 return background_url.is_valid() || !background_scripts.empty();
32 }
33
34 // Optional URL to a master page of which a single instance should be always
35 // loaded in the background.
36 GURL background_url;
Matt Perry 2013/02/15 20:15:02 These should all be private. You only access them
Yoyo Zhou 2013/02/16 00:54:04 Done; also needed to make the load functions membe
Matt Perry 2013/02/16 01:16:52 Aw, didn't see that originally. Another thing you
37
38 // Optional list of scripts to use to generate a background page. If this is
39 // present, background_url_ will be empty and generated by GetBackgroundURL().
40 std::vector<std::string> background_scripts;
41
42 // True if the background page should stay loaded forever; false if it should
43 // load on-demand (when it needs to handle an event). Defaults to true.
44 bool is_persistent;
45
46 // True if the background page can be scripted by pages of the app or
47 // extension, in which case all such pages must run in the same process.
48 // False if such pages are not permitted to script the background page,
49 // allowing them to run in different processes.
50 // Defaults to true.
51 bool allow_js_access;
52 };
53
54 // Parses all background/event page-related keys in the manifest.
55 class BackgroundManifestHandler : public ManifestHandler {
56 public:
57 BackgroundManifestHandler();
58 virtual ~BackgroundManifestHandler();
59
60 virtual bool Parse(Extension* extension,
61 string16* error) OVERRIDE;
62
63 // For convenience, returns the list of keys that this parses.
64 static const std::vector<std::string> keys();
65 };
66
67 } // namespace extensions
68
69 #endif // CHROME_COMMON_EXTENSIONS_BACKGROUND_INFO_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698