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" |
11 #include "base/command_line.h" | 11 #include "base/command_line.h" |
12 #include "base/i18n/rtl.h" | 12 #include "base/i18n/rtl.h" |
13 #include "base/utf_string_conversions.h" | 13 #include "base/utf_string_conversions.h" |
14 #include "base/values.h" | 14 #include "base/values.h" |
15 #include "chrome/browser/chromeos/accessibility/accessibility_util.h" | 15 #include "chrome/browser/chromeos/accessibility/accessibility_util.h" |
16 #include "chrome/browser/chromeos/cros/cros_library.h" | 16 #include "chrome/browser/chromeos/cros/cros_library.h" |
17 #include "chrome/browser/chromeos/login/base_login_display_host.h" | 17 #include "chrome/browser/chromeos/login/base_login_display_host.h" |
18 #include "chrome/browser/chromeos/login/proxy_settings_dialog.h" | 18 #include "chrome/browser/chromeos/login/proxy_settings_dialog.h" |
19 #include "chrome/browser/chromeos/login/webui_login_display.h" | 19 #include "chrome/browser/chromeos/login/webui_login_display.h" |
20 #include "chrome/browser/media/media_stream_devices_controller.h" | |
21 #include "chrome/browser/password_manager/password_manager.h" | 20 #include "chrome/browser/password_manager/password_manager.h" |
22 #include "chrome/browser/password_manager/password_manager_delegate_impl.h" | 21 #include "chrome/browser/password_manager/password_manager_delegate_impl.h" |
23 #include "chrome/browser/profiles/profile_manager.h" | 22 #include "chrome/browser/profiles/profile_manager.h" |
24 #include "chrome/browser/renderer_preferences_util.h" | 23 #include "chrome/browser/renderer_preferences_util.h" |
| 24 #include "chrome/browser/ui/media_stream_infobar_delegate.h" |
25 #include "chrome/browser/ui/web_contents_modal_dialog_manager.h" | 25 #include "chrome/browser/ui/web_contents_modal_dialog_manager.h" |
26 #include "chrome/browser/ui/webui/chromeos/login/oobe_ui.h" | 26 #include "chrome/browser/ui/webui/chromeos/login/oobe_ui.h" |
27 #include "chrome/common/chrome_notification_types.h" | 27 #include "chrome/common/chrome_notification_types.h" |
28 #include "chrome/common/chrome_switches.h" | 28 #include "chrome/common/chrome_switches.h" |
29 #include "chrome/common/render_messages.h" | 29 #include "chrome/common/render_messages.h" |
30 #include "chromeos/dbus/dbus_thread_manager.h" | 30 #include "chromeos/dbus/dbus_thread_manager.h" |
31 #include "chromeos/dbus/session_manager_client.h" | 31 #include "chromeos/dbus/session_manager_client.h" |
32 #include "content/public/browser/notification_service.h" | 32 #include "content/public/browser/notification_service.h" |
33 #include "content/public/browser/render_view_host.h" | 33 #include "content/public/browser/render_view_host.h" |
34 #include "content/public/browser/render_view_host_observer.h" | 34 #include "content/public/browser/render_view_host_observer.h" |
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
343 ash::Shell::FORWARD); | 343 ash::Shell::FORWARD); |
344 } | 344 } |
345 | 345 |
346 return true; | 346 return true; |
347 } | 347 } |
348 | 348 |
349 void WebUILoginView::RequestMediaAccessPermission( | 349 void WebUILoginView::RequestMediaAccessPermission( |
350 WebContents* web_contents, | 350 WebContents* web_contents, |
351 const content::MediaStreamRequest& request, | 351 const content::MediaStreamRequest& request, |
352 const content::MediaResponseCallback& callback) { | 352 const content::MediaResponseCallback& callback) { |
353 Profile* profile = | 353 if (MediaStreamInfoBarDelegate::Create(web_contents, request, callback)) |
354 Profile::FromBrowserContext(web_contents->GetBrowserContext()); | |
355 | |
356 scoped_ptr<MediaStreamDevicesController> controller( | |
357 new MediaStreamDevicesController(profile, request, callback)); | |
358 if (!controller->DismissInfoBarAndTakeActionOnSettings()) | |
359 NOTREACHED() << "Media stream not allowed for WebUI"; | 354 NOTREACHED() << "Media stream not allowed for WebUI"; |
360 } | 355 } |
361 | 356 |
362 void WebUILoginView::OnLoginPromptVisible() { | 357 void WebUILoginView::OnLoginPromptVisible() { |
363 // If we're hidden than will generate this signal once we're shown. | 358 // If we're hidden than will generate this signal once we're shown. |
364 if (is_hidden_ || login_prompt_visible_handled_) { | 359 if (is_hidden_ || login_prompt_visible_handled_) { |
365 LOG(INFO) << "Login WebUI >> not emitting signal, hidden: " << is_hidden_; | 360 LOG(INFO) << "Login WebUI >> not emitting signal, hidden: " << is_hidden_; |
366 return; | 361 return; |
367 } | 362 } |
368 | 363 |
369 if (should_emit_login_prompt_visible_) { | 364 if (should_emit_login_prompt_visible_) { |
370 LOG(INFO) << "Login WebUI >> login-prompt-visible"; | 365 LOG(INFO) << "Login WebUI >> login-prompt-visible"; |
371 chromeos::DBusThreadManager::Get()->GetSessionManagerClient()-> | 366 chromeos::DBusThreadManager::Get()->GetSessionManagerClient()-> |
372 EmitLoginPromptVisible(); | 367 EmitLoginPromptVisible(); |
373 } | 368 } |
374 login_prompt_visible_handled_ = true; | 369 login_prompt_visible_handled_ = true; |
375 | 370 |
376 // Let RenderWidgetHostViewAura::OnPaint() show white background when | 371 // Let RenderWidgetHostViewAura::OnPaint() show white background when |
377 // loading page and when backing store is not present. | 372 // loading page and when backing store is not present. |
378 aura::Env::GetInstance()->set_render_white_bg(true); | 373 aura::Env::GetInstance()->set_render_white_bg(true); |
379 } | 374 } |
380 | 375 |
381 void WebUILoginView::ReturnFocus(bool reverse) { | 376 void WebUILoginView::ReturnFocus(bool reverse) { |
382 // Return the focus to the web contents. | 377 // Return the focus to the web contents. |
383 webui_login_->web_contents()->FocusThroughTabTraversal(reverse); | 378 webui_login_->web_contents()->FocusThroughTabTraversal(reverse); |
384 GetWidget()->Activate(); | 379 GetWidget()->Activate(); |
385 } | 380 } |
386 | 381 |
387 } // namespace chromeos | 382 } // namespace chromeos |
OLD | NEW |