| 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/url_constants.h" | 15 #include "chrome/common/url_constants.h" |
| 16 #include "content/public/browser/web_ui.h" | 16 #include "content/public/browser/web_ui.h" |
| 17 #include "content/public/browser/web_ui_data_source.h" | 17 #include "content/public/browser/web_ui_data_source.h" |
| 18 #include "grit/browser_resources.h" | 18 #include "grit/browser_resources.h" |
| 19 #include "grit/settings_resources.h" | 19 #include "grit/settings_resources.h" |
| 20 #include "ui/base/resource/resource_bundle.h" | 20 #include "ui/base/resource/resource_bundle.h" |
| 21 #include "ui/base/webui/web_ui_util.h" | 21 #include "ui/base/webui/web_ui_util.h" |
| 22 | 22 |
| 23 #if defined(ENABLE_SUPERVISED_USERS) |
| 24 #include "chrome/browser/ui/webui/signin/signin_supervised_user_import_handler.h
" |
| 25 #endif |
| 26 |
| 23 MDUserManagerUI::MDUserManagerUI(content::WebUI* web_ui) | 27 MDUserManagerUI::MDUserManagerUI(content::WebUI* web_ui) |
| 24 : WebUIController(web_ui), | 28 : WebUIController(web_ui), |
| 25 signin_create_profile_handler_(new SigninCreateProfileHandler()), | 29 signin_create_profile_handler_(new SigninCreateProfileHandler()), |
| 26 user_manager_screen_handler_(new UserManagerScreenHandler()) { | 30 user_manager_screen_handler_(new UserManagerScreenHandler()) { |
| 27 // The web_ui object takes ownership of these handlers, and will | 31 // The web_ui object takes ownership of these handlers, and will |
| 28 // destroy them when it (the WebUI) is destroyed. | 32 // destroy them when it (the WebUI) is destroyed. |
| 29 web_ui->AddMessageHandler(signin_create_profile_handler_); | 33 web_ui->AddMessageHandler(signin_create_profile_handler_); |
| 30 web_ui->AddMessageHandler(user_manager_screen_handler_); | 34 web_ui->AddMessageHandler(user_manager_screen_handler_); |
| 35 #if defined(ENABLE_SUPERVISED_USERS) |
| 36 signin_supervised_user_import_handler_ = |
| 37 new SigninSupervisedUserImportHandler(); |
| 38 web_ui->AddMessageHandler(signin_supervised_user_import_handler_); |
| 39 #endif |
| 31 | 40 |
| 32 base::DictionaryValue localized_strings; | 41 base::DictionaryValue localized_strings; |
| 33 GetLocalizedStrings(&localized_strings); | 42 GetLocalizedStrings(&localized_strings); |
| 34 | 43 |
| 35 Profile* profile = Profile::FromWebUI(web_ui); | 44 Profile* profile = Profile::FromWebUI(web_ui); |
| 36 // Set up the chrome://user-chooser/ source. | 45 // Set up the chrome://user-chooser/ source. |
| 37 content::WebUIDataSource::Add(profile, CreateUIDataSource(localized_strings)); | 46 content::WebUIDataSource::Add(profile, CreateUIDataSource(localized_strings)); |
| 38 | 47 |
| 39 #if defined(ENABLE_THEMES) | 48 #if defined(ENABLE_THEMES) |
| 40 // Set up the chrome://theme/ source | 49 // Set up the chrome://theme/ source |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 signin_create_profile_handler_->GetLocalizedValues(localized_strings); | 107 signin_create_profile_handler_->GetLocalizedValues(localized_strings); |
| 99 const std::string& app_locale = g_browser_process->GetApplicationLocale(); | 108 const std::string& app_locale = g_browser_process->GetApplicationLocale(); |
| 100 webui::SetLoadTimeDataDefaults(app_locale, localized_strings); | 109 webui::SetLoadTimeDataDefaults(app_locale, localized_strings); |
| 101 | 110 |
| 102 #if defined(GOOGLE_CHROME_BUILD) | 111 #if defined(GOOGLE_CHROME_BUILD) |
| 103 localized_strings->SetString("buildType", "chrome"); | 112 localized_strings->SetString("buildType", "chrome"); |
| 104 #else | 113 #else |
| 105 localized_strings->SetString("buildType", "chromium"); | 114 localized_strings->SetString("buildType", "chromium"); |
| 106 #endif | 115 #endif |
| 107 } | 116 } |
| OLD | NEW |