| 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/html_page_screen.h" | 5 #include "chrome/browser/chromeos/login/html_page_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_manager.h" | 10 #include "chrome/browser/chromeos/input_method/input_method_manager.h" |
| 11 #include "chrome/browser/chromeos/input_method/input_method_util.h" | 11 #include "chrome/browser/chromeos/input_method/input_method_util.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 "chrome/browser/ui/views/handle_web_keyboard_event.h" | 14 #include "chrome/browser/ui/views/handle_web_keyboard_event.h" |
| 15 #include "content/browser/renderer_host/render_view_host.h" | 15 #include "content/browser/renderer_host/render_view_host.h" |
| 16 #include "content/browser/site_instance.h" | 16 #include "content/browser/site_instance.h" |
| 17 #include "content/browser/tab_contents/tab_contents.h" | 17 #include "content/browser/tab_contents/tab_contents.h" |
| 18 #include "googleurl/src/gurl.h" | 18 #include "googleurl/src/gurl.h" |
| 19 #include "views/events/event.h" | 19 #include "views/events/event.h" |
| 20 | 20 |
| 21 namespace chromeos { | 21 namespace chromeos { |
| 22 | 22 |
| 23 static const char kHTMLPageDoneUrl[] = "about:blank"; | |
| 24 | |
| 25 /////////////////////////////////////////////////////////////////////////////// | 23 /////////////////////////////////////////////////////////////////////////////// |
| 26 // HTMLPageDomView | 24 // HTMLPageDomView |
| 27 TabContents* HTMLPageDomView::CreateTabContents(Profile* profile, | 25 TabContents* HTMLPageDomView::CreateTabContents(Profile* profile, |
| 28 SiteInstance* instance) { | 26 SiteInstance* instance) { |
| 29 return new WizardWebPageViewTabContents(profile, | 27 return new WizardWebPageViewTabContents(profile, |
| 30 instance, | 28 instance, |
| 31 page_delegate_); | 29 page_delegate_); |
| 32 } | 30 } |
| 33 | 31 |
| 34 /////////////////////////////////////////////////////////////////////////////// | 32 /////////////////////////////////////////////////////////////////////////////// |
| (...skipping 30 matching lines...) Expand all Loading... |
| 65 view()->InitDOM(profile, | 63 view()->InitDOM(profile, |
| 66 SiteInstance::CreateSiteInstanceForURL(profile, url)); | 64 SiteInstance::CreateSiteInstanceForURL(profile, url)); |
| 67 view()->SetTabContentsDelegate(this); | 65 view()->SetTabContentsDelegate(this); |
| 68 view()->LoadURL(url); | 66 view()->LoadURL(url); |
| 69 } | 67 } |
| 70 | 68 |
| 71 HTMLPageView* HTMLPageScreen::AllocateView() { | 69 HTMLPageView* HTMLPageScreen::AllocateView() { |
| 72 return new HTMLPageView(); | 70 return new HTMLPageView(); |
| 73 } | 71 } |
| 74 | 72 |
| 75 /////////////////////////////////////////////////////////////////////////////// | |
| 76 // HTMLPageScreen, TabContentsDelegate implementation: | |
| 77 void HTMLPageScreen::LoadingStateChanged(TabContents* source) { | |
| 78 std::string url = source->GetURL().spec(); | |
| 79 if (url == kHTMLPageDoneUrl) { | |
| 80 source->Stop(); | |
| 81 // TODO(dpolukhin): use special code for this case but now | |
| 82 // ACCOUNT_CREATE_BACK works as we would like, i.e. get to login page. | |
| 83 VLOG(1) << "HTMLPageScreen::LoadingStateChanged: " << url; | |
| 84 CloseScreen(ScreenObserver::ACCOUNT_CREATE_BACK); | |
| 85 } | |
| 86 } | |
| 87 | |
| 88 void HTMLPageScreen::HandleKeyboardEvent(const NativeWebKeyboardEvent& event) { | 73 void HTMLPageScreen::HandleKeyboardEvent(const NativeWebKeyboardEvent& event) { |
| 89 HandleWebKeyboardEvent(view()->GetWidget(), event); | 74 HandleWebKeyboardEvent(view()->GetWidget(), event); |
| 90 } | 75 } |
| 91 | 76 |
| 92 /////////////////////////////////////////////////////////////////////////////// | 77 /////////////////////////////////////////////////////////////////////////////// |
| 93 // HTMLPageScreen, WebPageDelegate implementation: | 78 // HTMLPageScreen, WebPageDelegate implementation: |
| 94 void HTMLPageScreen::OnPageLoaded() { | 79 void HTMLPageScreen::OnPageLoaded() { |
| 95 StopTimeoutTimer(); | 80 StopTimeoutTimer(); |
| 96 // Enable input methods (e.g. Chinese, Japanese) so that users could input | 81 // Enable input methods (e.g. Chinese, Japanese) so that users could input |
| 97 // their first and last names. | 82 // their first and last names. |
| (...skipping 28 matching lines...) Expand all Loading... |
| 126 if (g_browser_process) { | 111 if (g_browser_process) { |
| 127 const std::string locale = g_browser_process->GetApplicationLocale(); | 112 const std::string locale = g_browser_process->GetApplicationLocale(); |
| 128 input_method::InputMethodManager* manager = | 113 input_method::InputMethodManager* manager = |
| 129 input_method::InputMethodManager::GetInstance(); | 114 input_method::InputMethodManager::GetInstance(); |
| 130 manager->EnableInputMethods(locale, input_method::kKeyboardLayoutsOnly, ""); | 115 manager->EnableInputMethods(locale, input_method::kKeyboardLayoutsOnly, ""); |
| 131 } | 116 } |
| 132 delegate()->GetObserver()->OnExit(code); | 117 delegate()->GetObserver()->OnExit(code); |
| 133 } | 118 } |
| 134 | 119 |
| 135 } // namespace chromeos | 120 } // namespace chromeos |
| OLD | NEW |