Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5480)

Unified Diff: chrome/browser/chromeos/login/html_page_screen.cc

Issue 3158023: OOBE screen with HTML page specified from command line it is going to be used for recovery screen. (Closed) Base URL: http://src.chromium.org/git/chromium.git
Patch Set: Removed useless explicit Created 10 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/chromeos/login/html_page_screen.h ('k') | chrome/browser/chromeos/login/wizard_controller.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/chromeos/login/html_page_screen.cc
diff --git a/chrome/browser/chromeos/login/html_page_screen.cc b/chrome/browser/chromeos/login/html_page_screen.cc
new file mode 100644
index 0000000000000000000000000000000000000000..17bcaf0bdad71594a66b705128de7b6cfd8c851c
--- /dev/null
+++ b/chrome/browser/chromeos/login/html_page_screen.cc
@@ -0,0 +1,123 @@
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/chromeos/login/html_page_screen.h"
+
+#include "base/string_util.h"
+#include "base/utf_string_conversions.h"
+#include "chrome/browser/browser_process.h"
+#include "chrome/browser/chromeos/input_method/input_method_util.h"
+#include "chrome/browser/chromeos/login/screen_observer.h"
+#include "chrome/browser/profile_manager.h"
+#include "chrome/browser/renderer_host/render_view_host.h"
+#include "chrome/browser/renderer_host/site_instance.h"
+#include "chrome/browser/tab_contents/tab_contents.h"
+#include "googleurl/src/gurl.h"
+#include "views/widget/widget_gtk.h"
+
+namespace chromeos {
+
+static const char kHTMLPageDoneUrl[] = "about:blank";
+
+///////////////////////////////////////////////////////////////////////////////
+// HTMLPageDomView
+TabContents* HTMLPageDomView::CreateTabContents(Profile* profile,
+ SiteInstance* instance) {
+ return new WizardWebPageViewTabContents(profile,
+ instance,
+ page_delegate_);
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// HTMLPageView
+HTMLPageView::HTMLPageView()
+ : dom_view_(new HTMLPageDomView()) {
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// HTMLPageScreen, public:
+HTMLPageScreen::HTMLPageScreen(WizardScreenDelegate* delegate,
+ const std::string& url)
+ : ViewScreen<HTMLPageView>(delegate), url_(url) {
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// HTMLPageScreen, ViewScreen implementation:
+void HTMLPageScreen::CreateView() {
+ ViewScreen<HTMLPageView>::CreateView();
+ view()->SetWebPageDelegate(this);
+}
+
+void HTMLPageScreen::Refresh() {
+ LOG(INFO) << "HTMLPageScreen::Refresh(): " << url_;
+ StartTimeoutTimer();
+ GURL url(url_);
+ Profile* profile = ProfileManager::GetDefaultProfile();
+ view()->InitDOM(profile,
+ SiteInstance::CreateSiteInstanceForURL(profile, url));
+ view()->SetTabContentsDelegate(this);
+ view()->LoadURL(url);
+}
+
+HTMLPageView* HTMLPageScreen::AllocateView() {
+ return new HTMLPageView();
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// HTMLPageScreen, TabContentsDelegate implementation:
+void HTMLPageScreen::LoadingStateChanged(TabContents* source) {
+ std::string url = source->GetURL().spec();
+ if (url == kHTMLPageDoneUrl) {
+ source->Stop();
+ // TODO(dpolukhin): use special code for this case but now
+ // ACCOUNT_CREATE_BACK works as we would like, i.e. get to login page.
+ LOG(INFO) << "HTMLPageScreen::LoadingStateChanged: " << url;
+ CloseScreen(ScreenObserver::ACCOUNT_CREATE_BACK);
+ }
+}
+
+void HTMLPageScreen::NavigationStateChanged(const TabContents* source,
+ unsigned changed_flags) {
+}
+
+void HTMLPageScreen::HandleKeyboardEvent(const NativeWebKeyboardEvent& event) {
+ views::Widget* widget = view()->GetWidget();
+ if (widget && event.os_event && !event.skip_in_browser)
+ static_cast<views::WidgetGtk*>(widget)->HandleKeyboardEvent(event.os_event);
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// HTMLPageScreen, WebPageDelegate implementation:
+void HTMLPageScreen::OnPageLoaded() {
+ StopTimeoutTimer();
+ // Enable input methods (e.g. Chinese, Japanese) so that users could input
+ // their first and last names.
+ if (g_browser_process) {
+ const std::string locale = g_browser_process->GetApplicationLocale();
+ input_method::EnableInputMethods(
+ locale, input_method::kAllInputMethods, "");
+ }
+ view()->ShowPageContent();
+}
+
+void HTMLPageScreen::OnPageLoadFailed(const std::string& url) {
+ LOG(INFO) << "HTMLPageScreen::OnPageLoadFailed: " << url;
+ CloseScreen(ScreenObserver::CONNECTION_FAILED);
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// HTMLPageScreen, private:
+void HTMLPageScreen::CloseScreen(ScreenObserver::ExitCodes code) {
+ StopTimeoutTimer();
+ // Disable input methods since they are not necessary to input username and
+ // password.
+ if (g_browser_process) {
+ const std::string locale = g_browser_process->GetApplicationLocale();
+ input_method::EnableInputMethods(
+ locale, input_method::kKeyboardLayoutsOnly, "");
+ }
+ delegate()->GetObserver(this)->OnExit(code);
+}
+
+} // namespace chromeos
« no previous file with comments | « chrome/browser/chromeos/login/html_page_screen.h ('k') | chrome/browser/chromeos/login/wizard_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698