OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/signin/md_user_manager_ui.h" | 5 #include "chrome/browser/ui/webui/signin/md_user_manager_ui.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/values.h" | 9 #include "base/values.h" |
10 #include "chrome/browser/browser_process.h" | 10 #include "chrome/browser/browser_process.h" |
11 #include "chrome/browser/profiles/profile.h" | 11 #include "chrome/browser/profiles/profile.h" |
12 #include "chrome/browser/ui/webui/signin/signin_create_profile_handler.h" | 12 #include "chrome/browser/ui/webui/signin/signin_create_profile_handler.h" |
13 #include "chrome/browser/ui/webui/signin/user_manager_screen_handler.h" | 13 #include "chrome/browser/ui/webui/signin/user_manager_screen_handler.h" |
14 #include "chrome/browser/ui/webui/theme_source.h" | 14 #include "chrome/browser/ui/webui/theme_source.h" |
| 15 #include "chrome/common/features.h" |
15 #include "chrome/common/url_constants.h" | 16 #include "chrome/common/url_constants.h" |
16 #include "chrome/grit/browser_resources.h" | 17 #include "chrome/grit/browser_resources.h" |
17 #include "chrome/grit/settings_resources.h" | 18 #include "chrome/grit/settings_resources.h" |
18 #include "content/public/browser/web_ui.h" | 19 #include "content/public/browser/web_ui.h" |
19 #include "content/public/browser/web_ui_data_source.h" | 20 #include "content/public/browser/web_ui_data_source.h" |
20 #include "ui/base/resource/resource_bundle.h" | 21 #include "ui/base/resource/resource_bundle.h" |
21 #include "ui/base/webui/web_ui_util.h" | 22 #include "ui/base/webui/web_ui_util.h" |
22 | 23 |
23 #if defined(ENABLE_SUPERVISED_USERS) | 24 #if BUILDFLAG(ENABLE_SUPERVISED_USERS) |
24 #include "chrome/browser/ui/webui/signin/signin_supervised_user_import_handler.h
" | 25 #include "chrome/browser/ui/webui/signin/signin_supervised_user_import_handler.h
" |
25 #endif | 26 #endif |
26 | 27 |
27 MDUserManagerUI::MDUserManagerUI(content::WebUI* web_ui) | 28 MDUserManagerUI::MDUserManagerUI(content::WebUI* web_ui) |
28 : WebUIController(web_ui), | 29 : WebUIController(web_ui), |
29 signin_create_profile_handler_(new SigninCreateProfileHandler()), | 30 signin_create_profile_handler_(new SigninCreateProfileHandler()), |
30 user_manager_screen_handler_(new UserManagerScreenHandler()) { | 31 user_manager_screen_handler_(new UserManagerScreenHandler()) { |
31 // The web_ui object takes ownership of these handlers, and will | 32 // The web_ui object takes ownership of these handlers, and will |
32 // destroy them when it (the WebUI) is destroyed. | 33 // destroy them when it (the WebUI) is destroyed. |
33 web_ui->AddMessageHandler(signin_create_profile_handler_); | 34 web_ui->AddMessageHandler(signin_create_profile_handler_); |
34 web_ui->AddMessageHandler(user_manager_screen_handler_); | 35 web_ui->AddMessageHandler(user_manager_screen_handler_); |
35 #if defined(ENABLE_SUPERVISED_USERS) | 36 #if BUILDFLAG(ENABLE_SUPERVISED_USERS) |
36 signin_supervised_user_import_handler_ = | 37 signin_supervised_user_import_handler_ = |
37 new SigninSupervisedUserImportHandler(); | 38 new SigninSupervisedUserImportHandler(); |
38 web_ui->AddMessageHandler(signin_supervised_user_import_handler_); | 39 web_ui->AddMessageHandler(signin_supervised_user_import_handler_); |
39 #endif | 40 #endif |
40 | 41 |
41 base::DictionaryValue localized_strings; | 42 base::DictionaryValue localized_strings; |
42 GetLocalizedStrings(&localized_strings); | 43 GetLocalizedStrings(&localized_strings); |
43 | 44 |
44 Profile* profile = Profile::FromWebUI(web_ui); | 45 Profile* profile = Profile::FromWebUI(web_ui); |
45 // Set up the chrome://md-user-manager/ source. | 46 // Set up the chrome://md-user-manager/ source. |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 | 104 |
104 source->SetDefaultResource(IDR_MD_USER_MANAGER_HTML); | 105 source->SetDefaultResource(IDR_MD_USER_MANAGER_HTML); |
105 | 106 |
106 return source; | 107 return source; |
107 } | 108 } |
108 | 109 |
109 void MDUserManagerUI::GetLocalizedStrings( | 110 void MDUserManagerUI::GetLocalizedStrings( |
110 base::DictionaryValue* localized_strings) { | 111 base::DictionaryValue* localized_strings) { |
111 user_manager_screen_handler_->GetLocalizedValues(localized_strings); | 112 user_manager_screen_handler_->GetLocalizedValues(localized_strings); |
112 signin_create_profile_handler_->GetLocalizedValues(localized_strings); | 113 signin_create_profile_handler_->GetLocalizedValues(localized_strings); |
113 #if defined(ENABLE_SUPERVISED_USERS) | 114 #if BUILDFLAG(ENABLE_SUPERVISED_USERS) |
114 signin_supervised_user_import_handler_->GetLocalizedValues(localized_strings); | 115 signin_supervised_user_import_handler_->GetLocalizedValues(localized_strings); |
115 #endif | 116 #endif |
116 const std::string& app_locale = g_browser_process->GetApplicationLocale(); | 117 const std::string& app_locale = g_browser_process->GetApplicationLocale(); |
117 webui::SetLoadTimeDataDefaults(app_locale, localized_strings); | 118 webui::SetLoadTimeDataDefaults(app_locale, localized_strings); |
118 | 119 |
119 #if defined(GOOGLE_CHROME_BUILD) | 120 #if defined(GOOGLE_CHROME_BUILD) |
120 localized_strings->SetString("buildType", "chrome"); | 121 localized_strings->SetString("buildType", "chrome"); |
121 #else | 122 #else |
122 localized_strings->SetString("buildType", "chromium"); | 123 localized_strings->SetString("buildType", "chromium"); |
123 #endif | 124 #endif |
124 } | 125 } |
OLD | NEW |