| 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.h" |
| 19 #include "chrome/browser/chromeos/status/status_area_view_chromeos.h" | 19 #include "chrome/browser/chromeos/status/status_area_view_chromeos.h" |
| 20 #include "chrome/browser/profiles/profile_manager.h" | 20 #include "chrome/browser/profiles/profile_manager.h" |
| 21 #include "chrome/browser/ui/views/dom_view.h" | 21 #include "chrome/browser/ui/views/dom_view.h" |
| 22 #include "chrome/browser/ui/webui/chromeos/login/oobe_ui.h" | 22 #include "chrome/browser/ui/webui/chromeos/login/oobe_ui.h" |
| 23 #include "chrome/common/render_messages.h" | 23 #include "chrome/common/render_messages.h" |
| 24 #include "content/browser/tab_contents/tab_contents.h" | |
| 25 #include "content/public/browser/render_view_host_observer.h" | 24 #include "content/public/browser/render_view_host_observer.h" |
| 25 #include "content/public/browser/web_contents.h" |
| 26 #include "ui/gfx/rect.h" | 26 #include "ui/gfx/rect.h" |
| 27 #include "ui/gfx/size.h" | 27 #include "ui/gfx/size.h" |
| 28 #include "ui/views/widget/widget.h" | 28 #include "ui/views/widget/widget.h" |
| 29 | 29 |
| 30 #if defined(TOOLKIT_USES_GTK) | 30 #if defined(TOOLKIT_USES_GTK) |
| 31 #include "chrome/browser/chromeos/legacy_window_manager/wm_ipc.h" | 31 #include "chrome/browser/chromeos/legacy_window_manager/wm_ipc.h" |
| 32 #include "ui/views/widget/native_widget_gtk.h" | 32 #include "ui/views/widget/native_widget_gtk.h" |
| 33 #endif | 33 #endif |
| 34 | 34 |
| 35 #if defined(USE_VIRTUAL_KEYBOARD) | 35 #if defined(USE_VIRTUAL_KEYBOARD) |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 status_window_ = NULL; | 141 status_window_ = NULL; |
| 142 } | 142 } |
| 143 | 143 |
| 144 void WebUILoginView::Init(views::Widget* login_window) { | 144 void WebUILoginView::Init(views::Widget* login_window) { |
| 145 login_window_ = login_window; | 145 login_window_ = login_window; |
| 146 webui_login_ = new DOMView(); | 146 webui_login_ = new DOMView(); |
| 147 AddChildView(webui_login_); | 147 AddChildView(webui_login_); |
| 148 webui_login_->Init(ProfileManager::GetDefaultProfile(), NULL); | 148 webui_login_->Init(ProfileManager::GetDefaultProfile(), NULL); |
| 149 webui_login_->SetVisible(true); | 149 webui_login_->SetVisible(true); |
| 150 | 150 |
| 151 TabContents* tab_contents = webui_login_->dom_contents()->tab_contents(); | 151 WebContents* web_contents = webui_login_->dom_contents()->web_contents(); |
| 152 tab_contents->SetDelegate(this); | 152 web_contents->SetDelegate(this); |
| 153 | 153 |
| 154 tab_watcher_.reset(new TabFirstRenderWatcher(tab_contents, this)); | 154 tab_watcher_.reset(new TabFirstRenderWatcher(web_contents, this)); |
| 155 } | 155 } |
| 156 | 156 |
| 157 std::string WebUILoginView::GetClassName() const { | 157 std::string WebUILoginView::GetClassName() const { |
| 158 return kViewClassName; | 158 return kViewClassName; |
| 159 } | 159 } |
| 160 | 160 |
| 161 bool WebUILoginView::AcceleratorPressed( | 161 bool WebUILoginView::AcceleratorPressed( |
| 162 const ui::Accelerator& accelerator) { | 162 const ui::Accelerator& accelerator) { |
| 163 AccelMap::const_iterator entry = accel_map_.find(accelerator); | 163 AccelMap::const_iterator entry = accel_map_.find(accelerator); |
| 164 if (entry == accel_map_.end()) | 164 if (entry == accel_map_.end()) |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 202 ¶ms); | 202 ¶ms); |
| 203 #endif | 203 #endif |
| 204 } | 204 } |
| 205 | 205 |
| 206 void WebUILoginView::LoadURL(const GURL & url) { | 206 void WebUILoginView::LoadURL(const GURL & url) { |
| 207 webui_login_->LoadURL(url); | 207 webui_login_->LoadURL(url); |
| 208 webui_login_->RequestFocus(); | 208 webui_login_->RequestFocus(); |
| 209 } | 209 } |
| 210 | 210 |
| 211 WebUI* WebUILoginView::GetWebUI() { | 211 WebUI* WebUILoginView::GetWebUI() { |
| 212 return webui_login_->dom_contents()->tab_contents()->GetWebUI(); | 212 return webui_login_->dom_contents()->web_contents()->GetWebUI(); |
| 213 } | 213 } |
| 214 | 214 |
| 215 void WebUILoginView::SetStatusAreaEnabled(bool enable) { | 215 void WebUILoginView::SetStatusAreaEnabled(bool enable) { |
| 216 if (status_area_) | 216 if (status_area_) |
| 217 status_area_->MakeButtonsActive(enable); | 217 status_area_->MakeButtonsActive(enable); |
| 218 } | 218 } |
| 219 | 219 |
| 220 void WebUILoginView::SetStatusAreaVisible(bool visible) { | 220 void WebUILoginView::SetStatusAreaVisible(bool visible) { |
| 221 if (status_area_) | 221 if (status_area_) |
| 222 status_area_->SetVisible(visible); | 222 status_area_->SetVisible(visible); |
| (...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 401 base::Bind(&WebUILoginView::ReturnFocus, base::Unretained(this)); | 401 base::Bind(&WebUILoginView::ReturnFocus, base::Unretained(this)); |
| 402 status_area_->TakeFocus(reverse, return_focus_cb); | 402 status_area_->TakeFocus(reverse, return_focus_cb); |
| 403 status_area_->GetWidget()->Activate(); | 403 status_area_->GetWidget()->Activate(); |
| 404 } | 404 } |
| 405 #endif | 405 #endif |
| 406 return true; | 406 return true; |
| 407 } | 407 } |
| 408 | 408 |
| 409 void WebUILoginView::ReturnFocus(bool reverse) { | 409 void WebUILoginView::ReturnFocus(bool reverse) { |
| 410 // Return the focus to the web contents. | 410 // Return the focus to the web contents. |
| 411 webui_login_->dom_contents()->tab_contents()-> | 411 webui_login_->dom_contents()->web_contents()-> |
| 412 FocusThroughTabTraversal(reverse); | 412 FocusThroughTabTraversal(reverse); |
| 413 GetWidget()->Activate(); | 413 GetWidget()->Activate(); |
| 414 } | 414 } |
| 415 | 415 |
| 416 void WebUILoginView::HandleKeyboardEvent(const NativeWebKeyboardEvent& event) { | 416 void WebUILoginView::HandleKeyboardEvent(const NativeWebKeyboardEvent& event) { |
| 417 unhandled_keyboard_event_handler_.HandleKeyboardEvent(event, | 417 unhandled_keyboard_event_handler_.HandleKeyboardEvent(event, |
| 418 GetFocusManager()); | 418 GetFocusManager()); |
| 419 | 419 |
| 420 // Make sure error bubble is cleared on keyboard event. This is needed | 420 // Make sure error bubble is cleared on keyboard event. This is needed |
| 421 // when the focus is inside an iframe. Only clear on KeyDown to prevent hiding | 421 // when the focus is inside an iframe. Only clear on KeyDown to prevent hiding |
| 422 // an immediate authentication error (See crbug.com/103643). | 422 // an immediate authentication error (See crbug.com/103643). |
| 423 if (event.type == WebKit::WebInputEvent::KeyDown) { | 423 if (event.type == WebKit::WebInputEvent::KeyDown) { |
| 424 WebUI* web_ui = GetWebUI(); | 424 WebUI* web_ui = GetWebUI(); |
| 425 if (web_ui) | 425 if (web_ui) |
| 426 web_ui->CallJavascriptFunction("cr.ui.Oobe.clearErrors"); | 426 web_ui->CallJavascriptFunction("cr.ui.Oobe.clearErrors"); |
| 427 } | 427 } |
| 428 } | 428 } |
| 429 | 429 |
| 430 } // namespace chromeos | 430 } // namespace chromeos |
| OLD | NEW |