Upstream version 11.39.256.0
[platform/framework/web/crosswalk.git] / src / xwalk / runtime / browser / runtime_ui_delegate.h
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.
4
5 #ifndef XWALK_RUNTIME_BROWSER_RUNTIME_UI_DELEGATE_H_
6 #define XWALK_RUNTIME_BROWSER_RUNTIME_UI_DELEGATE_H_
7
8 #include "base/memory/scoped_ptr.h"
9 #include "xwalk/runtime/browser/ui/native_app_window.h"
10
11 namespace xwalk {
12 class Runtime;
13
14 class RuntimeUIDelegate {
15  public:
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;
23 };
24
25 // The default implementation displays WebContents in a separate window.
26 class DefaultRuntimeUIDelegate : public RuntimeUIDelegate,
27                                  public NativeAppWindowDelegate {
28  public:
29   static RuntimeUIDelegate* Create(
30       Runtime* runtime,
31       const NativeAppWindow::CreateParams& params =
32           NativeAppWindow::CreateParams());
33   virtual ~DefaultRuntimeUIDelegate();
34
35   NativeAppWindow* window() { return window_; }
36
37  private:
38   DefaultRuntimeUIDelegate(Runtime* runtime,
39                            const NativeAppWindow::CreateParams& params);
40   // RuntimeUIDelegate
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;
49
50  private:
51   Runtime* runtime_;
52   NativeAppWindow::CreateParams window_params_;
53   NativeAppWindow* window_;
54 };
55
56
57 }  // namespace xwalk
58
59 #endif  // XWALK_RUNTIME_BROWSER_RUNTIME_UI_DELEGATE_H_