| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/chromeos/choose_mobile_network_dialog.h" | 5 #include "chrome/browser/chromeos/choose_mobile_network_dialog.h" |
| 6 | 6 |
| 7 #include "chrome/browser/chromeos/frame/bubble_window.h" | |
| 8 #include "chrome/browser/chromeos/login/user_manager.h" | 7 #include "chrome/browser/chromeos/login/user_manager.h" |
| 9 #include "chrome/browser/profiles/profile_manager.h" | 8 #include "chrome/browser/profiles/profile_manager.h" |
| 10 #include "chrome/browser/ui/browser.h" | 9 #include "chrome/browser/ui/browser.h" |
| 10 #include "chrome/browser/ui/browser_dialogs.h" |
| 11 #include "chrome/browser/ui/browser_list.h" | 11 #include "chrome/browser/ui/browser_list.h" |
| 12 #include "chrome/browser/ui/views/html_dialog_view.h" | 12 #include "chrome/browser/ui/views/html_dialog_view.h" |
| 13 #include "chrome/common/url_constants.h" | 13 #include "chrome/common/url_constants.h" |
| 14 #include "ui/views/view.h" | |
| 15 #include "ui/views/widget/widget.h" | |
| 16 | 14 |
| 17 namespace { | 15 namespace { |
| 18 | 16 |
| 19 // Default width/height of the dialog. | 17 // Default width/height of the dialog. |
| 20 const int kDefaultWidth = 350; | 18 const int kDefaultWidth = 350; |
| 21 const int kDefaultHeight = 225; | 19 const int kDefaultHeight = 225; |
| 22 | 20 |
| 23 } // namespace | 21 } // namespace |
| 24 | 22 |
| 25 namespace chromeos { | 23 namespace chromeos { |
| 26 | 24 |
| 27 // static | 25 // static |
| 28 void ChooseMobileNetworkDialog::ShowDialog(gfx::NativeWindow owning_window) { | 26 void ChooseMobileNetworkDialog::ShowDialog(gfx::NativeWindow owning_window) { |
| 29 Profile* profile; | 27 Profile* profile; |
| 30 if (UserManager::Get()->user_is_logged_in()) { | 28 if (UserManager::Get()->user_is_logged_in()) { |
| 31 Browser* browser = BrowserList::GetLastActive(); | 29 Browser* browser = BrowserList::GetLastActive(); |
| 32 DCHECK(browser); | 30 DCHECK(browser); |
| 33 profile = browser->profile(); | 31 profile = browser->profile(); |
| 34 } else { | 32 } else { |
| 35 profile = ProfileManager::GetDefaultProfile(); | 33 profile = ProfileManager::GetDefaultProfile(); |
| 36 } | 34 } |
| 37 HtmlDialogView* html_view = | 35 HtmlDialogView* html_view = |
| 38 new HtmlDialogView(profile, new ChooseMobileNetworkDialog); | 36 new HtmlDialogView(profile, new ChooseMobileNetworkDialog); |
| 39 html_view->InitDialog(); | 37 browser::ShowHtmlDialog(owning_window, profile, html_view, STYLE_FLUSH); |
| 40 BubbleWindow::Create(owning_window, STYLE_FLUSH, html_view); | |
| 41 html_view->GetWidget()->Show(); | |
| 42 } | 38 } |
| 43 | 39 |
| 44 ChooseMobileNetworkDialog::ChooseMobileNetworkDialog() { | 40 ChooseMobileNetworkDialog::ChooseMobileNetworkDialog() { |
| 45 } | 41 } |
| 46 | 42 |
| 47 bool ChooseMobileNetworkDialog::IsDialogModal() const { | 43 bool ChooseMobileNetworkDialog::IsDialogModal() const { |
| 48 return true; | 44 return true; |
| 49 } | 45 } |
| 50 | 46 |
| 51 string16 ChooseMobileNetworkDialog::GetDialogTitle() const { | 47 string16 ChooseMobileNetworkDialog::GetDialogTitle() const { |
| (...skipping 30 matching lines...) Expand all Loading... |
| 82 return false; | 78 return false; |
| 83 } | 79 } |
| 84 | 80 |
| 85 bool ChooseMobileNetworkDialog::HandleContextMenu( | 81 bool ChooseMobileNetworkDialog::HandleContextMenu( |
| 86 const ContextMenuParams& params) { | 82 const ContextMenuParams& params) { |
| 87 // Disable context menu. | 83 // Disable context menu. |
| 88 return true; | 84 return true; |
| 89 } | 85 } |
| 90 | 86 |
| 91 } // namespace chromeos | 87 } // namespace chromeos |
| OLD | NEW |