| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "ash/shell_window_ids.h" | 9 #include "ash/shell_window_ids.h" |
| 10 #include "ash/wm/screen_dimmer.h" | 10 #include "ash/wm/screen_dimmer.h" |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 #include "chrome/browser/ui/webui/chromeos/login/network_state_informer.h" | 50 #include "chrome/browser/ui/webui/chromeos/login/network_state_informer.h" |
| 51 #include "chrome/browser/ui/webui/chromeos/login/reset_screen_handler.h" | 51 #include "chrome/browser/ui/webui/chromeos/login/reset_screen_handler.h" |
| 52 #include "chrome/browser/ui/webui/chromeos/login/signin_screen_handler.h" | 52 #include "chrome/browser/ui/webui/chromeos/login/signin_screen_handler.h" |
| 53 #include "chrome/browser/ui/webui/chromeos/login/supervised_user_creation_screen
_handler.h" | 53 #include "chrome/browser/ui/webui/chromeos/login/supervised_user_creation_screen
_handler.h" |
| 54 #include "chrome/browser/ui/webui/chromeos/login/terms_of_service_screen_handler
.h" | 54 #include "chrome/browser/ui/webui/chromeos/login/terms_of_service_screen_handler
.h" |
| 55 #include "chrome/browser/ui/webui/chromeos/login/update_screen_handler.h" | 55 #include "chrome/browser/ui/webui/chromeos/login/update_screen_handler.h" |
| 56 #include "chrome/browser/ui/webui/chromeos/login/user_board_screen_handler.h" | 56 #include "chrome/browser/ui/webui/chromeos/login/user_board_screen_handler.h" |
| 57 #include "chrome/browser/ui/webui/chromeos/login/user_image_screen_handler.h" | 57 #include "chrome/browser/ui/webui/chromeos/login/user_image_screen_handler.h" |
| 58 #include "chrome/browser/ui/webui/chromeos/login/wrong_hwid_screen_handler.h" | 58 #include "chrome/browser/ui/webui/chromeos/login/wrong_hwid_screen_handler.h" |
| 59 #include "chrome/browser/ui/webui/options/chromeos/user_image_source.h" | 59 #include "chrome/browser/ui/webui/options/chromeos/user_image_source.h" |
| 60 #include "chrome/browser/ui/webui/test_files_request_filter.h" |
| 60 #include "chrome/browser/ui/webui/theme_source.h" | 61 #include "chrome/browser/ui/webui/theme_source.h" |
| 61 #include "chrome/common/chrome_constants.h" | 62 #include "chrome/common/chrome_constants.h" |
| 63 #include "chrome/common/chrome_switches.h" |
| 62 #include "chrome/common/url_constants.h" | 64 #include "chrome/common/url_constants.h" |
| 63 #include "chromeos/chromeos_switches.h" | 65 #include "chromeos/chromeos_switches.h" |
| 64 #include "components/policy/core/common/cloud/cloud_policy_constants.h" | 66 #include "components/policy/core/common/cloud/cloud_policy_constants.h" |
| 65 #include "content/public/browser/web_ui.h" | 67 #include "content/public/browser/web_ui.h" |
| 66 #include "content/public/browser/web_ui_data_source.h" | 68 #include "content/public/browser/web_ui_data_source.h" |
| 69 #include "content/public/common/content_switches.h" |
| 67 #include "grit/browser_resources.h" | 70 #include "grit/browser_resources.h" |
| 68 #include "grit/chrome_unscaled_resources.h" | 71 #include "grit/chrome_unscaled_resources.h" |
| 69 #include "ui/base/resource/resource_bundle.h" | 72 #include "ui/base/resource/resource_bundle.h" |
| 70 #include "ui/base/webui/web_ui_util.h" | 73 #include "ui/base/webui/web_ui_util.h" |
| 71 | 74 |
| 72 namespace chromeos { | 75 namespace chromeos { |
| 73 | 76 |
| 74 namespace { | 77 namespace { |
| 75 | 78 |
| 76 const char* kKnownDisplayTypes[] = { | 79 const char* kKnownDisplayTypes[] = { |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 source->AddResourcePath(kEnrollmentJSPath, IDR_OOBE_ENROLLMENT_JS); | 136 source->AddResourcePath(kEnrollmentJSPath, IDR_OOBE_ENROLLMENT_JS); |
| 134 | 137 |
| 135 if (display_type == OobeUI::kOobeDisplay) { | 138 if (display_type == OobeUI::kOobeDisplay) { |
| 136 source->AddResourcePath("Roboto-Thin.ttf", IDR_FONT_ROBOTO_THIN); | 139 source->AddResourcePath("Roboto-Thin.ttf", IDR_FONT_ROBOTO_THIN); |
| 137 source->AddResourcePath("Roboto-Light.ttf", IDR_FONT_ROBOTO_LIGHT); | 140 source->AddResourcePath("Roboto-Light.ttf", IDR_FONT_ROBOTO_LIGHT); |
| 138 source->AddResourcePath("Roboto-Regular.ttf", IDR_FONT_ROBOTO_REGULAR); | 141 source->AddResourcePath("Roboto-Regular.ttf", IDR_FONT_ROBOTO_REGULAR); |
| 139 source->AddResourcePath("Roboto-Medium.ttf", IDR_FONT_ROBOTO_MEDIUM); | 142 source->AddResourcePath("Roboto-Medium.ttf", IDR_FONT_ROBOTO_MEDIUM); |
| 140 source->AddResourcePath("Roboto-Bold.ttf", IDR_FONT_ROBOTO_BOLD); | 143 source->AddResourcePath("Roboto-Bold.ttf", IDR_FONT_ROBOTO_BOLD); |
| 141 } | 144 } |
| 142 | 145 |
| 146 // Only add a filter when runing as test. |
| 147 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); |
| 148 const bool is_running_test = command_line->HasSwitch(::switches::kTestName) || |
| 149 command_line->HasSwitch(::switches::kTestType); |
| 150 if (is_running_test) |
| 151 source->SetRequestFilter(::test::GetTestFilesRequestFilter()); |
| 152 |
| 143 return source; | 153 return source; |
| 144 } | 154 } |
| 145 | 155 |
| 146 std::string GetDisplayType(const GURL& url) { | 156 std::string GetDisplayType(const GURL& url) { |
| 147 std::string path = url.path().size() ? url.path().substr(1) : ""; | 157 std::string path = url.path().size() ? url.path().substr(1) : ""; |
| 148 if (std::find(kKnownDisplayTypes, | 158 if (std::find(kKnownDisplayTypes, |
| 149 kKnownDisplayTypes + arraysize(kKnownDisplayTypes), | 159 kKnownDisplayTypes + arraysize(kKnownDisplayTypes), |
| 150 path) == kKnownDisplayTypes + arraysize(kKnownDisplayTypes)) { | 160 path) == kKnownDisplayTypes + arraysize(kKnownDisplayTypes)) { |
| 151 LOG(ERROR) << "Unknown display type '" << path << "'. Setting default."; | 161 LOG(ERROR) << "Unknown display type '" << path << "'. Setting default."; |
| 152 return OobeUI::kLoginDisplay; | 162 return OobeUI::kLoginDisplay; |
| (...skipping 499 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 652 screen_dimmer->set_at_bottom(true); | 662 screen_dimmer->set_at_bottom(true); |
| 653 screen_dimmer->SetDimming(should_dim); | 663 screen_dimmer->SetDimming(should_dim); |
| 654 | 664 |
| 655 FOR_EACH_OBSERVER(Observer, | 665 FOR_EACH_OBSERVER(Observer, |
| 656 observer_list_, | 666 observer_list_, |
| 657 OnCurrentScreenChanged(current_screen_, new_screen)); | 667 OnCurrentScreenChanged(current_screen_, new_screen)); |
| 658 current_screen_ = new_screen; | 668 current_screen_ = new_screen; |
| 659 } | 669 } |
| 660 | 670 |
| 661 } // namespace chromeos | 671 } // namespace chromeos |
| OLD | NEW |