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