| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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/ui/webui_login_view.h" | 5 #include "chrome/browser/chromeos/login/ui/webui_login_view.h" |
| 6 | 6 |
| 7 #include "ash/common/focus_cycler.h" | 7 #include "ash/common/focus_cycler.h" |
| 8 #include "ash/common/system/status_area_widget_delegate.h" | 8 #include "ash/common/system/status_area_widget_delegate.h" |
| 9 #include "ash/common/system/tray/system_tray.h" | 9 #include "ash/common/system/tray/system_tray.h" |
| 10 #include "ash/common/wm_shell.h" | 10 #include "ash/common/wm_shell.h" |
| 11 #include "ash/shell.h" | 11 #include "ash/shell.h" |
| 12 #include "base/bind.h" | 12 #include "base/bind.h" |
| 13 #include "base/callback.h" | 13 #include "base/callback.h" |
| 14 #include "base/i18n/rtl.h" | 14 #include "base/i18n/rtl.h" |
| 15 #include "base/logging.h" | 15 #include "base/logging.h" |
| 16 #include "base/macros.h" | 16 #include "base/macros.h" |
| 17 #include "base/strings/utf_string_conversions.h" | 17 #include "base/strings/utf_string_conversions.h" |
| 18 #include "base/trace_event/trace_event.h" | 18 #include "base/trace_event/trace_event.h" |
| 19 #include "base/values.h" | 19 #include "base/values.h" |
| 20 #include "chrome/browser/chrome_notification_types.h" | 20 #include "chrome/browser/chrome_notification_types.h" |
| 21 #include "chrome/browser/chromeos/accessibility/accessibility_util.h" | 21 #include "chrome/browser/chromeos/accessibility/accessibility_util.h" |
| 22 #include "chrome/browser/chromeos/app_mode/kiosk_app_manager.h" | 22 #include "chrome/browser/chromeos/app_mode/kiosk_app_manager.h" |
| 23 #include "chrome/browser/chromeos/login/ui/login_display_host_impl.h" | 23 #include "chrome/browser/chromeos/login/ui/login_display_host_impl.h" |
| 24 #include "chrome/browser/chromeos/login/ui/proxy_settings_dialog.h" | 24 #include "chrome/browser/chromeos/login/ui/proxy_settings_dialog.h" |
| 25 #include "chrome/browser/chromeos/login/ui/shared_web_view.h" | 25 #include "chrome/browser/chromeos/login/ui/shared_web_view.h" |
| 26 #include "chrome/browser/chromeos/login/ui/shared_web_view_factory.h" | 26 #include "chrome/browser/chromeos/login/ui/shared_web_view_factory.h" |
| 27 #include "chrome/browser/chromeos/login/ui/web_contents_forced_title.h" |
| 27 #include "chrome/browser/chromeos/login/ui/web_contents_set_background_color.h" | 28 #include "chrome/browser/chromeos/login/ui/web_contents_set_background_color.h" |
| 28 #include "chrome/browser/chromeos/login/ui/web_view_handle.h" | 29 #include "chrome/browser/chromeos/login/ui/web_view_handle.h" |
| 29 #include "chrome/browser/chromeos/login/ui/webui_login_display.h" | 30 #include "chrome/browser/chromeos/login/ui/webui_login_display.h" |
| 30 #include "chrome/browser/chromeos/profiles/profile_helper.h" | 31 #include "chrome/browser/chromeos/profiles/profile_helper.h" |
| 31 #include "chrome/browser/chromeos/settings/cros_settings.h" | 32 #include "chrome/browser/chromeos/settings/cros_settings.h" |
| 32 #include "chrome/browser/extensions/chrome_extension_web_contents_observer.h" | 33 #include "chrome/browser/extensions/chrome_extension_web_contents_observer.h" |
| 33 #include "chrome/browser/media/webrtc/media_capture_devices_dispatcher.h" | 34 #include "chrome/browser/media/webrtc/media_capture_devices_dispatcher.h" |
| 34 #include "chrome/browser/media/webrtc/media_stream_devices_controller.h" | 35 #include "chrome/browser/media/webrtc/media_stream_devices_controller.h" |
| 35 #include "chrome/browser/password_manager/chrome_password_manager_client.h" | 36 #include "chrome/browser/password_manager/chrome_password_manager_client.h" |
| 36 #include "chrome/browser/renderer_preferences_util.h" | 37 #include "chrome/browser/renderer_preferences_util.h" |
| (...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 262 GetWebUI()->CallJavascriptFunctionUnsafe("cr.ui.Oobe.teardown"); | 263 GetWebUI()->CallJavascriptFunctionUnsafe("cr.ui.Oobe.teardown"); |
| 263 | 264 |
| 264 // Clear any delegates we have set on the WebView. | 265 // Clear any delegates we have set on the WebView. |
| 265 WebContents* web_contents = web_view()->GetWebContents(); | 266 WebContents* web_contents = web_view()->GetWebContents(); |
| 266 WebContentsModalDialogManager::FromWebContents(web_contents) | 267 WebContentsModalDialogManager::FromWebContents(web_contents) |
| 267 ->SetDelegate(nullptr); | 268 ->SetDelegate(nullptr); |
| 268 web_contents->SetDelegate(nullptr); | 269 web_contents->SetDelegate(nullptr); |
| 269 } | 270 } |
| 270 | 271 |
| 271 // static | 272 // static |
| 272 void WebUILoginView::InitializeWebView(views::WebView* web_view) { | 273 void WebUILoginView::InitializeWebView(views::WebView* web_view, |
| 274 const base::string16& title) { |
| 273 WebContents* web_contents = web_view->GetWebContents(); | 275 WebContents* web_contents = web_view->GetWebContents(); |
| 274 | 276 |
| 277 if (!title.empty()) |
| 278 WebContentsForcedTitle::CreateForWebContentsWithTitle(web_contents, title); |
| 279 |
| 275 WebContentsSetBackgroundColor::CreateForWebContentsWithColor( | 280 WebContentsSetBackgroundColor::CreateForWebContentsWithColor( |
| 276 web_contents, SK_ColorTRANSPARENT); | 281 web_contents, SK_ColorTRANSPARENT); |
| 277 | 282 |
| 278 // Ensure that the login UI has a tab ID, which will allow the GAIA auth | 283 // Ensure that the login UI has a tab ID, which will allow the GAIA auth |
| 279 // extension's background script to tell it apart from a captive portal window | 284 // extension's background script to tell it apart from a captive portal window |
| 280 // that may be opened on top of this UI. | 285 // that may be opened on top of this UI. |
| 281 SessionTabHelper::CreateForWebContents(web_contents); | 286 SessionTabHelper::CreateForWebContents(web_contents); |
| 282 | 287 |
| 283 // Create the password manager that is needed for the proxy. | 288 // Create the password manager that is needed for the proxy. |
| 284 ChromePasswordManagerClient::CreateForWebContentsWithAutofillClient( | 289 ChromePasswordManagerClient::CreateForWebContentsWithAutofillClient( |
| (...skipping 19 matching lines...) Expand all Loading... |
| 304 SharedWebViewFactory::GetForProfile(signin_profile); | 309 SharedWebViewFactory::GetForProfile(signin_profile); |
| 305 is_reusing_webview_ = | 310 is_reusing_webview_ = |
| 306 shared_web_view->Get(settings_.preloaded_url, &webui_login_); | 311 shared_web_view->Get(settings_.preloaded_url, &webui_login_); |
| 307 } else { | 312 } else { |
| 308 webui_login_ = new WebViewHandle(signin_profile); | 313 webui_login_ = new WebViewHandle(signin_profile); |
| 309 is_reusing_webview_ = false; | 314 is_reusing_webview_ = false; |
| 310 } | 315 } |
| 311 | 316 |
| 312 WebContents* web_contents = web_view()->GetWebContents(); | 317 WebContents* web_contents = web_view()->GetWebContents(); |
| 313 if (!is_reusing_webview_) | 318 if (!is_reusing_webview_) |
| 314 InitializeWebView(web_view()); | 319 InitializeWebView(web_view(), settings_.web_view_title); |
| 315 | 320 |
| 316 web_view()->set_allow_accelerators(true); | 321 web_view()->set_allow_accelerators(true); |
| 317 AddChildView(web_view()); | 322 AddChildView(web_view()); |
| 318 | 323 |
| 319 WebContentsModalDialogManager::FromWebContents(web_contents) | 324 WebContentsModalDialogManager::FromWebContents(web_contents) |
| 320 ->SetDelegate(this); | 325 ->SetDelegate(this); |
| 321 web_contents->SetDelegate(this); | 326 web_contents->SetDelegate(this); |
| 322 | 327 |
| 323 status_area_widget_host_ = new views::View; | 328 status_area_widget_host_ = new views::View; |
| 324 AddChildView(status_area_widget_host_); | 329 AddChildView(status_area_widget_host_); |
| (...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 657 if (should_emit_login_prompt_visible_) { | 662 if (should_emit_login_prompt_visible_) { |
| 658 VLOG(1) << "Login WebUI >> login-prompt-visible"; | 663 VLOG(1) << "Login WebUI >> login-prompt-visible"; |
| 659 chromeos::DBusThreadManager::Get()->GetSessionManagerClient()-> | 664 chromeos::DBusThreadManager::Get()->GetSessionManagerClient()-> |
| 660 EmitLoginPromptVisible(); | 665 EmitLoginPromptVisible(); |
| 661 } | 666 } |
| 662 | 667 |
| 663 webui_visible_ = true; | 668 webui_visible_ = true; |
| 664 } | 669 } |
| 665 | 670 |
| 666 } // namespace chromeos | 671 } // namespace chromeos |
| OLD | NEW |