Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(219)

Side by Side Diff: chrome/browser/policy/configuration_policy_handler.cc

Issue 12088040: Add a SigninAllowed policy. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add tests and link UpdateLogin to kSigninAllowed pref. Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/policy/configuration_policy_handler.h" 5 #include "chrome/browser/policy/configuration_policy_handler.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/file_path.h" 9 #include "base/file_path.h"
10 #include "base/json/json_writer.h" 10 #include "base/json/json_writer.h"
(...skipping 535 matching lines...) Expand 10 before | Expand all | Expand 10 after
546 } 546 }
547 547
548 void SyncPolicyHandler::ApplyPolicySettings(const PolicyMap& policies, 548 void SyncPolicyHandler::ApplyPolicySettings(const PolicyMap& policies,
549 PrefValueMap* prefs) { 549 PrefValueMap* prefs) {
550 const Value* value = policies.GetValue(policy_name()); 550 const Value* value = policies.GetValue(policy_name());
551 bool disable_sync; 551 bool disable_sync;
552 if (value && value->GetAsBoolean(&disable_sync) && disable_sync) 552 if (value && value->GetAsBoolean(&disable_sync) && disable_sync)
553 prefs->SetValue(prefs::kSyncManaged, value->DeepCopy()); 553 prefs->SetValue(prefs::kSyncManaged, value->DeepCopy());
554 } 554 }
555 555
556 // SigninPolicyHandler implementation ------------------------------------------
557
558 SigninPolicyHandler::SigninPolicyHandler()
559 : TypeCheckingPolicyHandler(key::kSigninAllowed,
560 Value::TYPE_BOOLEAN) {
561 }
562
563 SigninPolicyHandler::~SigninPolicyHandler() {
564 }
565
566 void SigninPolicyHandler::ApplyPolicySettings(const PolicyMap& policies,
567 PrefValueMap* prefs) {
568 const Value* value = policies.GetValue(policy_name());
569 bool signin_allowed;
570 if (value && value->GetAsBoolean(&signin_allowed))
Andrew T Wilson (Slow) 2013/02/07 10:08:11 This is fine with me, but I wonder if this boilerp
Adrian Kuegel 2013/02/07 11:09:21 Yes, I will do that. I did this part just in the s
571 prefs->SetValue(prefs::kSigninAllowed, value->DeepCopy());
572 }
556 573
557 // AutofillPolicyHandler implementation ---------------------------------------- 574 // AutofillPolicyHandler implementation ----------------------------------------
558 575
559 AutofillPolicyHandler::AutofillPolicyHandler() 576 AutofillPolicyHandler::AutofillPolicyHandler()
560 : TypeCheckingPolicyHandler(key::kAutoFillEnabled, 577 : TypeCheckingPolicyHandler(key::kAutoFillEnabled,
561 Value::TYPE_BOOLEAN) { 578 Value::TYPE_BOOLEAN) {
562 } 579 }
563 580
564 AutofillPolicyHandler::~AutofillPolicyHandler() { 581 AutofillPolicyHandler::~AutofillPolicyHandler() {
565 } 582 }
(...skipping 895 matching lines...) Expand 10 before | Expand all | Expand 10 after
1461 errors->AddError(policy_name(), 1478 errors->AddError(policy_name(),
1462 IDS_POLICY_OUT_OF_RANGE_ERROR, 1479 IDS_POLICY_OUT_OF_RANGE_ERROR,
1463 base::IntToString(restore_value)); 1480 base::IntToString(restore_value));
1464 } 1481 }
1465 } 1482 }
1466 } 1483 }
1467 return true; 1484 return true;
1468 } 1485 }
1469 1486
1470 } // namespace policy 1487 } // namespace policy
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698