| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/manage_profile_handler.h" | 5 #include "chrome/browser/ui/webui/options/manage_profile_handler.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 471 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 482 if (service) | 482 if (service) |
| 483 state = service->GetAuthError().state(); | 483 state = service->GetAuthError().state(); |
| 484 | 484 |
| 485 bool has_error = (!service || | 485 bool has_error = (!service || |
| 486 state == GoogleServiceAuthError::INVALID_GAIA_CREDENTIALS || | 486 state == GoogleServiceAuthError::INVALID_GAIA_CREDENTIALS || |
| 487 state == GoogleServiceAuthError::USER_NOT_SIGNED_UP || | 487 state == GoogleServiceAuthError::USER_NOT_SIGNED_UP || |
| 488 state == GoogleServiceAuthError::ACCOUNT_DELETED || | 488 state == GoogleServiceAuthError::ACCOUNT_DELETED || |
| 489 state == GoogleServiceAuthError::ACCOUNT_DISABLED); | 489 state == GoogleServiceAuthError::ACCOUNT_DISABLED); |
| 490 web_ui()->CallJavascriptFunctionUnsafe( | 490 web_ui()->CallJavascriptFunctionUnsafe( |
| 491 "CreateProfileOverlay.updateSignedInStatus", base::StringValue(username), | 491 "CreateProfileOverlay.updateSignedInStatus", base::StringValue(username), |
| 492 base::FundamentalValue(has_error)); | 492 base::Value(has_error)); |
| 493 | 493 |
| 494 OnCreateSupervisedUserPrefChange(); | 494 OnCreateSupervisedUserPrefChange(); |
| 495 } | 495 } |
| 496 | 496 |
| 497 void ManageProfileHandler::OnCreateSupervisedUserPrefChange() { | 497 void ManageProfileHandler::OnCreateSupervisedUserPrefChange() { |
| 498 PrefService* prefs = Profile::FromWebUI(web_ui())->GetPrefs(); | 498 PrefService* prefs = Profile::FromWebUI(web_ui())->GetPrefs(); |
| 499 base::FundamentalValue allowed( | 499 base::Value allowed( |
| 500 prefs->GetBoolean(prefs::kSupervisedUserCreationAllowed)); | 500 prefs->GetBoolean(prefs::kSupervisedUserCreationAllowed)); |
| 501 web_ui()->CallJavascriptFunctionUnsafe( | 501 web_ui()->CallJavascriptFunctionUnsafe( |
| 502 "CreateProfileOverlay.updateSupervisedUsersAllowed", allowed); | 502 "CreateProfileOverlay.updateSupervisedUsersAllowed", allowed); |
| 503 } | 503 } |
| 504 | 504 |
| 505 void ManageProfileHandler::OnHasProfileShortcuts(bool has_shortcuts) { | 505 void ManageProfileHandler::OnHasProfileShortcuts(bool has_shortcuts) { |
| 506 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 506 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
| 507 | 507 |
| 508 const base::FundamentalValue has_shortcuts_value(has_shortcuts); | 508 const base::Value has_shortcuts_value(has_shortcuts); |
| 509 web_ui()->CallJavascriptFunctionUnsafe( | 509 web_ui()->CallJavascriptFunctionUnsafe( |
| 510 "ManageProfileOverlay.receiveHasProfileShortcuts", has_shortcuts_value); | 510 "ManageProfileOverlay.receiveHasProfileShortcuts", has_shortcuts_value); |
| 511 } | 511 } |
| 512 | 512 |
| 513 void ManageProfileHandler::AddProfileShortcut(const base::ListValue* args) { | 513 void ManageProfileHandler::AddProfileShortcut(const base::ListValue* args) { |
| 514 base::FilePath profile_file_path; | 514 base::FilePath profile_file_path; |
| 515 if (!GetProfilePathFromArgs(args, &profile_file_path)) | 515 if (!GetProfilePathFromArgs(args, &profile_file_path)) |
| 516 return; | 516 return; |
| 517 | 517 |
| 518 DCHECK(ProfileShortcutManager::IsFeatureEnabled()); | 518 DCHECK(ProfileShortcutManager::IsFeatureEnabled()); |
| (...skipping 21 matching lines...) Expand all Loading... |
| 540 | 540 |
| 541 // Update the UI buttons. | 541 // Update the UI buttons. |
| 542 OnHasProfileShortcuts(false); | 542 OnHasProfileShortcuts(false); |
| 543 } | 543 } |
| 544 | 544 |
| 545 void ManageProfileHandler::RefreshGaiaPicture(const base::ListValue* args) { | 545 void ManageProfileHandler::RefreshGaiaPicture(const base::ListValue* args) { |
| 546 profiles::UpdateGaiaProfileInfoIfNeeded(Profile::FromWebUI(web_ui())); | 546 profiles::UpdateGaiaProfileInfoIfNeeded(Profile::FromWebUI(web_ui())); |
| 547 } | 547 } |
| 548 | 548 |
| 549 } // namespace options | 549 } // namespace options |
| OLD | NEW |