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.
5 #ifndef ASH_KEYBOARD_OVERLAY_KEYBOARD_OVERLAY_DELEGATE_H_
6 #define ASH_KEYBOARD_OVERLAY_KEYBOARD_OVERLAY_DELEGATE_H_
8 #include "ash/content_support/ash_with_content_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"
22 // Delegate to handle showing the keyboard overlay drawing. Exported for test.
23 class ASH_WITH_CONTENT_EXPORT KeyboardOverlayDelegate
24 : public ui::WebDialogDelegate
{
26 KeyboardOverlayDelegate(const base::string16
& title
, const GURL
& url
);
28 // Shows the keyboard overlay widget. Returns the widget for testing.
29 views::Widget
* Show(views::WebDialogView
* view
);
31 // Overridden from ui::WebDialogDelegate:
32 void GetDialogSize(gfx::Size
* size
) const override
;
35 FRIEND_TEST_ALL_PREFIXES(KeyboardOverlayDelegateTest
, ShowAndClose
);
37 ~KeyboardOverlayDelegate() override
;
39 // Overridden from ui::WebDialogDelegate:
40 ui::ModalType
GetDialogModalType() const override
;
41 base::string16
GetDialogTitle() const override
;
42 GURL
GetDialogContentURL() const override
;
43 void GetWebUIMessageHandlers(
44 std::vector
<content::WebUIMessageHandler
*>* handlers
) const override
;
45 std::string
GetDialogArgs() const override
;
46 void OnDialogClosed(const std::string
& json_retval
) override
;
47 void OnCloseContents(content::WebContents
* source
,
48 bool* out_close_dialog
) override
;
49 bool ShouldShowDialogTitle() const override
;
50 bool HandleContextMenu(const content::ContextMenuParams
& params
) override
;
53 base::string16 title_
;
55 // The URL of the keyboard overlay.
58 // The widget associated with this delegate. Not owned.
59 views::Widget
* widget_
;
61 DISALLOW_COPY_AND_ASSIGN(KeyboardOverlayDelegate
);
66 #endif // ASH_KEYBOARD_OVERLAY_KEYBOARD_OVERLAY_DELEGATE_H_