1 // Copyright (c) 2014 Intel Corporation. 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 XWALK_RUNTIME_BROWSER_RUNTIME_UI_DELEGATE_H_
6 #define XWALK_RUNTIME_BROWSER_RUNTIME_UI_DELEGATE_H_
8 #include "base/memory/scoped_ptr.h"
9 #include "xwalk/runtime/browser/ui/native_app_window.h"
14 class RuntimeUIDelegate {
16 virtual ~RuntimeUIDelegate() {}
17 virtual void Show() = 0;
18 virtual void UpdateTitle(const base::string16& text) = 0;
19 virtual void UpdateIcon(const gfx::Image& image) = 0;
20 virtual void SetFullscreen(bool enter_fullscreen) = 0;
21 virtual void Close() = 0;
22 virtual void DeleteDelegate() = 0;
25 // The default implementation displays WebContents in a separate window.
26 class DefaultRuntimeUIDelegate : public RuntimeUIDelegate,
27 public NativeAppWindowDelegate {
29 static RuntimeUIDelegate* Create(
31 const NativeAppWindow::CreateParams& params =
32 NativeAppWindow::CreateParams());
33 virtual ~DefaultRuntimeUIDelegate();
35 NativeAppWindow* window() { return window_; }
38 DefaultRuntimeUIDelegate(Runtime* runtime,
39 const NativeAppWindow::CreateParams& params);
41 virtual void Show() override;
42 virtual void UpdateTitle(const base::string16& text) override;
43 virtual void UpdateIcon(const gfx::Image& image) override;
44 virtual void SetFullscreen(bool enter_fullscreen) override;
45 virtual void Close() override;
46 virtual void DeleteDelegate() override;
47 // NativeAppWindowDelegate
48 virtual void OnWindowDestroyed() override;
52 NativeAppWindow::CreateParams window_params_;
53 NativeAppWindow* window_;
59 #endif // XWALK_RUNTIME_BROWSER_RUNTIME_UI_DELEGATE_H_