X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=src%2Fxwalk%2Fapplication%2Fbrowser%2Fapplication.h;h=ff49ad8e1c498f4038c7457b1df38c83c9ab600a;hb=3cb1527a1d0111fd75188ac2c34c117944473076;hp=e0f2662524ce92a1cc2f7aac2ea81caac352026f;hpb=ff3e2503a20db9193d323c1d19c38c68004dec4a;p=platform%2Fframework%2Fweb%2Fcrosswalk.git diff --git a/src/xwalk/application/browser/application.h b/src/xwalk/application/browser/application.h index e0f2662..ff49ad8 100644 --- a/src/xwalk/application/browser/application.h +++ b/src/xwalk/application/browser/application.h @@ -8,6 +8,7 @@ #include #include #include +#include #include "base/callback.h" #include "base/compiler_specific.h" @@ -17,6 +18,7 @@ #include "ui/base/ui_base_types.h" #include "xwalk/application/browser/event_observer.h" #include "xwalk/application/common/application_data.h" +#include "xwalk/application/common/security_policy.h" #include "xwalk/runtime/browser/runtime.h" namespace xwalk { @@ -27,6 +29,7 @@ namespace application { class ApplicationHost; class Manifest; +class SecurityPolicy; // The Application class is representing an active (running) application. // Application instances are owned by ApplicationService. @@ -50,14 +53,11 @@ class Application : public Runtime::Observer { // Manifest keys that can be used as application entry points. enum LaunchEntryPoint { - AppMainKey = 1 << 0, // app.main - LaunchLocalPathKey = 1 << 1, // app.launch.local_path - // NOTE: The following key is only used for "dummy" hosted apps, - // which can be using any arbitrary URL, incl. remote ones. - // For now this should be disabled for all other cases as this will - // require special care with permissions etc. - URLKey = 1 << 2, // url - Default = AppMainKey | LaunchLocalPathKey + StartURLKey = 1 << 0, // start_url + AppMainKey = 1 << 1, // app.main + LaunchLocalPathKey = 1 << 2, // app.launch.local_path + URLKey = 1 << 3, // url + Default = StartURLKey | AppMainKey | LaunchLocalPathKey }; typedef unsigned LaunchEntryPoints; @@ -65,7 +65,7 @@ class Application : public Runtime::Observer { LaunchParams() : entry_points(Default), launcher_pid(0), - window_state(ui::SHOW_STATE_DEFAULT) {} + force_fullscreen(false) {} LaunchEntryPoints entry_points; @@ -73,8 +73,7 @@ class Application : public Runtime::Observer { // process. int32 launcher_pid; - // Sets the initial state for the application windows. - ui::WindowShowState window_state; + bool force_fullscreen; }; // Closes all the application's runtimes (application pages). @@ -127,6 +126,22 @@ class Application : public Runtime::Observer { bool SetPermission(PermissionType type, const std::string& permission_name, StoredPermission perm); + bool CanRequestURL(const GURL& url) const; + + protected: + // We enforce ApplicationService ownership. + friend class ApplicationService; + Application(scoped_refptr data, + RuntimeContext* context, + Observer* observer); + + virtual void InitSecurityPolicy(); + void AddSecurityPolicy(const GURL& url, bool subdomains); + + Runtime* main_runtime_; + std::set runtimes_; + scoped_refptr const application_data_; + bool is_security_mode_; private: bool HasMainDocument() const; @@ -134,21 +149,18 @@ class Application : public Runtime::Observer { virtual void OnRuntimeAdded(Runtime* runtime) OVERRIDE; virtual void OnRuntimeRemoved(Runtime* runtime) OVERRIDE; - // We enforce ApplicationService ownership. - friend class ApplicationService; - Application(scoped_refptr data, - RuntimeContext* context, - Observer* observer); bool Launch(const LaunchParams& launch_params); // Try to extract the URL from different possible keys for entry points in the // manifest, returns it and the entry point used. - GURL GetURLForLaunch(const LaunchParams& params, LaunchEntryPoint* used); + GURL GetStartURL(const LaunchParams& params, LaunchEntryPoint* used); + ui::WindowShowState GetWindowShowState(const LaunchParams& params); GURL GetURLFromAppMainKey(); - GURL GetURLFromLocalPathKey(); GURL GetURLFromURLKey(); + GURL GetURLFromRelativePathKey(const std::string& key); + friend class FinishEventObserver; void CloseMainDocument(); void NotifyTermination(); @@ -156,19 +168,18 @@ class Application : public Runtime::Observer { bool IsTerminating() const { return finish_observer_; } RuntimeContext* runtime_context_; - const scoped_refptr application_data_; - Runtime* main_runtime_; - std::set runtimes_; scoped_ptr finish_observer_; Observer* observer_; // The entry point used as part of Launch(). LaunchEntryPoint entry_point_used_; TerminationMode termination_mode_used_; - base::WeakPtrFactory weak_factory_; std::map name_perm_map_; // Application's session permissions. StoredPermissionMap permission_map_; - + // Security policy set. + ScopedVector security_policy_; + // WeakPtrFactory should be always declared the last. + base::WeakPtrFactory weak_factory_; DISALLOW_COPY_AND_ASSIGN(Application); };