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 UI_WEB_DIALOGS_TEST_TEST_WEB_DIALOG_DELEGATE_H_
6 #define UI_WEB_DIALOGS_TEST_TEST_WEB_DIALOG_DELEGATE_H_
10 #include "base/compiler_specific.h"
11 #include "ui/gfx/geometry/size.h"
12 #include "ui/web_dialogs/web_dialog_delegate.h"
18 class TestWebDialogDelegate
: public WebDialogDelegate
{
20 explicit TestWebDialogDelegate(const GURL
& url
);
21 ~TestWebDialogDelegate() override
;
23 void set_size(int width
, int height
) {
24 size_
.SetSize(width
, height
);
27 // Sets the test delegate to delete when closed, as recommended by
28 // WebDialogDelegate::OnDialogClosed(). |observed_destroy| must be a pointer
29 // to a bool, which will be set to true when the destructor is called.
30 void SetDeleteOnClosedAndObserve(bool* destroy_observer
);
32 // WebDialogDelegate implementation:
33 ModalType
GetDialogModalType() const override
;
34 base::string16
GetDialogTitle() const override
;
35 GURL
GetDialogContentURL() const override
;
36 void GetWebUIMessageHandlers(
37 std::vector
<content::WebUIMessageHandler
*>* handlers
) const override
;
38 void GetDialogSize(gfx::Size
* size
) const override
;
39 std::string
GetDialogArgs() const override
;
40 void OnDialogClosed(const std::string
& json_retval
) override
;
41 void OnCloseContents(content::WebContents
* source
,
42 bool* out_close_dialog
) override
;
43 bool ShouldShowDialogTitle() const override
;
50 DISALLOW_COPY_AND_ASSIGN(TestWebDialogDelegate
);
56 #endif // UI_WEB_DIALOGS_TEST_TEST_WEB_DIALOG_DELEGATE_H_