| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/account_screen.h" | 5 #include "chrome/browser/chromeos/login/account_screen.h" |
| 6 | 6 |
| 7 #include "base/string_util.h" | 7 #include "base/string_util.h" |
| 8 #include "base/utf_string_conversions.h" | 8 #include "base/utf_string_conversions.h" |
| 9 #include "chrome/browser/browser_process.h" | 9 #include "chrome/browser/browser_process.h" |
| 10 #include "chrome/browser/chromeos/input_method/input_method_util.h" | 10 #include "chrome/browser/chromeos/input_method/input_method_util.h" |
| 11 #include "chrome/browser/chromeos/login/account_creation_view.h" | 11 #include "chrome/browser/chromeos/login/account_creation_view.h" |
| 12 #include "chrome/browser/chromeos/login/screen_observer.h" | 12 #include "chrome/browser/chromeos/login/screen_observer.h" |
| 13 #include "chrome/browser/profiles/profile_manager.h" | 13 #include "chrome/browser/profiles/profile_manager.h" |
| 14 #include "content/browser/renderer_host/render_view_host.h" | 14 #include "content/browser/renderer_host/render_view_host.h" |
| 15 #include "content/browser/site_instance.h" | 15 #include "content/browser/site_instance.h" |
| 16 #include "content/browser/tab_contents/tab_contents.h" | 16 #include "content/browser/tab_contents/tab_contents.h" |
| 17 #include "googleurl/src/gurl.h" | 17 #include "googleurl/src/gurl.h" |
| 18 #include "views/events/event.h" |
| 18 #include "views/widget/widget_gtk.h" | 19 #include "views/widget/widget_gtk.h" |
| 19 | 20 |
| 20 namespace chromeos { | 21 namespace chromeos { |
| 21 | 22 |
| 22 namespace { | 23 namespace { |
| 23 | 24 |
| 24 const char kCreateAccountPageUrl[] = | 25 const char kCreateAccountPageUrl[] = |
| 25 "https://www.google.com/accounts/NewAccount?service=mail&hl=en"; | 26 "https://www.google.com/accounts/NewAccount?service=mail&hl=en"; |
| 26 | 27 |
| 27 const char kCreateAccountDoneUrl[] = | 28 const char kCreateAccountDoneUrl[] = |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 if (source->render_view_host()) { | 126 if (source->render_view_host()) { |
| 126 source->render_view_host()->InsertCSSInWebFrame( | 127 source->render_view_host()->InsertCSSInWebFrame( |
| 127 L"", kCreateAccountCSS, ""); | 128 L"", kCreateAccountCSS, ""); |
| 128 source->render_view_host()->ExecuteJavascriptInWebFrame( | 129 source->render_view_host()->ExecuteJavascriptInWebFrame( |
| 129 string16(), ASCIIToUTF16(kCreateAccountJS)); | 130 string16(), ASCIIToUTF16(kCreateAccountJS)); |
| 130 } | 131 } |
| 131 } | 132 } |
| 132 | 133 |
| 133 void AccountScreen::HandleKeyboardEvent(const NativeWebKeyboardEvent& event) { | 134 void AccountScreen::HandleKeyboardEvent(const NativeWebKeyboardEvent& event) { |
| 134 views::Widget* widget = view()->GetWidget(); | 135 views::Widget* widget = view()->GetWidget(); |
| 135 if (widget && event.os_event && !event.skip_in_browser) | 136 if (widget && event.os_event && !event.skip_in_browser) { |
| 136 static_cast<views::WidgetGtk*>(widget)->HandleKeyboardEvent(event.os_event); | 137 views::KeyEvent views_event(reinterpret_cast<GdkEvent*>(event.os_event)); |
| 138 static_cast<views::WidgetGtk*>(widget)->HandleKeyboardEvent(views_event); |
| 139 } |
| 137 } | 140 } |
| 138 | 141 |
| 139 /////////////////////////////////////////////////////////////////////////////// | 142 /////////////////////////////////////////////////////////////////////////////// |
| 140 // AccountScreen, WebPageDelegate implementation: | 143 // AccountScreen, WebPageDelegate implementation: |
| 141 void AccountScreen::OnPageLoaded() { | 144 void AccountScreen::OnPageLoaded() { |
| 142 StopTimeoutTimer(); | 145 StopTimeoutTimer(); |
| 143 // Enable input methods (e.g. Chinese, Japanese) so that users could input | 146 // Enable input methods (e.g. Chinese, Japanese) so that users could input |
| 144 // their first and last names. | 147 // their first and last names. |
| 145 if (g_browser_process) { | 148 if (g_browser_process) { |
| 146 const std::string locale = g_browser_process->GetApplicationLocale(); | 149 const std::string locale = g_browser_process->GetApplicationLocale(); |
| (...skipping 22 matching lines...) Expand all Loading... |
| 169 // password. | 172 // password. |
| 170 if (g_browser_process) { | 173 if (g_browser_process) { |
| 171 const std::string locale = g_browser_process->GetApplicationLocale(); | 174 const std::string locale = g_browser_process->GetApplicationLocale(); |
| 172 input_method::EnableInputMethods( | 175 input_method::EnableInputMethods( |
| 173 locale, input_method::kKeyboardLayoutsOnly, ""); | 176 locale, input_method::kKeyboardLayoutsOnly, ""); |
| 174 } | 177 } |
| 175 delegate()->GetObserver(this)->OnExit(code); | 178 delegate()->GetObserver(this)->OnExit(code); |
| 176 } | 179 } |
| 177 | 180 |
| 178 } // namespace chromeos | 181 } // namespace chromeos |
| OLD | NEW |