Enable Enterprise enrollment on desktop builds.
[chromium-blink-merge.git] / chrome / common / extensions / manifest_handlers / app_launch_info.h
blobe3e049d534740d180143846e4bd1e08ef93f7baf
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
3 // found in the LICENSE file.
5 #ifndef CHROME_COMMON_EXTENSIONS_MANIFEST_HANDLERS_APP_LAUNCH_INFO_H_
6 #define CHROME_COMMON_EXTENSIONS_MANIFEST_HANDLERS_APP_LAUNCH_INFO_H_
8 #include <string>
9 #include <vector>
11 #include "chrome/common/extensions/extension_constants.h"
12 #include "extensions/common/extension.h"
13 #include "extensions/common/manifest.h"
14 #include "extensions/common/manifest_handler.h"
15 #include "url/gurl.h"
17 namespace extensions {
19 // Container that holds the parsed app launch data.
20 class AppLaunchInfo : public Extension::ManifestData {
21 public:
22 AppLaunchInfo();
23 virtual ~AppLaunchInfo();
25 // Get the local path inside the extension to use with the launcher.
26 static const std::string& GetLaunchLocalPath(const Extension* extension);
28 // Get the absolute web url to use with the launcher.
29 static const GURL& GetLaunchWebURL(const Extension* extension);
31 // The window type that an app's manifest specifies to launch into.
32 // This is not always the window type an app will open into, because
33 // users can override the way each app launches. See
34 // ExtensionPrefs::GetLaunchContainer(), which looks at a per-app pref
35 // to decide what container an app will launch in.
36 static LaunchContainer GetLaunchContainer(
37 const Extension* extension);
39 // The default size of the container when launching. Only respected for
40 // containers like panels and windows.
41 static int GetLaunchWidth(const Extension* extension);
42 static int GetLaunchHeight(const Extension* extension);
44 // Get the fully resolved absolute launch URL.
45 static GURL GetFullLaunchURL(const Extension* extension);
47 bool Parse(Extension* extension, base::string16* error);
49 private:
50 bool LoadLaunchURL(Extension* extension, base::string16* error);
51 bool LoadLaunchContainer(Extension* extension, base::string16* error);
52 void OverrideLaunchURL(Extension* extension, GURL override_url);
54 std::string launch_local_path_;
56 GURL launch_web_url_;
58 LaunchContainer launch_container_;
60 int launch_width_;
61 int launch_height_;
63 DISALLOW_COPY_AND_ASSIGN(AppLaunchInfo);
66 // Parses all app launch related keys in the manifest.
67 class AppLaunchManifestHandler : public ManifestHandler {
68 public:
69 AppLaunchManifestHandler();
70 virtual ~AppLaunchManifestHandler();
72 virtual bool Parse(Extension* extension, base::string16* error) OVERRIDE;
73 virtual bool AlwaysParseForType(Manifest::Type type) const OVERRIDE;
75 private:
76 virtual const std::vector<std::string> Keys() const OVERRIDE;
78 DISALLOW_COPY_AND_ASSIGN(AppLaunchManifestHandler);
81 } // namespace extensions
83 #endif // CHROME_COMMON_EXTENSIONS_MANIFEST_HANDLERS_APP_LAUNCH_INFO_H_