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