- add sources.
[platform/framework/web/crosswalk.git] / src / ash / keyboard_overlay / keyboard_overlay_delegate.h
1 // Copyright (c) 2012 The Chromium Authors. 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 ASH_KEYBOARD_OVERLAY_KEYBOARD_OVERLAY_DELEGATE_H_
6 #define ASH_KEYBOARD_OVERLAY_KEYBOARD_OVERLAY_DELEGATE_H_
7
8 #include "ash/ash_export.h"
9 #include "base/basictypes.h"
10 #include "base/compiler_specific.h"
11 #include "base/gtest_prod_util.h"
12 #include "ui/web_dialogs/web_dialog_delegate.h"
13 #include "url/gurl.h"
14
15 namespace views {
16 class WebDialogView;
17 class Widget;
18 }
19
20 namespace ash {
21
22 // Delegate to handle showing the keyboard overlay drawing. Exported for test.
23 class ASH_EXPORT KeyboardOverlayDelegate : public ui::WebDialogDelegate {
24  public:
25   KeyboardOverlayDelegate(const base::string16& title, const GURL& url);
26
27   // Shows the keyboard overlay widget. Returns the widget for testing.
28   views::Widget* Show(views::WebDialogView* view);
29
30   // Overridden from ui::WebDialogDelegate:
31   virtual void GetDialogSize(gfx::Size* size) const OVERRIDE;
32
33  private:
34   FRIEND_TEST_ALL_PREFIXES(KeyboardOverlayDelegateTest, ShowAndClose);
35
36   virtual ~KeyboardOverlayDelegate();
37
38   // Overridden from ui::WebDialogDelegate:
39   virtual ui::ModalType GetDialogModalType() const OVERRIDE;
40   virtual base::string16 GetDialogTitle() const OVERRIDE;
41   virtual GURL GetDialogContentURL() const OVERRIDE;
42   virtual void GetWebUIMessageHandlers(
43       std::vector<content::WebUIMessageHandler*>* handlers) const OVERRIDE;
44   virtual std::string GetDialogArgs() const OVERRIDE;
45   virtual void OnDialogClosed(const std::string& json_retval) OVERRIDE;
46   virtual void OnCloseContents(content::WebContents* source,
47                                bool* out_close_dialog) OVERRIDE;
48   virtual bool ShouldShowDialogTitle() const OVERRIDE;
49   virtual bool HandleContextMenu(
50       const content::ContextMenuParams& params) OVERRIDE;
51
52   // The dialog title.
53   base::string16 title_;
54
55   // The URL of the keyboard overlay.
56   GURL url_;
57
58   // The widget associated with this delegate. Not owned.
59   views::Widget* widget_;
60
61   DISALLOW_COPY_AND_ASSIGN(KeyboardOverlayDelegate);
62 };
63
64 }  // namespace ash
65
66 #endif  // ASH_KEYBOARD_OVERLAY_KEYBOARD_OVERLAY_DELEGATE_H_