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

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

Issue 12316077: Move the parsing of app.launch related keys out of Extension class. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase + review comments addressed Created 7 years, 9 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
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_APP_LAUNCHER_INFO_H_
6 #define CHROME_COMMON_EXTENSIONS_APP_LAUNCHER_INFO_H_
7
8 #include <string>
9 #include <vector>
10
11 #include "chrome/common/extensions/extension.h"
12 #include "chrome/common/extensions/extension_constants.h"
13 #include "chrome/common/extensions/manifest.h"
14 #include "chrome/common/extensions/manifest_handler.h"
15 #include "googleurl/src/gurl.h"
16
17 namespace extensions {
18
19 // Container that holds the parsed app launch data.
20 class AppLauncherInfo : public Extension::ManifestData {
21 public:
22 AppLauncherInfo();
23 virtual ~AppLauncherInfo();
24
25 static const std::string& GetLaunchLocalPath(const Extension* extension);
26 static const std::string& GetLaunchWebURL(const Extension* extension);
27 static extension_misc::LaunchContainer GetLaunchContainer(
28 const Extension* extension);
29 static int GetLaunchWidth(const Extension* extension);
30 static int GetLaunchHeight(const Extension* extension);
31 static GURL GetFullLaunchURL(const Extension* extension);
32
33 bool Parse(Extension* extension, string16* error);
34
35 private:
36 bool LoadLaunchURL(Extension* extension, string16* error);
37 bool LoadLaunchContainer(Extension* extension, string16* error);
38 void OverrideLaunchURL(Extension* extension, GURL override_url);
39
40 // The local path inside the extension to use with the launcher.
41 std::string launch_local_path_;
42
43 // A web url to use with the launcher.
44 std::string launch_web_url_;
45
46 // The window type that an app's manifest specifies to launch into.
47 // This is not always the window type an app will open into, because
48 // users can override the way each app launches. See
49 // ExtensionPrefs::GetLaunchContainer(), which looks at a per-app pref
50 // to decide what container an app will launch in.
51 extension_misc::LaunchContainer launch_container_;
52
53 // The default size of the container when launching. Only respected for
54 // containers like panels and windows.
55 int launch_width_;
56 int launch_height_;
57 };
Devlin 2013/03/08 17:44:21 DISALLOW_COPY_AND_ASSIGN
Joe Thomas 2013/03/09 01:59:52 Done.
58
59 // Parses all app launch related keys in the manifest.
60 class AppLaunchManifestHandler : public ManifestHandler {
61 public:
62 AppLaunchManifestHandler();
63 virtual ~AppLaunchManifestHandler();
64
65 virtual bool Parse(Extension* extension, string16* error) OVERRIDE;
66 virtual bool AlwaysParseForType(Manifest::Type type) OVERRIDE;
67
68 private:
69 virtual const std::vector<std::string> Keys() const OVERRIDE;
70
71 DISALLOW_COPY_AND_ASSIGN(AppLaunchManifestHandler);
72 };
73
74 } // namespace extensions
75
76 #endif // CHROME_COMMON_EXTENSIONS_APP_LAUNCHER_INFO_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698