| 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/options/browser_options_handler.h" | 5 #include "chrome/browser/ui/webui/options/browser_options_handler.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <set> | 9 #include <set> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 1303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1314 webui::GetBitmapDataUrl(icon.AsBitmap())); | 1314 webui::GetBitmapDataUrl(icon.AsBitmap())); |
| 1315 } else { | 1315 } else { |
| 1316 size_t icon_index = cache.GetAvatarIconIndexOfProfileAtIndex(i); | 1316 size_t icon_index = cache.GetAvatarIconIndexOfProfileAtIndex(i); |
| 1317 profile_value->SetString("iconURL", | 1317 profile_value->SetString("iconURL", |
| 1318 profiles::GetDefaultAvatarIconUrl(icon_index)); | 1318 profiles::GetDefaultAvatarIconUrl(icon_index)); |
| 1319 } | 1319 } |
| 1320 | 1320 |
| 1321 profile_info_list->Append(profile_value); | 1321 profile_info_list->Append(profile_value); |
| 1322 } | 1322 } |
| 1323 | 1323 |
| 1324 return profile_info_list.Pass(); | 1324 return profile_info_list; |
| 1325 } | 1325 } |
| 1326 | 1326 |
| 1327 void BrowserOptionsHandler::SendProfilesInfo() { | 1327 void BrowserOptionsHandler::SendProfilesInfo() { |
| 1328 if (!ShouldShowMultiProfilesUserList()) | 1328 if (!ShouldShowMultiProfilesUserList()) |
| 1329 return; | 1329 return; |
| 1330 web_ui()->CallJavascriptFunction("BrowserOptions.setProfilesInfo", | 1330 web_ui()->CallJavascriptFunction("BrowserOptions.setProfilesInfo", |
| 1331 *GetProfilesInfoList()); | 1331 *GetProfilesInfoList()); |
| 1332 } | 1332 } |
| 1333 | 1333 |
| 1334 void BrowserOptionsHandler::DeleteProfile(const base::ListValue* args) { | 1334 void BrowserOptionsHandler::DeleteProfile(const base::ListValue* args) { |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1416 BrowserOptionsHandler::GetSyncStateDictionary() { | 1416 BrowserOptionsHandler::GetSyncStateDictionary() { |
| 1417 // The items which are to be written into |sync_status| are also described in | 1417 // The items which are to be written into |sync_status| are also described in |
| 1418 // chrome/browser/resources/options/browser_options.js in @typedef | 1418 // chrome/browser/resources/options/browser_options.js in @typedef |
| 1419 // for SyncStatus. Please update it whenever you add or remove any keys here. | 1419 // for SyncStatus. Please update it whenever you add or remove any keys here. |
| 1420 scoped_ptr<base::DictionaryValue> sync_status(new base::DictionaryValue); | 1420 scoped_ptr<base::DictionaryValue> sync_status(new base::DictionaryValue); |
| 1421 Profile* profile = Profile::FromWebUI(web_ui()); | 1421 Profile* profile = Profile::FromWebUI(web_ui()); |
| 1422 if (profile->IsGuestSession()) { | 1422 if (profile->IsGuestSession()) { |
| 1423 // Cannot display signin status when running in guest mode on chromeos | 1423 // Cannot display signin status when running in guest mode on chromeos |
| 1424 // because there is no SigninManager. | 1424 // because there is no SigninManager. |
| 1425 sync_status->SetBoolean("signinAllowed", false); | 1425 sync_status->SetBoolean("signinAllowed", false); |
| 1426 return sync_status.Pass(); | 1426 return sync_status; |
| 1427 } | 1427 } |
| 1428 | 1428 |
| 1429 sync_status->SetBoolean("supervisedUser", profile->IsSupervised()); | 1429 sync_status->SetBoolean("supervisedUser", profile->IsSupervised()); |
| 1430 sync_status->SetBoolean("childUser", profile->IsChild()); | 1430 sync_status->SetBoolean("childUser", profile->IsChild()); |
| 1431 | 1431 |
| 1432 bool signout_prohibited = false; | 1432 bool signout_prohibited = false; |
| 1433 #if !defined(OS_CHROMEOS) | 1433 #if !defined(OS_CHROMEOS) |
| 1434 // Signout is not allowed if the user has policy (crbug.com/172204). | 1434 // Signout is not allowed if the user has policy (crbug.com/172204). |
| 1435 signout_prohibited = | 1435 signout_prohibited = |
| 1436 SigninManagerFactory::GetForProfile(profile)->IsSignoutProhibited(); | 1436 SigninManagerFactory::GetForProfile(profile)->IsSignoutProhibited(); |
| (...skipping 19 matching lines...) Expand all Loading... |
| 1456 &link_label) == sync_ui_util::SYNC_ERROR; | 1456 &link_label) == sync_ui_util::SYNC_ERROR; |
| 1457 sync_status->SetString("statusText", status_label); | 1457 sync_status->SetString("statusText", status_label); |
| 1458 sync_status->SetString("actionLinkText", link_label); | 1458 sync_status->SetString("actionLinkText", link_label); |
| 1459 sync_status->SetBoolean("hasError", status_has_error); | 1459 sync_status->SetBoolean("hasError", status_has_error); |
| 1460 | 1460 |
| 1461 sync_status->SetBoolean("managed", service && service->IsManaged()); | 1461 sync_status->SetBoolean("managed", service && service->IsManaged()); |
| 1462 sync_status->SetBoolean("signedIn", signin->IsAuthenticated()); | 1462 sync_status->SetBoolean("signedIn", signin->IsAuthenticated()); |
| 1463 sync_status->SetBoolean("hasUnrecoverableError", | 1463 sync_status->SetBoolean("hasUnrecoverableError", |
| 1464 service && service->HasUnrecoverableError()); | 1464 service && service->HasUnrecoverableError()); |
| 1465 | 1465 |
| 1466 return sync_status.Pass(); | 1466 return sync_status; |
| 1467 } | 1467 } |
| 1468 | 1468 |
| 1469 void BrowserOptionsHandler::HandleSelectDownloadLocation( | 1469 void BrowserOptionsHandler::HandleSelectDownloadLocation( |
| 1470 const base::ListValue* args) { | 1470 const base::ListValue* args) { |
| 1471 PrefService* pref_service = Profile::FromWebUI(web_ui())->GetPrefs(); | 1471 PrefService* pref_service = Profile::FromWebUI(web_ui())->GetPrefs(); |
| 1472 select_folder_dialog_ = ui::SelectFileDialog::Create( | 1472 select_folder_dialog_ = ui::SelectFileDialog::Create( |
| 1473 this, new ChromeSelectFilePolicy(web_ui()->GetWebContents())); | 1473 this, new ChromeSelectFilePolicy(web_ui()->GetWebContents())); |
| 1474 ui::SelectFileDialog::FileTypeInfo info; | 1474 ui::SelectFileDialog::FileTypeInfo info; |
| 1475 info.support_drive = true; | 1475 info.support_drive = true; |
| 1476 select_folder_dialog_->SelectFile( | 1476 select_folder_dialog_->SelectFile( |
| (...skipping 671 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2148 | 2148 |
| 2149 bool BrowserOptionsHandler::IsDeviceOwnerProfile() { | 2149 bool BrowserOptionsHandler::IsDeviceOwnerProfile() { |
| 2150 #if defined(OS_CHROMEOS) | 2150 #if defined(OS_CHROMEOS) |
| 2151 return chromeos::ProfileHelper::IsOwnerProfile(Profile::FromWebUI(web_ui())); | 2151 return chromeos::ProfileHelper::IsOwnerProfile(Profile::FromWebUI(web_ui())); |
| 2152 #else | 2152 #else |
| 2153 return true; | 2153 return true; |
| 2154 #endif | 2154 #endif |
| 2155 } | 2155 } |
| 2156 | 2156 |
| 2157 } // namespace options | 2157 } // namespace options |
| OLD | NEW |