| 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/signin_error_ui.h" | 5 #include "chrome/browser/ui/webui/signin/signin_error_ui.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
| 10 #include "chrome/browser/browser_process.h" | 10 #include "chrome/browser/browser_process.h" |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 ->IsSystemProfile())) {} | 32 ->IsSystemProfile())) {} |
| 33 | 33 |
| 34 SigninErrorUI::SigninErrorUI(content::WebUI* web_ui, | 34 SigninErrorUI::SigninErrorUI(content::WebUI* web_ui, |
| 35 SigninErrorHandler* handler) | 35 SigninErrorHandler* handler) |
| 36 : WebDialogUI(web_ui) { | 36 : WebDialogUI(web_ui) { |
| 37 Profile* webui_profile = Profile::FromWebUI(web_ui); | 37 Profile* webui_profile = Profile::FromWebUI(web_ui); |
| 38 Profile* signin_profile; | 38 Profile* signin_profile; |
| 39 bool is_system_profile = | 39 bool is_system_profile = |
| 40 webui_profile->GetOriginalProfile()->IsSystemProfile(); | 40 webui_profile->GetOriginalProfile()->IsSystemProfile(); |
| 41 | 41 |
| 42 // TODO(zmin): Remove the condition for MACOSX once user_manager_mac.cc is | |
| 43 // updated. | |
| 44 #if !defined(OS_MACOSX) | |
| 45 if (is_system_profile) { | 42 if (is_system_profile) { |
| 46 signin_profile = g_browser_process->profile_manager()->GetProfileByPath( | 43 signin_profile = g_browser_process->profile_manager()->GetProfileByPath( |
| 47 UserManager::GetSigninProfilePath()); | 44 UserManager::GetSigninProfilePath()); |
| 48 } else { | 45 } else { |
| 49 signin_profile = webui_profile; | 46 signin_profile = webui_profile; |
| 50 } | 47 } |
| 51 #else | |
| 52 signin_profile = webui_profile; | |
| 53 #endif | |
| 54 | 48 |
| 55 content::WebUIDataSource* source = | 49 content::WebUIDataSource* source = |
| 56 content::WebUIDataSource::Create(chrome::kChromeUISigninErrorHost); | 50 content::WebUIDataSource::Create(chrome::kChromeUISigninErrorHost); |
| 57 source->SetJsonPath("strings.js"); | 51 source->SetJsonPath("strings.js"); |
| 58 source->SetDefaultResource(IDR_SIGNIN_ERROR_HTML); | 52 source->SetDefaultResource(IDR_SIGNIN_ERROR_HTML); |
| 59 source->AddResourcePath("signin_error.js", IDR_SIGNIN_ERROR_JS); | 53 source->AddResourcePath("signin_error.js", IDR_SIGNIN_ERROR_JS); |
| 60 source->AddResourcePath("signin_shared_css.html", IDR_SIGNIN_SHARED_CSS_HTML); | 54 source->AddResourcePath("signin_shared_css.html", IDR_SIGNIN_SHARED_CSS_HTML); |
| 61 source->AddBoolean("isSystemProfile", is_system_profile); | 55 source->AddBoolean("isSystemProfile", is_system_profile); |
| 62 | 56 |
| 63 // Retrieve the last signin error message and email used. | 57 // Retrieve the last signin error message and email used. |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 IDS_SIGNIN_ERROR_OK_BUTTON_LABEL); | 112 IDS_SIGNIN_ERROR_OK_BUTTON_LABEL); |
| 119 | 113 |
| 120 base::DictionaryValue strings; | 114 base::DictionaryValue strings; |
| 121 webui::SetLoadTimeDataDefaults(g_browser_process->GetApplicationLocale(), | 115 webui::SetLoadTimeDataDefaults(g_browser_process->GetApplicationLocale(), |
| 122 &strings); | 116 &strings); |
| 123 source->AddLocalizedStrings(strings); | 117 source->AddLocalizedStrings(strings); |
| 124 | 118 |
| 125 content::WebUIDataSource::Add(webui_profile, source); | 119 content::WebUIDataSource::Add(webui_profile, source); |
| 126 web_ui->AddMessageHandler(handler); | 120 web_ui->AddMessageHandler(handler); |
| 127 } | 121 } |
| OLD | NEW |