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

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

Issue 13963004: Extract common OOBE controller code from oobe.js/login.js. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: small fixes Created 7 years, 8 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 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 <string> 7 #include <string>
8 8
9 #include "ash/ash_switches.h" 9 #include "ash/ash_switches.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 namespace { 50 namespace {
51 51
52 // Path for a stripped down login page that does not have OOBE elements. 52 // Path for a stripped down login page that does not have OOBE elements.
53 const char kLoginPath[] = "login"; 53 const char kLoginPath[] = "login";
54 54
55 // Path for the enterprise enrollment gaia page hosting. 55 // Path for the enterprise enrollment gaia page hosting.
56 const char kEnterpriseEnrollmentGaiaLoginPath[] = "gaialogin"; 56 const char kEnterpriseEnrollmentGaiaLoginPath[] = "gaialogin";
57 57
58 const char kStringsJSPath[] = "strings.js"; 58 const char kStringsJSPath[] = "strings.js";
59 const char kLoginJSPath[] = "login.js"; 59 const char kLoginJSPath[] = "login.js";
60 const char kOobeCommonJSPath[] = "oobe_common.js";
dzhioev (left Google) 2013/04/16 10:47:48 I think it is not needed.
dconnelly 2013/04/16 11:11:22 Done.
60 const char kOobeJSPath[] = "oobe.js"; 61 const char kOobeJSPath[] = "oobe.js";
61 const char kDemoUserLoginJSPath[] = "demo_user_login.js"; 62 const char kDemoUserLoginJSPath[] = "demo_user_login.js";
62 63
63 // Filter handler of chrome://oobe data source. 64 // Filter handler of chrome://oobe data source.
64 bool HandleRequestCallback( 65 bool HandleRequestCallback(
65 const std::string& path, 66 const std::string& path,
66 const content::WebUIDataSource::GotDataCallback& callback) { 67 const content::WebUIDataSource::GotDataCallback& callback) {
67 if (UserManager::Get()->IsUserLoggedIn() && 68 if (UserManager::Get()->IsUserLoggedIn() &&
68 !UserManager::Get()->IsLoggedInAsStub() && 69 !UserManager::Get()->IsLoggedInAsStub() &&
69 !ScreenLocker::default_screen_locker()) { 70 !ScreenLocker::default_screen_locker()) {
(...skipping 16 matching lines...) Expand all
86 source->SetJsonPath(kStringsJSPath); 87 source->SetJsonPath(kStringsJSPath);
87 88
88 if (chromeos::KioskModeSettings::Get()->IsKioskModeEnabled()) { 89 if (chromeos::KioskModeSettings::Get()->IsKioskModeEnabled()) {
89 source->SetDefaultResource(IDR_DEMO_USER_LOGIN_HTML); 90 source->SetDefaultResource(IDR_DEMO_USER_LOGIN_HTML);
90 source->AddResourcePath(kDemoUserLoginJSPath, 91 source->AddResourcePath(kDemoUserLoginJSPath,
91 IDR_DEMO_USER_LOGIN_JS); 92 IDR_DEMO_USER_LOGIN_JS);
92 return source; 93 return source;
93 } 94 }
94 95
95 source->SetDefaultResource(IDR_OOBE_HTML); 96 source->SetDefaultResource(IDR_OOBE_HTML);
97 source->AddResourcePath(kOobeCommonJSPath,
dzhioev (left Google) 2013/04/16 10:47:48 Not needed to.
dconnelly 2013/04/16 11:11:22 Done.
98 IDR_OOBE_COMMON_JS);
96 source->AddResourcePath(kOobeJSPath, 99 source->AddResourcePath(kOobeJSPath,
97 IDR_OOBE_JS); 100 IDR_OOBE_JS);
98 source->AddResourcePath(kLoginPath, 101 source->AddResourcePath(kLoginPath,
99 IDR_LOGIN_HTML); 102 IDR_LOGIN_HTML);
100 source->AddResourcePath(kLoginJSPath, 103 source->AddResourcePath(kLoginJSPath,
101 IDR_LOGIN_JS); 104 IDR_LOGIN_JS);
102 source->AddResourcePath(kEnterpriseEnrollmentGaiaLoginPath, 105 source->AddResourcePath(kEnterpriseEnrollmentGaiaLoginPath,
103 IDR_GAIA_LOGIN_HTML); 106 IDR_GAIA_LOGIN_HTML);
104 source->OverrideContentSecurityPolicyFrameSrc( 107 source->OverrideContentSecurityPolicyFrameSrc(
105 "frame-src chrome://terms/ " 108 "frame-src chrome://terms/ "
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after
388 void OobeUI::OnCurrentScreenChanged(const std::string& screen) { 391 void OobeUI::OnCurrentScreenChanged(const std::string& screen) {
389 if (screen_ids_.count(screen)) { 392 if (screen_ids_.count(screen)) {
390 current_screen_ = screen_ids_[screen]; 393 current_screen_ = screen_ids_[screen];
391 } else { 394 } else {
392 NOTREACHED() << "Screen should be registered in InitializeScreenMaps()"; 395 NOTREACHED() << "Screen should be registered in InitializeScreenMaps()";
393 current_screen_ = SCREEN_UNKNOWN; 396 current_screen_ = SCREEN_UNKNOWN;
394 } 397 }
395 } 398 }
396 399
397 } // namespace chromeos 400 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698