OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "base/i18n/rtl.h" | 9 #include "base/i18n/rtl.h" |
10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
11 #include "base/values.h" | 11 #include "base/values.h" |
12 #include "chrome/browser/chromeos/accessibility/accessibility_util.h" | 12 #include "chrome/browser/chromeos/accessibility/accessibility_util.h" |
13 #include "chrome/browser/chromeos/cros/cros_library.h" | 13 #include "chrome/browser/chromeos/cros/cros_library.h" |
14 #include "chrome/browser/chromeos/dbus/dbus_thread_manager.h" | 14 #include "chrome/browser/chromeos/dbus/dbus_thread_manager.h" |
15 #include "chrome/browser/chromeos/dbus/session_manager_client.h" | 15 #include "chrome/browser/chromeos/dbus/session_manager_client.h" |
16 #include "chrome/browser/chromeos/login/proxy_settings_dialog.h" | 16 #include "chrome/browser/chromeos/login/proxy_settings_dialog.h" |
17 #include "chrome/browser/chromeos/login/webui_login_display.h" | 17 #include "chrome/browser/chromeos/login/webui_login_display.h" |
| 18 #include "chrome/browser/chromeos/status/status_area_view.h" |
18 #include "chrome/browser/chromeos/status/status_area_view_chromeos.h" | 19 #include "chrome/browser/chromeos/status/status_area_view_chromeos.h" |
19 #include "chrome/browser/profiles/profile_manager.h" | 20 #include "chrome/browser/profiles/profile_manager.h" |
20 #include "chrome/browser/ui/views/dom_view.h" | 21 #include "chrome/browser/ui/views/dom_view.h" |
21 #include "chrome/browser/ui/webui/chromeos/login/oobe_ui.h" | 22 #include "chrome/browser/ui/webui/chromeos/login/oobe_ui.h" |
22 #include "chrome/common/render_messages.h" | 23 #include "chrome/common/render_messages.h" |
23 #include "content/browser/tab_contents/tab_contents.h" | 24 #include "content/browser/tab_contents/tab_contents.h" |
24 #include "content/public/browser/render_view_host_observer.h" | 25 #include "content/public/browser/render_view_host_observer.h" |
25 #include "ui/gfx/rect.h" | 26 #include "ui/gfx/rect.h" |
26 #include "ui/gfx/size.h" | 27 #include "ui/gfx/size.h" |
27 #include "ui/views/widget/widget.h" | 28 #include "ui/views/widget/widget.h" |
28 | 29 |
29 #if defined(TOOLKIT_USES_GTK) | 30 #if defined(TOOLKIT_USES_GTK) |
30 #include "chrome/browser/chromeos/legacy_window_manager/wm_ipc.h" | 31 #include "chrome/browser/chromeos/legacy_window_manager/wm_ipc.h" |
31 #include "ui/views/widget/native_widget_gtk.h" | 32 #include "ui/views/widget/native_widget_gtk.h" |
32 #endif | 33 #endif |
33 | 34 |
34 #if defined(USE_VIRTUAL_KEYBOARD) | 35 #if defined(USE_VIRTUAL_KEYBOARD) |
35 #include "chrome/browser/ui/virtual_keyboard/virtual_keyboard_manager.h" | 36 #include "chrome/browser/ui/virtual_keyboard/virtual_keyboard_manager.h" |
36 #endif | 37 #endif |
37 | 38 |
| 39 #if defined(USE_AURA) |
| 40 #include "chrome/browser/ui/views/aura/chrome_shell_delegate.h" |
| 41 #endif |
| 42 |
38 namespace { | 43 namespace { |
39 | 44 |
40 const char kViewClassName[] = "browser/chromeos/login/WebUILoginView"; | 45 const char kViewClassName[] = "browser/chromeos/login/WebUILoginView"; |
41 | 46 |
42 // These strings must be kept in sync with handleAccelerator() in oobe.js. | 47 // These strings must be kept in sync with handleAccelerator() in oobe.js. |
43 const char kAccelNameAccessibility[] = "accessibility"; | 48 const char kAccelNameAccessibility[] = "accessibility"; |
44 const char kAccelNameCancel[] = "cancel"; | 49 const char kAccelNameCancel[] = "cancel"; |
45 const char kAccelNameEnrollment[] = "enrollment"; | 50 const char kAccelNameEnrollment[] = "enrollment"; |
46 | 51 |
47 // Observes IPC messages from the FrameSniffer and notifies JS if error | 52 // Observes IPC messages from the FrameSniffer and notifies JS if error |
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
273 | 278 |
274 void WebUILoginView::OnTabMainFrameLoaded() { | 279 void WebUILoginView::OnTabMainFrameLoaded() { |
275 VLOG(1) << "WebUI login main frame loaded."; | 280 VLOG(1) << "WebUI login main frame loaded."; |
276 } | 281 } |
277 | 282 |
278 void WebUILoginView::OnTabMainFrameFirstRender() { | 283 void WebUILoginView::OnTabMainFrameFirstRender() { |
279 VLOG(1) << "WebUI login main frame rendered."; | 284 VLOG(1) << "WebUI login main frame rendered."; |
280 StatusAreaViewChromeos::SetScreenMode( | 285 StatusAreaViewChromeos::SetScreenMode( |
281 StatusAreaViewChromeos::LOGIN_MODE_WEBUI); | 286 StatusAreaViewChromeos::LOGIN_MODE_WEBUI); |
282 // In aura there's a global status area shown already. | 287 // In aura there's a global status area shown already. |
283 // TODO(nkostylev): Figure out how to communicate from login screen with | 288 #if defined(USE_AURA) |
284 // global status area. | 289 status_area_ = ChromeShellDelegate::instance()->GetStatusArea(); |
285 #if !defined(USE_AURA) | 290 status_area_->SetVisible(status_area_visibility_on_init_); |
| 291 #else |
286 InitStatusArea(); | 292 InitStatusArea(); |
287 #endif | 293 #endif |
288 | 294 |
289 #if defined(TOOLKIT_USES_GTK) | 295 #if defined(TOOLKIT_USES_GTK) |
290 if (host_window_frozen_) { | 296 if (host_window_frozen_) { |
291 host_window_frozen_ = false; | 297 host_window_frozen_ = false; |
292 | 298 |
293 // Unfreezes the host window since tab is rendered now. | 299 // Unfreezes the host window since tab is rendered now. |
294 views::NativeWidgetGtk::UpdateFreezeUpdatesProperty( | 300 views::NativeWidgetGtk::UpdateFreezeUpdatesProperty( |
295 GetNativeWindow(), false); | 301 GetNativeWindow(), false); |
(...skipping 14 matching lines...) Expand all Loading... |
310 | 316 |
311 OobeUI* oobe_ui = static_cast<OobeUI*>(GetWebUI()); | 317 OobeUI* oobe_ui = static_cast<OobeUI*>(GetWebUI()); |
312 // Notify OOBE that the login frame has been rendered. Currently | 318 // Notify OOBE that the login frame has been rendered. Currently |
313 // this is used to start camera presence check. | 319 // this is used to start camera presence check. |
314 oobe_ui->OnLoginPromptVisible(); | 320 oobe_ui->OnLoginPromptVisible(); |
315 } | 321 } |
316 | 322 |
317 void WebUILoginView::InitStatusArea() { | 323 void WebUILoginView::InitStatusArea() { |
318 DCHECK(status_area_ == NULL); | 324 DCHECK(status_area_ == NULL); |
319 DCHECK(status_window_ == NULL); | 325 DCHECK(status_window_ == NULL); |
320 status_area_ = new StatusAreaViewChromeos(); | 326 StatusAreaViewChromeos* status_area_chromeos = new StatusAreaViewChromeos(); |
321 status_area_->Init(this); | 327 status_area_chromeos->Init(this); |
| 328 status_area_ = status_area_chromeos; |
322 status_area_->SetVisible(status_area_visibility_on_init_); | 329 status_area_->SetVisible(status_area_visibility_on_init_); |
323 | 330 |
324 // Width of |status_window| is meant to be large enough. | 331 // Width of |status_window| is meant to be large enough. |
325 // The current value of status_area_->GetPreferredSize().width() | 332 // The current value of status_area_->GetPreferredSize().width() |
326 // will be too small when button status is changed. | 333 // will be too small when button status is changed. |
327 // (e.g. when CapsLock indicator appears) | 334 // (e.g. when CapsLock indicator appears) |
328 gfx::Size widget_size(width()/2, | 335 gfx::Size widget_size(width()/2, |
329 status_area_->GetPreferredSize().height()); | 336 status_area_->GetPreferredSize().height()); |
330 const int widget_x = base::i18n::IsRTL() ? | 337 const int widget_x = base::i18n::IsRTL() ? |
331 kStatusAreaCornerPadding : | 338 kStatusAreaCornerPadding : |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
397 // when the focus is inside an iframe. Only clear on KeyDown to prevent hiding | 404 // when the focus is inside an iframe. Only clear on KeyDown to prevent hiding |
398 // an immediate authentication error (See crbug.com/103643). | 405 // an immediate authentication error (See crbug.com/103643). |
399 if (event.type == WebKit::WebInputEvent::KeyDown) { | 406 if (event.type == WebKit::WebInputEvent::KeyDown) { |
400 WebUI* web_ui = GetWebUI(); | 407 WebUI* web_ui = GetWebUI(); |
401 if (web_ui) | 408 if (web_ui) |
402 web_ui->CallJavascriptFunction("cr.ui.Oobe.clearErrors"); | 409 web_ui->CallJavascriptFunction("cr.ui.Oobe.clearErrors"); |
403 } | 410 } |
404 } | 411 } |
405 | 412 |
406 } // namespace chromeos | 413 } // namespace chromeos |
OLD | NEW |