1868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)// Copyright 2013 The Chromium Authors. All rights reserved. 2868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)// Use of this source code is governed by a BSD-style license that can be 3868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)// found in the LICENSE file. 4868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) 5868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)#ifndef CHROME_COMMON_EXTENSIONS_MANIFEST_HANDLERS_APP_LAUNCH_INFO_H_ 6868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)#define CHROME_COMMON_EXTENSIONS_MANIFEST_HANDLERS_APP_LAUNCH_INFO_H_ 7868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) 8868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)#include <string> 9868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)#include <vector> 10868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) 11a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)#include "chrome/common/extensions/extension_constants.h" 12f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)#include "extensions/common/extension.h" 133551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)#include "extensions/common/manifest.h" 14f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)#include "extensions/common/manifest_handler.h" 157dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch#include "url/gurl.h" 16868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) 17868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)namespace extensions { 18868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) 19868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)// Container that holds the parsed app launch data. 20868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)class AppLaunchInfo : public Extension::ManifestData { 21868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) public: 22868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) AppLaunchInfo(); 23868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) virtual ~AppLaunchInfo(); 24868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) 25868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) // Get the local path inside the extension to use with the launcher. 26868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) static const std::string& GetLaunchLocalPath(const Extension* extension); 27868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) 28868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) // Get the absolute web url to use with the launcher. 29868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) static const GURL& GetLaunchWebURL(const Extension* extension); 30868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) 31868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) // The window type that an app's manifest specifies to launch into. 32868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) // This is not always the window type an app will open into, because 33868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) // users can override the way each app launches. See 34868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) // ExtensionPrefs::GetLaunchContainer(), which looks at a per-app pref 35868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) // to decide what container an app will launch in. 36f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles) static LaunchContainer GetLaunchContainer( 37868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) const Extension* extension); 38868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) 39868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) // The default size of the container when launching. Only respected for 40868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) // containers like panels and windows. 41868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) static int GetLaunchWidth(const Extension* extension); 42868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) static int GetLaunchHeight(const Extension* extension); 43868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) 44868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) // Get the fully resolved absolute launch URL. 45868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) static GURL GetFullLaunchURL(const Extension* extension); 46868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) 47a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles) bool Parse(Extension* extension, base::string16* error); 48868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) 49868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) private: 50a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles) bool LoadLaunchURL(Extension* extension, base::string16* error); 51a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles) bool LoadLaunchContainer(Extension* extension, base::string16* error); 52868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) void OverrideLaunchURL(Extension* extension, GURL override_url); 53868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) 54868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) std::string launch_local_path_; 55868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) 56868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) GURL launch_web_url_; 57868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) 58f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles) LaunchContainer launch_container_; 59868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) 60868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) int launch_width_; 61868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) int launch_height_; 62868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) 63868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) DISALLOW_COPY_AND_ASSIGN(AppLaunchInfo); 64868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)}; 65868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) 66868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)// Parses all app launch related keys in the manifest. 67868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)class AppLaunchManifestHandler : public ManifestHandler { 68868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) public: 69868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) AppLaunchManifestHandler(); 70868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) virtual ~AppLaunchManifestHandler(); 71868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) 72a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles) virtual bool Parse(Extension* extension, base::string16* error) OVERRIDE; 73868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) virtual bool AlwaysParseForType(Manifest::Type type) const OVERRIDE; 74868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) 75868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) private: 76868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) virtual const std::vector<std::string> Keys() const OVERRIDE; 77868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) 78868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) DISALLOW_COPY_AND_ASSIGN(AppLaunchManifestHandler); 79868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)}; 80868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) 81868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)} // namespace extensions 82868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) 83868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)#endif // CHROME_COMMON_EXTENSIONS_MANIFEST_HANDLERS_APP_LAUNCH_INFO_H_ 84