#include "base/basictypes.h"
#include "base/memory/scoped_ptr.h"
#include "base/memory/weak_ptr.h"
+#include "xwalk/runtime/browser/runtime_ui_strategy.h"
#include "xwalk/runtime/browser/ui/native_app_window.h"
#include "content/public/browser/notification_observer.h"
#include "content/public/browser/notification_registrar.h"
namespace content {
class ColorChooser;
struct FileChooserParams;
-class WebContents;
class RenderProcessHost;
+class SiteInstance;
+class WebContents;
}
namespace xwalk {
// is overridden WebContentsDelegate method. The "observer" is needed to
// observe appearance and removal of such Runtime instances.
class Observer {
- public:
+ public:
// Called when a new Runtime instance is added.
virtual void OnRuntimeAdded(Runtime* runtime) = 0;
// Called when a Runtime instance is removed.
virtual void OnRuntimeRemoved(Runtime* runtime) = 0;
- protected:
+ protected:
virtual ~Observer() {}
};
+ // Fullscreen options.
+ enum FullscreenOptions {
+ NO_FULLSCREEN = 0,
+ // Fullscreen entered by launch with "--fullscreen".
+ FULLSCREEN_FOR_LAUNCH = 1,
+ // Fullscreen entered by HTML requestFullscreen.
+ FULLSCREEN_FOR_TAB = 1 << 1,
+ };
+
void SetObserver(Observer* observer) { observer_ = observer; }
- // Create a new Runtime instance which binds to a default app window.
- static Runtime* CreateWithDefaultWindow(RuntimeContext*,
- const GURL&, Observer* = NULL);
// Create a new Runtime instance with the given browsing context.
- static Runtime* Create(RuntimeContext*, Observer* = NULL);
-
- // Attach to a default app window.
- void AttachDefaultWindow();
- // Attach to a app window created with 'params'.
- void AttachWindow(const NativeAppWindow::CreateParams& params);
+ static Runtime* Create(RuntimeContext*,
+ Observer* = NULL, content::SiteInstance* = NULL);
void LoadURL(const GURL& url);
void Close();
content::WebContents* web_contents() const { return web_contents_.get(); }
NativeAppWindow* window() const { return window_; }
- RuntimeContext* runtime_context() const { return runtime_context_; }
+ void set_window(NativeAppWindow* window) { window_ = window; }
gfx::Image app_icon() const { return app_icon_; }
+ void set_app_icon(const gfx::Image& app_icon);
+ void EnableTitleUpdatedNotification();
+ unsigned int fullscreen_options() { return fullscreen_options_; }
+ void set_fullscreen_options(unsigned int options) {
+ fullscreen_options_ = options;
+ }
content::RenderProcessHost* GetRenderProcessHost();
-#if defined(OS_TIZEN_MOBILE)
- void CloseRootWindow();
-#endif
+ void set_remote_debugging_enabled(bool enable) {
+ remote_debugging_enabled_ = enable;
+ }
+ bool remote_debugging_enabled() const { return remote_debugging_enabled_; }
protected:
Runtime(content::WebContents* web_contents, Observer* observer);
const content::MediaResponseCallback& callback) OVERRIDE;
// Overridden from content::WebContentsObserver.
- virtual void DidUpdateFaviconURL(int32 page_id,
+ virtual void DidUpdateFaviconURL(
const std::vector<content::FaviconURL>& candidates) OVERRIDE;
- virtual void RenderProcessGone(base::TerminationStatus status) OVERRIDE;
// Callback method for WebContents::DownloadImage.
void DidDownloadFavicon(int id,
// NativeAppWindowDelegate implementation.
virtual void OnWindowDestroyed() OVERRIDE;
- void ApplyWindowDefaultParams(NativeAppWindow::CreateParams* params);
- void ApplyFullScreenParam(NativeAppWindow::CreateParams* params);
-
-#if defined(OS_TIZEN_MOBILE)
- void ApplyRootWindowParams(NativeAppWindow::CreateParams* params);
- void SetRootWindow(NativeAppWindow* window);
- void InitRootWindow();
-#endif
-
- // The browsing context.
- xwalk::RuntimeContext* runtime_context_;
-
// Notification manager.
content::NotificationRegistrar registrar_;
NativeAppWindow* window_;
-#if defined(OS_TIZEN_MOBILE)
- NativeAppWindow* root_window_;
-#endif
-
gfx::Image app_icon_;
base::WeakPtrFactory<Runtime> weak_ptr_factory_;
- // Fullscreen options.
- enum FullscreenOptions {
- NO_FULLSCREEN = 0,
- // Fullscreen entered by launch with "--fullscreen".
- FULLSCREEN_FOR_LAUNCH = 1,
- // Fullscreen entered by HTML requestFullscreen.
- FULLSCREEN_FOR_TAB = 1 << 1,
- };
-
unsigned int fullscreen_options_;
+ bool remote_debugging_enabled_;
Observer* observer_;
};