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 "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/prefs/pref_service.h" | 9 #include "base/prefs/pref_service.h" |
10 #include "base/prefs/scoped_user_pref_update.h" | 10 #include "base/prefs/scoped_user_pref_update.h" |
(...skipping 477 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
488 } | 488 } |
489 | 489 |
490 void ManageProfileHandler::OnCreateSupervisedUserPrefChange() { | 490 void ManageProfileHandler::OnCreateSupervisedUserPrefChange() { |
491 PrefService* prefs = Profile::FromWebUI(web_ui())->GetPrefs(); | 491 PrefService* prefs = Profile::FromWebUI(web_ui())->GetPrefs(); |
492 base::FundamentalValue allowed( | 492 base::FundamentalValue allowed( |
493 prefs->GetBoolean(prefs::kSupervisedUserCreationAllowed)); | 493 prefs->GetBoolean(prefs::kSupervisedUserCreationAllowed)); |
494 web_ui()->CallJavascriptFunction( | 494 web_ui()->CallJavascriptFunction( |
495 "CreateProfileOverlay.updateSupervisedUsersAllowed", allowed); | 495 "CreateProfileOverlay.updateSupervisedUsersAllowed", allowed); |
496 } | 496 } |
497 | 497 |
498 void ManageProfileHandler::OnHasProfileShortcuts(bool has_shortcuts) { | 498 void ManageProfileHandler::OnHasProfileShortcuts(bool has_shortcuts) { |
Dan Beam
2014/09/04 22:59:09
i'm slightly more partial to CHECK() than an if ->
noms (inactive)
2014/09/05 14:54:41
You can manually navigate to chrome://settings/man
| |
499 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 499 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
500 | 500 |
Dan Beam
2014/09/04 22:59:09
nit: if the code stays as it:
if (!switches::IsNe
noms (inactive)
2014/09/05 14:54:41
Done.
| |
501 const base::FundamentalValue has_shortcuts_value(has_shortcuts); | 501 // If --new-avatar-menu is on, don't show the add/remove desktop |
502 web_ui()->CallJavascriptFunction( | 502 // shortcut button in the single user case. |
503 "ManageProfileOverlay.receiveHasProfileShortcuts", has_shortcuts_value); | 503 const ProfileInfoCache& cache = |
504 g_browser_process->profile_manager()->GetProfileInfoCache(); | |
505 if (switches::IsNewAvatarMenu() && cache.GetNumberOfProfiles() > 1) { | |
noms (inactive)
2014/09/04 21:24:13
Question for you: Even in the pre-mirror world, if
Dan Beam
2014/09/04 22:59:09
i don't see it on Linux. you should hide irreleva
noms (inactive)
2014/09/05 14:54:41
This is just for Windows (Linux doesn't have deskt
| |
506 const base::FundamentalValue has_shortcuts_value(has_shortcuts); | |
507 web_ui()->CallJavascriptFunction( | |
508 "ManageProfileOverlay.receiveHasProfileShortcuts", has_shortcuts_value); | |
509 } | |
504 } | 510 } |
505 | 511 |
506 void ManageProfileHandler::AddProfileShortcut(const base::ListValue* args) { | 512 void ManageProfileHandler::AddProfileShortcut(const base::ListValue* args) { |
507 base::FilePath profile_file_path; | 513 base::FilePath profile_file_path; |
508 if (!GetProfilePathFromArgs(args, &profile_file_path)) | 514 if (!GetProfilePathFromArgs(args, &profile_file_path)) |
509 return; | 515 return; |
510 | 516 |
511 DCHECK(ProfileShortcutManager::IsFeatureEnabled()); | 517 DCHECK(ProfileShortcutManager::IsFeatureEnabled()); |
512 ProfileShortcutManager* shortcut_manager = | 518 ProfileShortcutManager* shortcut_manager = |
513 g_browser_process->profile_manager()->profile_shortcut_manager(); | 519 g_browser_process->profile_manager()->profile_shortcut_manager(); |
(...skipping 19 matching lines...) Expand all Loading... | |
533 | 539 |
534 // Update the UI buttons. | 540 // Update the UI buttons. |
535 OnHasProfileShortcuts(false); | 541 OnHasProfileShortcuts(false); |
536 } | 542 } |
537 | 543 |
538 void ManageProfileHandler::RefreshGaiaPicture(const base::ListValue* args) { | 544 void ManageProfileHandler::RefreshGaiaPicture(const base::ListValue* args) { |
539 profiles::UpdateGaiaProfilePhotoIfNeeded(Profile::FromWebUI(web_ui())); | 545 profiles::UpdateGaiaProfilePhotoIfNeeded(Profile::FromWebUI(web_ui())); |
540 } | 546 } |
541 | 547 |
542 } // namespace options | 548 } // namespace options |
OLD | NEW |