summaryrefslogtreecommitdiffstats
path: root/chrome/browser/ui/webui/test_web_dialog_delegate.cc
blob: 1a07b3b70061b286579c7567f5bfbe8032827f56 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "chrome/browser/ui/webui/test_web_dialog_delegate.h"

#include "base/utf_string_conversions.h"

using content::WebContents;
using content::WebUIMessageHandler;

namespace test {

TestWebDialogDelegate::TestWebDialogDelegate(const GURL& url)
    : url_(url),
      size_(400, 400) {
}

TestWebDialogDelegate::~TestWebDialogDelegate() {
}

ui::ModalType TestWebDialogDelegate::GetDialogModalType() const {
  return ui::MODAL_TYPE_WINDOW;
}

string16 TestWebDialogDelegate::GetDialogTitle() const {
  return UTF8ToUTF16("Test");
}

GURL TestWebDialogDelegate::GetDialogContentURL() const {
  return url_;
}

void TestWebDialogDelegate::GetWebUIMessageHandlers(
    std::vector<WebUIMessageHandler*>* handlers) const {
}

void TestWebDialogDelegate::GetDialogSize(gfx::Size* size) const {
  *size = size_;
}

std::string TestWebDialogDelegate::GetDialogArgs() const {
  return std::string();
}

void TestWebDialogDelegate::OnDialogClosed(const std::string& json_retval) {
}

void TestWebDialogDelegate::OnCloseContents(WebContents* source,
    bool* out_close_dialog) {
  if (out_close_dialog)
    *out_close_dialog = true;
}

bool TestWebDialogDelegate::ShouldShowDialogTitle() const {
  return true;
}

}  // namespace test