| 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/profiles/profile_manager.h" | 20 #include "chrome/browser/profiles/profile_manager.h" |
| 21 #include "chrome/browser/renderer_preferences_util.h" | 21 #include "chrome/browser/renderer_preferences_util.h" |
| 22 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 22 #include "chrome/browser/ui/tab_contents/tab_contents.h" |
| 23 #include "chrome/browser/ui/webui/chromeos/login/oobe_ui.h" | 23 #include "chrome/browser/ui/webui/chromeos/login/oobe_ui.h" |
| 24 #include "chrome/common/chrome_notification_types.h" | 24 #include "chrome/common/chrome_notification_types.h" |
| 25 #include "chrome/common/chrome_switches.h" | 25 #include "chrome/common/chrome_switches.h" |
| 26 #include "chrome/common/render_messages.h" | 26 #include "chrome/common/render_messages.h" |
| 27 #include "chromeos/dbus/dbus_thread_manager.h" | 27 #include "chromeos/dbus/dbus_thread_manager.h" |
| 28 #include "chromeos/dbus/session_manager_client.h" | 28 #include "chromeos/dbus/session_manager_client.h" |
| 29 #include "content/public/browser/notification_service.h" | 29 #include "content/public/browser/notification_service.h" |
| 30 #include "content/public/browser/render_view_host.h" | 30 #include "content/public/browser/render_view_host.h" |
| 31 #include "content/public/browser/render_view_host_observer.h" | 31 #include "content/public/browser/render_view_host_observer.h" |
| 32 #include "content/public/browser/render_widget_host_view.h" | 32 #include "content/public/browser/render_widget_host_view.h" |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 AddChildView(webui_login_); | 142 AddChildView(webui_login_); |
| 143 | 143 |
| 144 // We create the WebContents ourselves because the TCW assumes ownership of | 144 // We create the WebContents ourselves because the TCW assumes ownership of |
| 145 // it. This should be reworked once we don't need to use the TCW here. | 145 // it. This should be reworked once we don't need to use the TCW here. |
| 146 WebContents* web_contents = | 146 WebContents* web_contents = |
| 147 WebContents::Create(ProfileManager::GetDefaultProfile(), | 147 WebContents::Create(ProfileManager::GetDefaultProfile(), |
| 148 NULL, | 148 NULL, |
| 149 MSG_ROUTING_NONE, | 149 MSG_ROUTING_NONE, |
| 150 NULL, | 150 NULL, |
| 151 NULL); | 151 NULL); |
| 152 wrapper_.reset(new TabContentsWrapper(web_contents)); | 152 tab_contents_.reset(new TabContents(web_contents)); |
| 153 webui_login_->SetWebContents(web_contents); | 153 webui_login_->SetWebContents(web_contents); |
| 154 | 154 |
| 155 web_contents->SetDelegate(this); | 155 web_contents->SetDelegate(this); |
| 156 renderer_preferences_util::UpdateFromSystemSettings( | 156 renderer_preferences_util::UpdateFromSystemSettings( |
| 157 web_contents->GetMutableRendererPrefs(), | 157 web_contents->GetMutableRendererPrefs(), |
| 158 ProfileManager::GetDefaultProfile()); | 158 ProfileManager::GetDefaultProfile()); |
| 159 | 159 |
| 160 tab_watcher_.reset(new TabRenderWatcher(web_contents, this)); | 160 tab_watcher_.reset(new TabRenderWatcher(web_contents, this)); |
| 161 } | 161 } |
| 162 | 162 |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 202 if (BaseLoginDisplayHost::default_host() && | 202 if (BaseLoginDisplayHost::default_host() && |
| 203 command_line->HasSwitch(switches::kEnableNewOobe)) { | 203 command_line->HasSwitch(switches::kEnableNewOobe)) { |
| 204 // TODO(nkostylev): Use WebContentsObserver::RenderViewCreated to track | 204 // TODO(nkostylev): Use WebContentsObserver::RenderViewCreated to track |
| 205 // when RenderView is created. | 205 // when RenderView is created. |
| 206 // Use a background with transparency to trigger transparency in Webkit. | 206 // Use a background with transparency to trigger transparency in Webkit. |
| 207 SkBitmap background; | 207 SkBitmap background; |
| 208 background.setConfig(SkBitmap::kARGB_8888_Config, 1, 1); | 208 background.setConfig(SkBitmap::kARGB_8888_Config, 1, 1); |
| 209 background.allocPixels(); | 209 background.allocPixels(); |
| 210 background.eraseARGB(0x00, 0x00, 0x00, 0x00); | 210 background.eraseARGB(0x00, 0x00, 0x00, 0x00); |
| 211 content::RenderViewHost* host = | 211 content::RenderViewHost* host = |
| 212 wrapper_->web_contents()->GetRenderViewHost(); | 212 tab_contents_->web_contents()->GetRenderViewHost(); |
| 213 host->GetView()->SetBackground(background); | 213 host->GetView()->SetBackground(background); |
| 214 } | 214 } |
| 215 } | 215 } |
| 216 | 216 |
| 217 content::WebUI* WebUILoginView::GetWebUI() { | 217 content::WebUI* WebUILoginView::GetWebUI() { |
| 218 return webui_login_->web_contents()->GetWebUI(); | 218 return webui_login_->web_contents()->GetWebUI(); |
| 219 } | 219 } |
| 220 | 220 |
| 221 void WebUILoginView::OpenProxySettings() { | 221 void WebUILoginView::OpenProxySettings() { |
| 222 ProxySettingsDialog* dialog = | 222 ProxySettingsDialog* dialog = |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 333 oobe_ui->OnLoginPromptVisible(); | 333 oobe_ui->OnLoginPromptVisible(); |
| 334 } | 334 } |
| 335 | 335 |
| 336 void WebUILoginView::ReturnFocus(bool reverse) { | 336 void WebUILoginView::ReturnFocus(bool reverse) { |
| 337 // Return the focus to the web contents. | 337 // Return the focus to the web contents. |
| 338 webui_login_->web_contents()->FocusThroughTabTraversal(reverse); | 338 webui_login_->web_contents()->FocusThroughTabTraversal(reverse); |
| 339 GetWidget()->Activate(); | 339 GetWidget()->Activate(); |
| 340 } | 340 } |
| 341 | 341 |
| 342 } // namespace chromeos | 342 } // namespace chromeos |
| OLD | NEW |