| OLD | NEW |
| 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 "ash/ash_switches.h" | 7 #include "ash/ash_switches.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/memory/ref_counted_memory.h" | 10 #include "base/memory/ref_counted_memory.h" |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 const char kLoginJSPath[] = "login.js"; | 74 const char kLoginJSPath[] = "login.js"; |
| 75 const char kOobeJSPath[] = "oobe.js"; | 75 const char kOobeJSPath[] = "oobe.js"; |
| 76 const char kKeyboardUtilsJSPath[] = "keyboard_utils.js"; | 76 const char kKeyboardUtilsJSPath[] = "keyboard_utils.js"; |
| 77 const char kDemoUserLoginJSPath[] = "demo_user_login.js"; | 77 const char kDemoUserLoginJSPath[] = "demo_user_login.js"; |
| 78 | 78 |
| 79 // Paths for deferred resource loading. | 79 // Paths for deferred resource loading. |
| 80 const char kEnrollmentHTMLPath[] = "enrollment.html"; | 80 const char kEnrollmentHTMLPath[] = "enrollment.html"; |
| 81 const char kEnrollmentCSSPath[] = "enrollment.css"; | 81 const char kEnrollmentCSSPath[] = "enrollment.css"; |
| 82 const char kEnrollmentJSPath[] = "enrollment.js"; | 82 const char kEnrollmentJSPath[] = "enrollment.js"; |
| 83 | 83 |
| 84 // Filter handler of chrome://oobe data source. | |
| 85 bool HandleRequestCallback( | |
| 86 const std::string& path, | |
| 87 const content::WebUIDataSource::GotDataCallback& callback) { | |
| 88 if (UserManager::Get()->IsUserLoggedIn() && | |
| 89 !UserManager::Get()->IsLoggedInAsStub() && | |
| 90 !ScreenLocker::default_screen_locker()) { | |
| 91 scoped_refptr<base::RefCountedBytes> empty_bytes = | |
| 92 new base::RefCountedBytes(); | |
| 93 callback.Run(empty_bytes.get()); | |
| 94 return true; | |
| 95 } | |
| 96 | |
| 97 return false; | |
| 98 } | |
| 99 | |
| 100 // Creates a WebUIDataSource for chrome://oobe | 84 // Creates a WebUIDataSource for chrome://oobe |
| 101 content::WebUIDataSource* CreateOobeUIDataSource( | 85 content::WebUIDataSource* CreateOobeUIDataSource( |
| 102 const base::DictionaryValue& localized_strings, | 86 const base::DictionaryValue& localized_strings, |
| 103 const std::string& display_type) { | 87 const std::string& display_type) { |
| 104 content::WebUIDataSource* source = | 88 content::WebUIDataSource* source = |
| 105 content::WebUIDataSource::Create(chrome::kChromeUIOobeHost); | 89 content::WebUIDataSource::Create(chrome::kChromeUIOobeHost); |
| 106 source->SetUseJsonJSFormatV2(); | 90 source->SetUseJsonJSFormatV2(); |
| 107 source->AddLocalizedStrings(localized_strings); | 91 source->AddLocalizedStrings(localized_strings); |
| 108 source->SetJsonPath(kStringsJSPath); | 92 source->SetJsonPath(kStringsJSPath); |
| 109 | 93 |
| (...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 479 observer_list_, | 463 observer_list_, |
| 480 OnCurrentScreenChanged(current_screen_, new_screen)); | 464 OnCurrentScreenChanged(current_screen_, new_screen)); |
| 481 current_screen_ = new_screen; | 465 current_screen_ = new_screen; |
| 482 } else { | 466 } else { |
| 483 NOTREACHED() << "Screen should be registered in InitializeScreenMaps()"; | 467 NOTREACHED() << "Screen should be registered in InitializeScreenMaps()"; |
| 484 current_screen_ = SCREEN_UNKNOWN; | 468 current_screen_ = SCREEN_UNKNOWN; |
| 485 } | 469 } |
| 486 } | 470 } |
| 487 | 471 |
| 488 } // namespace chromeos | 472 } // namespace chromeos |
| OLD | NEW |