OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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/ui/webui/chromeos/mobile_setup_dialog.h" | 5 #include "chrome/browser/ui/webui/chromeos/mobile_setup_dialog.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/memory/singleton.h" | 8 #include "base/memory/singleton.h" |
9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
| 10 #include "chrome/browser/chromeos/login/webui_login_display_host.h" |
| 11 #include "chrome/browser/chromeos/login/webui_login_view.h" |
10 #include "chrome/browser/chromeos/mobile/mobile_activator.h" | 12 #include "chrome/browser/chromeos/mobile/mobile_activator.h" |
11 #include "chrome/browser/platform_util.h" | 13 #include "chrome/browser/platform_util.h" |
12 #include "chrome/browser/profiles/profile_manager.h" | 14 #include "chrome/browser/profiles/profile_manager.h" |
13 #include "chrome/browser/ui/browser_dialogs.h" | 15 #include "chrome/browser/ui/browser_dialogs.h" |
14 #include "chrome/browser/ui/simple_message_box.h" | 16 #include "chrome/browser/ui/simple_message_box.h" |
15 #include "chrome/common/url_constants.h" | 17 #include "chrome/common/url_constants.h" |
16 #include "content/public/browser/browser_thread.h" | 18 #include "content/public/browser/browser_thread.h" |
17 #include "grit/generated_resources.h" | 19 #include "grit/generated_resources.h" |
18 #include "ui/base/l10n/l10n_util.h" | 20 #include "ui/base/l10n/l10n_util.h" |
19 #include "ui/gfx/size.h" | 21 #include "ui/gfx/size.h" |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 | 88 |
87 MobileSetupDialogDelegate::MobileSetupDialogDelegate() : dialog_window_(NULL) { | 89 MobileSetupDialogDelegate::MobileSetupDialogDelegate() : dialog_window_(NULL) { |
88 } | 90 } |
89 | 91 |
90 MobileSetupDialogDelegate::~MobileSetupDialogDelegate() { | 92 MobileSetupDialogDelegate::~MobileSetupDialogDelegate() { |
91 MobileActivator::GetInstance()->RemoveObserver(this); | 93 MobileActivator::GetInstance()->RemoveObserver(this); |
92 } | 94 } |
93 | 95 |
94 void MobileSetupDialogDelegate::ShowDialog(const std::string& service_path) { | 96 void MobileSetupDialogDelegate::ShowDialog(const std::string& service_path) { |
95 service_path_ = service_path; | 97 service_path_ = service_path; |
| 98 |
| 99 gfx::NativeWindow parent = NULL; |
| 100 // If we're on the login screen. |
| 101 if (chromeos::WebUILoginDisplayHost::default_host()) { |
| 102 chromeos::WebUILoginDisplayHost* webui_host = |
| 103 static_cast<chromeos::WebUILoginDisplayHost*>( |
| 104 chromeos::WebUILoginDisplayHost::default_host()); |
| 105 chromeos::WebUILoginView* login_view = webui_host->login_view(); |
| 106 if (login_view) |
| 107 parent = login_view->GetNativeWindow(); |
| 108 } |
| 109 |
96 dialog_window_ = chrome::ShowWebDialog( | 110 dialog_window_ = chrome::ShowWebDialog( |
97 NULL, | 111 parent, |
98 ProfileManager::GetDefaultProfileOrOffTheRecord(), | 112 ProfileManager::GetDefaultProfileOrOffTheRecord(), |
99 this); | 113 this); |
100 } | 114 } |
101 | 115 |
102 ui::ModalType MobileSetupDialogDelegate::GetDialogModalType() const { | 116 ui::ModalType MobileSetupDialogDelegate::GetDialogModalType() const { |
103 return ui::MODAL_TYPE_SYSTEM; | 117 return ui::MODAL_TYPE_SYSTEM; |
104 } | 118 } |
105 | 119 |
106 string16 MobileSetupDialogDelegate::GetDialogTitle() const { | 120 string16 MobileSetupDialogDelegate::GetDialogTitle() const { |
107 return l10n_util::GetStringUTF16(IDS_MOBILE_SETUP_TITLE); | 121 return l10n_util::GetStringUTF16(IDS_MOBILE_SETUP_TITLE); |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 bool MobileSetupDialogDelegate::HandleContextMenu( | 170 bool MobileSetupDialogDelegate::HandleContextMenu( |
157 const content::ContextMenuParams& params) { | 171 const content::ContextMenuParams& params) { |
158 return true; | 172 return true; |
159 } | 173 } |
160 | 174 |
161 void MobileSetupDialogDelegate::OnActivationStateChanged( | 175 void MobileSetupDialogDelegate::OnActivationStateChanged( |
162 CellularNetwork* network, | 176 CellularNetwork* network, |
163 MobileActivator::PlanActivationState state, | 177 MobileActivator::PlanActivationState state, |
164 const std::string& error_description) { | 178 const std::string& error_description) { |
165 } | 179 } |
OLD | NEW |