1// Copyright 2014 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#include "chrome/browser/chromeos/ui/choose_mobile_network_dialog.h"
6
7#include "chrome/browser/profiles/profile_manager.h"
8#include "chrome/browser/ui/browser_dialogs.h"
9#include "chrome/common/url_constants.h"
10#include "ui/gfx/size.h"
11
12using content::WebContents;
13using content::WebUIMessageHandler;
14
15namespace {
16
17// Default width/height of the dialog.
18const int kDefaultWidth = 350;
19const int kDefaultHeight = 225;
20
21}  // namespace
22
23namespace chromeos {
24
25// static
26void ChooseMobileNetworkDialog::ShowDialog(gfx::NativeWindow owning_window) {
27  chrome::ShowWebDialog(owning_window,
28                        ProfileManager::GetActiveUserProfile(),
29                        new ChooseMobileNetworkDialog);
30}
31
32ChooseMobileNetworkDialog::ChooseMobileNetworkDialog() {
33}
34
35ui::ModalType ChooseMobileNetworkDialog::GetDialogModalType() const {
36  return ui::MODAL_TYPE_SYSTEM;
37}
38
39base::string16 ChooseMobileNetworkDialog::GetDialogTitle() const {
40  return base::string16();
41}
42
43GURL ChooseMobileNetworkDialog::GetDialogContentURL() const {
44  return GURL(chrome::kChromeUIChooseMobileNetworkURL);
45}
46
47void ChooseMobileNetworkDialog::GetWebUIMessageHandlers(
48    std::vector<WebUIMessageHandler*>* handlers) const {
49}
50
51void ChooseMobileNetworkDialog::GetDialogSize(gfx::Size* size) const {
52  size->SetSize(kDefaultWidth, kDefaultHeight);
53}
54
55std::string ChooseMobileNetworkDialog::GetDialogArgs() const {
56  return "[]";
57}
58
59void ChooseMobileNetworkDialog::OnDialogClosed(const std::string& json_retval) {
60  delete this;
61}
62
63void ChooseMobileNetworkDialog::OnCloseContents(WebContents* source,
64                                                bool* out_close_dialog) {
65  if (out_close_dialog)
66    *out_close_dialog = true;
67}
68
69bool ChooseMobileNetworkDialog::ShouldShowDialogTitle() const {
70  return false;
71}
72
73bool ChooseMobileNetworkDialog::HandleContextMenu(
74    const content::ContextMenuParams& params) {
75  // Disable context menu.
76  return true;
77}
78
79}  // namespace chromeos
80