// Copyright (c) 2013 Intel Corporation. All rights reserved.
+// Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
virtual ~Observer() {}
};
- // Manifest keys that can be used as application entry points.
- enum LaunchEntryPoint {
- StartURLKey = 1 << 0, // start_url
- LaunchLocalPathKey = 1 << 1, // app.launch.local_path
- URLKey = 1 << 2, // url
- Default = StartURLKey | LaunchLocalPathKey
- };
- typedef unsigned LaunchEntryPoints;
-
struct LaunchParams {
- LaunchParams() :
- entry_points(Default),
- launcher_pid(0),
- force_fullscreen(false),
- remote_debugging(false) {}
-
- LaunchEntryPoints entry_points;
-
// Used only when running as service. Specifies the PID of the launcher
// process.
int32 launcher_pid;
content::RenderProcessHost* render_process_host() {
return render_process_host_; }
- const ApplicationData* data() const { return data_; }
- ApplicationData* data() { return data_; }
+ const ApplicationData* data() const { return data_.get(); }
+ ApplicationData* data() { return data_.get(); }
// Tells whether the application use the specified extension.
bool UseExtension(const std::string& extension_name) const;
StoredPermission perm);
bool CanRequestURL(const GURL& url) const;
+ void set_observer(Observer* observer) { observer_ = observer; }
+
protected:
- // We enforce ApplicationService ownership.
- friend class ApplicationService;
- Application(scoped_refptr<ApplicationData> data,
- RuntimeContext* context,
- Observer* observer);
+ Application(scoped_refptr<ApplicationData> data, RuntimeContext* context);
virtual bool Launch(const LaunchParams& launch_params);
virtual void InitSecurityPolicy();
virtual base::FilePath GetSplashScreenPath();
std::set<Runtime*> runtimes_;
+ RuntimeContext* runtime_context_;
scoped_refptr<ApplicationData> const data_;
// The application's render process host.
content::RenderProcessHost* render_process_host_;
}
private:
+ // We enforce ApplicationService ownership.
+ friend class ApplicationService;
+ static scoped_ptr<Application> Create(scoped_refptr<ApplicationData> data,
+ RuntimeContext* context);
// Runtime::Observer implementation.
virtual void OnRuntimeAdded(Runtime* runtime) OVERRIDE;
virtual void OnRuntimeRemoved(Runtime* runtime) OVERRIDE;
// Try to extract the URL from different possible keys for entry points in the
// manifest, returns it and the entry point used.
- GURL GetStartURL(const LaunchParams& params, LaunchEntryPoint* used);
- ui::WindowShowState GetWindowShowStateWGT(const LaunchParams& params);
- ui::WindowShowState GetWindowShowStateXPK(const LaunchParams& params);
+ template <Manifest::Type> GURL GetStartURL();
+
+ template <Manifest::Type>
+ ui::WindowShowState GetWindowShowState(const LaunchParams& params);
GURL GetAbsoluteURLFromKey(const std::string& key);
void NotifyTermination();
- RuntimeContext* runtime_context_;
Observer* observer_;
- // The entry point used as part of Launch().
- LaunchEntryPoint entry_point_used_;
+
std::map<std::string, std::string> name_perm_map_;
// Application's session permissions.
StoredPermissionMap permission_map_;