| 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/chromeos/login/webui_login_view.h" | 5 #include "chrome/browser/chromeos/login/webui_login_view.h" |
| 6 | 6 |
| 7 #include "ash/shell.h" | 7 #include "ash/shell.h" |
| 8 #include "ash/system/tray/system_tray.h" | 8 #include "ash/system/tray/system_tray.h" |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 kAccelNameVersion; | 135 kAccelNameVersion; |
| 136 accel_map_[ui::Accelerator(ui::VKEY_R, | 136 accel_map_[ui::Accelerator(ui::VKEY_R, |
| 137 ui::EF_CONTROL_DOWN | ui::EF_ALT_DOWN | ui::EF_SHIFT_DOWN)] = | 137 ui::EF_CONTROL_DOWN | ui::EF_ALT_DOWN | ui::EF_SHIFT_DOWN)] = |
| 138 kAccelNameReset; | 138 kAccelNameReset; |
| 139 | 139 |
| 140 for (AccelMap::iterator i(accel_map_.begin()); i != accel_map_.end(); ++i) | 140 for (AccelMap::iterator i(accel_map_.begin()); i != accel_map_.end(); ++i) |
| 141 AddAccelerator(i->first); | 141 AddAccelerator(i->first); |
| 142 } | 142 } |
| 143 | 143 |
| 144 WebUILoginView::~WebUILoginView() { | 144 WebUILoginView::~WebUILoginView() { |
| 145 if (ash::Shell::GetInstance()->status_area_widget()) | 145 if (ash::Shell::GetInstance()->HasPrimaryStatusArea()) { |
| 146 ash::Shell::GetInstance()->system_tray()->SetNextFocusableView(NULL); | 146 ash::Shell::GetInstance()->GetPrimarySystemTray()-> |
| 147 SetNextFocusableView(NULL); |
| 148 } |
| 147 } | 149 } |
| 148 | 150 |
| 149 void WebUILoginView::Init(views::Widget* login_window) { | 151 void WebUILoginView::Init(views::Widget* login_window) { |
| 150 login_window_ = login_window; | 152 login_window_ = login_window; |
| 151 webui_login_ = new views::WebView(ProfileManager::GetDefaultProfile()); | 153 webui_login_ = new views::WebView(ProfileManager::GetDefaultProfile()); |
| 152 AddChildView(webui_login_); | 154 AddChildView(webui_login_); |
| 153 | 155 |
| 154 WebContents* web_contents = webui_login_->GetWebContents(); | 156 WebContents* web_contents = webui_login_->GetWebContents(); |
| 155 | 157 |
| 156 // Create the password manager that is needed for the proxy. | 158 // Create the password manager that is needed for the proxy. |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 235 new ProxySettingsDialog(NULL, GetNativeWindow()); | 237 new ProxySettingsDialog(NULL, GetNativeWindow()); |
| 236 dialog->Show(); | 238 dialog->Show(); |
| 237 } | 239 } |
| 238 | 240 |
| 239 void WebUILoginView::OnPostponedShow() { | 241 void WebUILoginView::OnPostponedShow() { |
| 240 set_is_hidden(false); | 242 set_is_hidden(false); |
| 241 OnLoginPromptVisible(); | 243 OnLoginPromptVisible(); |
| 242 } | 244 } |
| 243 | 245 |
| 244 void WebUILoginView::SetStatusAreaVisible(bool visible) { | 246 void WebUILoginView::SetStatusAreaVisible(bool visible) { |
| 245 if (ash::Shell::GetInstance()->status_area_widget()) { | 247 if (ash::Shell::GetInstance()->HasPrimaryStatusArea()) { |
| 246 ash::SystemTray* tray = ash::Shell::GetInstance()->system_tray(); | 248 ash::SystemTray* tray = ash::Shell::GetInstance()->GetPrimarySystemTray(); |
| 247 if (visible) { | 249 if (visible) { |
| 248 // Tray may have been initialized being hidden. | 250 // Tray may have been initialized being hidden. |
| 249 tray->SetVisible(visible); | 251 tray->SetVisible(visible); |
| 250 tray->GetWidget()->Show(); | 252 tray->GetWidget()->Show(); |
| 251 } else { | 253 } else { |
| 252 tray->GetWidget()->Hide(); | 254 tray->GetWidget()->Hide(); |
| 253 } | 255 } |
| 254 } | 256 } |
| 255 } | 257 } |
| 256 | 258 |
| 257 void WebUILoginView::SetUIEnabled(bool enabled) { | 259 void WebUILoginView::SetUIEnabled(bool enabled) { |
| 258 forward_keyboard_event_ = enabled; | 260 forward_keyboard_event_ = enabled; |
| 259 ash::Shell::GetInstance()->system_tray()->SetEnabled(enabled); | 261 ash::Shell::GetInstance()->GetPrimarySystemTray()->SetEnabled(enabled); |
| 260 } | 262 } |
| 261 | 263 |
| 262 // WebUILoginView protected: --------------------------------------------------- | 264 // WebUILoginView protected: --------------------------------------------------- |
| 263 | 265 |
| 264 void WebUILoginView::Layout() { | 266 void WebUILoginView::Layout() { |
| 265 DCHECK(webui_login_); | 267 DCHECK(webui_login_); |
| 266 webui_login_->SetBoundsRect(bounds()); | 268 webui_login_->SetBoundsRect(bounds()); |
| 267 } | 269 } |
| 268 | 270 |
| 269 void WebUILoginView::OnLocaleChanged() { | 271 void WebUILoginView::OnLocaleChanged() { |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 327 if (web_ui) | 329 if (web_ui) |
| 328 web_ui->CallJavascriptFunction("cr.ui.Oobe.clearErrors"); | 330 web_ui->CallJavascriptFunction("cr.ui.Oobe.clearErrors"); |
| 329 } | 331 } |
| 330 } | 332 } |
| 331 | 333 |
| 332 bool WebUILoginView::IsPopupOrPanel(const WebContents* source) const { | 334 bool WebUILoginView::IsPopupOrPanel(const WebContents* source) const { |
| 333 return true; | 335 return true; |
| 334 } | 336 } |
| 335 | 337 |
| 336 bool WebUILoginView::TakeFocus(content::WebContents* source, bool reverse) { | 338 bool WebUILoginView::TakeFocus(content::WebContents* source, bool reverse) { |
| 337 ash::SystemTray* tray = ash::Shell::GetInstance()->system_tray(); | 339 ash::SystemTray* tray = ash::Shell::GetInstance()->GetPrimarySystemTray(); |
| 338 if (tray && tray->GetWidget()->IsVisible()) { | 340 if (tray && tray->GetWidget()->IsVisible()) { |
| 339 tray->SetNextFocusableView(this); | 341 tray->SetNextFocusableView(this); |
| 340 ash::Shell::GetInstance()->RotateFocus(reverse ? ash::Shell::BACKWARD : | 342 ash::Shell::GetInstance()->RotateFocus(reverse ? ash::Shell::BACKWARD : |
| 341 ash::Shell::FORWARD); | 343 ash::Shell::FORWARD); |
| 342 } | 344 } |
| 343 | 345 |
| 344 return true; | 346 return true; |
| 345 } | 347 } |
| 346 | 348 |
| 347 void WebUILoginView::RequestMediaAccessPermission( | 349 void WebUILoginView::RequestMediaAccessPermission( |
| (...skipping 28 matching lines...) Expand all Loading... |
| 376 aura::Env::GetInstance()->set_render_white_bg(true); | 378 aura::Env::GetInstance()->set_render_white_bg(true); |
| 377 } | 379 } |
| 378 | 380 |
| 379 void WebUILoginView::ReturnFocus(bool reverse) { | 381 void WebUILoginView::ReturnFocus(bool reverse) { |
| 380 // Return the focus to the web contents. | 382 // Return the focus to the web contents. |
| 381 webui_login_->web_contents()->FocusThroughTabTraversal(reverse); | 383 webui_login_->web_contents()->FocusThroughTabTraversal(reverse); |
| 382 GetWidget()->Activate(); | 384 GetWidget()->Activate(); |
| 383 } | 385 } |
| 384 | 386 |
| 385 } // namespace chromeos | 387 } // namespace chromeos |
| OLD | NEW |