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

Side by Side Diff: chrome/browser/ui/webui/chromeos/login/oobe_ui.cc

Issue 608283003: Remove retail mode. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/ui/webui/chromeos/login/oobe_ui.h" 5 #include "chrome/browser/ui/webui/chromeos/login/oobe_ui.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/strings/stringprintf.h" 9 #include "base/strings/stringprintf.h"
10 #include "base/values.h" 10 #include "base/values.h"
11 #include "chrome/browser/browser_process.h" 11 #include "chrome/browser/browser_process.h"
12 #include "chrome/browser/browser_process_platform_part.h" 12 #include "chrome/browser/browser_process_platform_part.h"
13 #include "chrome/browser/chromeos/kiosk_mode/kiosk_mode_settings.h"
14 #include "chrome/browser/chromeos/login/enrollment/auto_enrollment_check_screen_ actor.h" 13 #include "chrome/browser/chromeos/login/enrollment/auto_enrollment_check_screen_ actor.h"
15 #include "chrome/browser/chromeos/login/enrollment/enrollment_screen_actor.h" 14 #include "chrome/browser/chromeos/login/enrollment/enrollment_screen_actor.h"
16 #include "chrome/browser/chromeos/login/screens/error_screen.h" 15 #include "chrome/browser/chromeos/login/screens/error_screen.h"
16 #include "chrome/browser/chromeos/login/ui/login_display_host.h"
17 #include "chrome/browser/chromeos/login/ui/login_display_host_impl.h"
17 #include "chrome/browser/chromeos/login/wizard_controller.h" 18 #include "chrome/browser/chromeos/login/wizard_controller.h"
18 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" 19 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h"
19 #include "chrome/browser/chromeos/policy/consumer_management_service.h" 20 #include "chrome/browser/chromeos/policy/consumer_management_service.h"
20 #include "chrome/browser/chromeos/system/input_device_settings.h" 21 #include "chrome/browser/chromeos/system/input_device_settings.h"
21 #include "chrome/browser/extensions/signin/gaia_auth_extension_loader.h" 22 #include "chrome/browser/extensions/signin/gaia_auth_extension_loader.h"
22 #include "chrome/browser/extensions/tab_helper.h" 23 #include "chrome/browser/extensions/tab_helper.h"
23 #include "chrome/browser/profiles/profile.h" 24 #include "chrome/browser/profiles/profile.h"
24 #include "chrome/browser/ui/webui/about_ui.h" 25 #include "chrome/browser/ui/webui/about_ui.h"
25 #include "chrome/browser/ui/webui/chromeos/login/app_launch_splash_screen_handle r.h" 26 #include "chrome/browser/ui/webui/chromeos/login/app_launch_splash_screen_handle r.h"
26 #include "chrome/browser/ui/webui/chromeos/login/auto_enrollment_check_screen_ha ndler.h" 27 #include "chrome/browser/ui/webui/chromeos/login/auto_enrollment_check_screen_ha ndler.h"
(...skipping 18 matching lines...) Expand all
45 #include "chrome/browser/ui/webui/chromeos/login/supervised_user_creation_screen _handler.h" 46 #include "chrome/browser/ui/webui/chromeos/login/supervised_user_creation_screen _handler.h"
46 #include "chrome/browser/ui/webui/chromeos/login/terms_of_service_screen_handler .h" 47 #include "chrome/browser/ui/webui/chromeos/login/terms_of_service_screen_handler .h"
47 #include "chrome/browser/ui/webui/chromeos/login/update_screen_handler.h" 48 #include "chrome/browser/ui/webui/chromeos/login/update_screen_handler.h"
48 #include "chrome/browser/ui/webui/chromeos/login/user_image_screen_handler.h" 49 #include "chrome/browser/ui/webui/chromeos/login/user_image_screen_handler.h"
49 #include "chrome/browser/ui/webui/chromeos/login/wrong_hwid_screen_handler.h" 50 #include "chrome/browser/ui/webui/chromeos/login/wrong_hwid_screen_handler.h"
50 #include "chrome/browser/ui/webui/options/chromeos/user_image_source.h" 51 #include "chrome/browser/ui/webui/options/chromeos/user_image_source.h"
51 #include "chrome/browser/ui/webui/theme_source.h" 52 #include "chrome/browser/ui/webui/theme_source.h"
52 #include "chrome/common/chrome_constants.h" 53 #include "chrome/common/chrome_constants.h"
53 #include "chrome/common/url_constants.h" 54 #include "chrome/common/url_constants.h"
54 #include "chromeos/chromeos_switches.h" 55 #include "chromeos/chromeos_switches.h"
56 #include "components/policy/core/common/cloud/cloud_policy_constants.h"
55 #include "content/public/browser/web_ui.h" 57 #include "content/public/browser/web_ui.h"
56 #include "content/public/browser/web_ui_data_source.h" 58 #include "content/public/browser/web_ui_data_source.h"
57 #include "grit/browser_resources.h" 59 #include "grit/browser_resources.h"
58 #include "grit/chrome_unscaled_resources.h" 60 #include "grit/chrome_unscaled_resources.h"
59 #include "ui/base/resource/resource_bundle.h" 61 #include "ui/base/resource/resource_bundle.h"
60 #include "ui/base/webui/web_ui_util.h" 62 #include "ui/base/webui/web_ui_util.h"
61 63
62 namespace chromeos { 64 namespace chromeos {
63 65
64 namespace { 66 namespace {
65 67
66 const char* kKnownDisplayTypes[] = { 68 const char* kKnownDisplayTypes[] = {
67 OobeUI::kOobeDisplay, 69 OobeUI::kOobeDisplay,
68 OobeUI::kLoginDisplay, 70 OobeUI::kLoginDisplay,
69 OobeUI::kLockDisplay, 71 OobeUI::kLockDisplay,
70 OobeUI::kUserAddingDisplay, 72 OobeUI::kUserAddingDisplay,
71 OobeUI::kAppLaunchSplashDisplay 73 OobeUI::kAppLaunchSplashDisplay
72 }; 74 };
73 75
74 const char kStringsJSPath[] = "strings.js"; 76 const char kStringsJSPath[] = "strings.js";
75 const char kLoginJSPath[] = "login.js"; 77 const char kLoginJSPath[] = "login.js";
76 const char kOobeJSPath[] = "oobe.js"; 78 const char kOobeJSPath[] = "oobe.js";
77 const char kKeyboardUtilsJSPath[] = "keyboard_utils.js"; 79 const char kKeyboardUtilsJSPath[] = "keyboard_utils.js";
78 const char kDemoUserLoginJSPath[] = "demo_user_login.js";
79 const char kCustomElementsHTMLPath[] = "custom_elements.html"; 80 const char kCustomElementsHTMLPath[] = "custom_elements.html";
80 const char kCustomElementsJSPath[] = "custom_elements.js"; 81 const char kCustomElementsJSPath[] = "custom_elements.js";
81 82
82 // Paths for deferred resource loading. 83 // Paths for deferred resource loading.
83 const char kEnrollmentHTMLPath[] = "enrollment.html"; 84 const char kEnrollmentHTMLPath[] = "enrollment.html";
84 const char kEnrollmentCSSPath[] = "enrollment.css"; 85 const char kEnrollmentCSSPath[] = "enrollment.css";
85 const char kEnrollmentJSPath[] = "enrollment.js"; 86 const char kEnrollmentJSPath[] = "enrollment.js";
86 87
87 // Creates a WebUIDataSource for chrome://oobe 88 // Creates a WebUIDataSource for chrome://oobe
88 content::WebUIDataSource* CreateOobeUIDataSource( 89 content::WebUIDataSource* CreateOobeUIDataSource(
89 const base::DictionaryValue& localized_strings, 90 const base::DictionaryValue& localized_strings,
90 const std::string& display_type) { 91 const std::string& display_type) {
91 content::WebUIDataSource* source = 92 content::WebUIDataSource* source =
92 content::WebUIDataSource::Create(chrome::kChromeUIOobeHost); 93 content::WebUIDataSource::Create(chrome::kChromeUIOobeHost);
93 source->AddLocalizedStrings(localized_strings); 94 source->AddLocalizedStrings(localized_strings);
94 source->SetJsonPath(kStringsJSPath); 95 source->SetJsonPath(kStringsJSPath);
95 96
96 if (chromeos::KioskModeSettings::Get()->IsKioskModeEnabled()) {
97 source->SetDefaultResource(IDR_DEMO_USER_LOGIN_HTML);
98 source->AddResourcePath(kDemoUserLoginJSPath, IDR_DEMO_USER_LOGIN_JS);
99 return source;
100 }
101 if (display_type == OobeUI::kOobeDisplay) { 97 if (display_type == OobeUI::kOobeDisplay) {
102 source->SetDefaultResource(IDR_OOBE_HTML); 98 source->SetDefaultResource(IDR_OOBE_HTML);
103 source->AddResourcePath(kOobeJSPath, IDR_OOBE_JS); 99 source->AddResourcePath(kOobeJSPath, IDR_OOBE_JS);
104 } else { 100 } else {
105 source->SetDefaultResource(IDR_LOGIN_HTML); 101 source->SetDefaultResource(IDR_LOGIN_HTML);
106 source->AddResourcePath(kLoginJSPath, IDR_LOGIN_JS); 102 source->AddResourcePath(kLoginJSPath, IDR_LOGIN_JS);
107 } 103 }
108 source->AddResourcePath(kKeyboardUtilsJSPath, IDR_KEYBOARD_UTILS_JS); 104 source->AddResourcePath(kKeyboardUtilsJSPath, IDR_KEYBOARD_UTILS_JS);
109 source->OverrideContentSecurityPolicyFrameSrc( 105 source->OverrideContentSecurityPolicyFrameSrc(
110 base::StringPrintf( 106 base::StringPrintf(
(...skipping 448 matching lines...) Expand 10 before | Expand all | Expand 10 after
559 bool OobeUI::IsJSReady(const base::Closure& display_is_ready_callback) { 555 bool OobeUI::IsJSReady(const base::Closure& display_is_ready_callback) {
560 if (!ready_) 556 if (!ready_)
561 ready_callbacks_.push_back(display_is_ready_callback); 557 ready_callbacks_.push_back(display_is_ready_callback);
562 return ready_; 558 return ready_;
563 } 559 }
564 560
565 void OobeUI::ShowOobeUI(bool show) { 561 void OobeUI::ShowOobeUI(bool show) {
566 core_handler_->ShowOobeUI(show); 562 core_handler_->ShowOobeUI(show);
567 } 563 }
568 564
569 void OobeUI::ShowRetailModeLoginSpinner() {
570 signin_screen_handler_->ShowRetailModeLoginSpinner();
571 }
572
573 void OobeUI::ShowSigninScreen(const LoginScreenContext& context, 565 void OobeUI::ShowSigninScreen(const LoginScreenContext& context,
574 SigninScreenHandlerDelegate* delegate, 566 SigninScreenHandlerDelegate* delegate,
575 NativeWindowDelegate* native_window_delegate) { 567 NativeWindowDelegate* native_window_delegate) {
568 // Check our device mode.
569 policy::BrowserPolicyConnectorChromeOS* connector =
570 g_browser_process->platform_part()->browser_policy_connector_chromeos();
571 if (connector->GetDeviceMode() == policy::DEVICE_MODE_LEGACY_RETAIL_MODE) {
572 // If we're in legacy retail mode, the best thing we can do is launch the
573 // new offline demo mode.
574 LoginDisplayHost* host = LoginDisplayHostImpl::default_host();
575 host->StartDemoAppLaunch();
576 return;
577 }
578
576 signin_screen_handler_->SetDelegate(delegate); 579 signin_screen_handler_->SetDelegate(delegate);
577 signin_screen_handler_->SetNativeWindowDelegate(native_window_delegate); 580 signin_screen_handler_->SetNativeWindowDelegate(native_window_delegate);
578 581
579 LoginScreenContext actual_context(context); 582 LoginScreenContext actual_context(context);
580 actual_context.set_oobe_ui(core_handler_->show_oobe_ui()); 583 actual_context.set_oobe_ui(core_handler_->show_oobe_ui());
581 signin_screen_handler_->Show(actual_context); 584 signin_screen_handler_->Show(actual_context);
582 } 585 }
583 586
584 void OobeUI::ResetSigninScreenHandlerDelegate() { 587 void OobeUI::ResetSigninScreenHandlerDelegate() {
585 signin_screen_handler_->SetDelegate(NULL); 588 signin_screen_handler_->SetDelegate(NULL);
(...skipping 19 matching lines...) Expand all
605 DCHECK(screen_ids_.count(screen)) 608 DCHECK(screen_ids_.count(screen))
606 << "Screen should be registered in InitializeScreenMaps()"; 609 << "Screen should be registered in InitializeScreenMaps()";
607 Screen new_screen = screen_ids_[screen]; 610 Screen new_screen = screen_ids_[screen];
608 FOR_EACH_OBSERVER(Observer, 611 FOR_EACH_OBSERVER(Observer,
609 observer_list_, 612 observer_list_,
610 OnCurrentScreenChanged(current_screen_, new_screen)); 613 OnCurrentScreenChanged(current_screen_, new_screen));
611 current_screen_ = new_screen; 614 current_screen_ = new_screen;
612 } 615 }
613 616
614 } // namespace chromeos 617 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698