Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / ui / web_dialogs / test / test_web_dialog_delegate.h
blobbcfa424366fb6e577bfeb769627be6d1ab4c0bce
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_
8 #include <string>
10 #include "base/compiler_specific.h"
11 #include "ui/gfx/geometry/size.h"
12 #include "ui/web_dialogs/web_dialog_delegate.h"
13 #include "url/gurl.h"
15 namespace ui {
16 namespace test {
18 class TestWebDialogDelegate : public WebDialogDelegate {
19 public:
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;
45 protected:
46 const GURL url_;
47 gfx::Size size_;
48 bool* did_delete_;
50 DISALLOW_COPY_AND_ASSIGN(TestWebDialogDelegate);
53 } // namespace test
54 } // namespace ui
56 #endif // UI_WEB_DIALOGS_TEST_TEST_WEB_DIALOG_DELEGATE_H_