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 "components/policy/core/browser/configuration_policy_handler.h" | 5 #include "components/policy/core/browser/configuration_policy_handler.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/callback.h" | 9 #include "base/callback.h" |
10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
(...skipping 30 matching lines...) Expand all Loading... | |
41 | 41 |
42 ConfigurationPolicyHandler::ConfigurationPolicyHandler() { | 42 ConfigurationPolicyHandler::ConfigurationPolicyHandler() { |
43 } | 43 } |
44 | 44 |
45 ConfigurationPolicyHandler::~ConfigurationPolicyHandler() { | 45 ConfigurationPolicyHandler::~ConfigurationPolicyHandler() { |
46 } | 46 } |
47 | 47 |
48 void ConfigurationPolicyHandler::PrepareForDisplaying( | 48 void ConfigurationPolicyHandler::PrepareForDisplaying( |
49 PolicyMap* policies) const {} | 49 PolicyMap* policies) const {} |
50 | 50 |
51 void ConfigurationPolicyHandler::ApplyPolicySettings( | |
52 const policy::PolicyMap& policies, | |
53 PrefValueMap* prefs) { | |
54 NOTREACHED(); | |
55 } | |
56 | |
57 void ConfigurationPolicyHandler::ApplyPolicySettingsWithParameters( | 51 void ConfigurationPolicyHandler::ApplyPolicySettingsWithParameters( |
58 const PolicyMap& policies, | 52 const PolicyMap& policies, |
59 const PolicyHandlerParameters& parameters, | 53 const PolicyHandlerParameters& parameters, |
60 PrefValueMap* prefs) { | 54 PrefValueMap* prefs) { |
61 ApplyPolicySettings(policies, prefs); | 55 ApplyPolicySettings(policies, prefs); |
62 } | 56 } |
63 | 57 |
64 // TypeCheckingPolicyHandler implementation ------------------------------------ | 58 // TypeCheckingPolicyHandler implementation ------------------------------------ |
65 | 59 |
66 TypeCheckingPolicyHandler::TypeCheckingPolicyHandler( | 60 TypeCheckingPolicyHandler::TypeCheckingPolicyHandler( |
(...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
459 for (handler = legacy_policy_handlers_.begin(); | 453 for (handler = legacy_policy_handlers_.begin(); |
460 handler != legacy_policy_handlers_.end(); | 454 handler != legacy_policy_handlers_.end(); |
461 ++handler) { | 455 ++handler) { |
462 if ((*handler)->CheckPolicySettings(policies, errors)) | 456 if ((*handler)->CheckPolicySettings(policies, errors)) |
463 valid_policy_found = true; | 457 valid_policy_found = true; |
464 } | 458 } |
465 return valid_policy_found; | 459 return valid_policy_found; |
466 } | 460 } |
467 } | 461 } |
468 | 462 |
469 void LegacyPoliciesDeprecatingPolicyHandler::ApplyPolicySettings( | 463 void LegacyPoliciesDeprecatingPolicyHandler::ApplyPolicySettingsWithParameters( |
470 const PolicyMap& policies, | 464 const policy::PolicyMap& policies, |
465 const policy::PolicyHandlerParameters& parameters, | |
471 PrefValueMap* prefs) { | 466 PrefValueMap* prefs) { |
472 if (policies.Get(new_policy_handler_->policy_name())) { | 467 if (policies.Get(new_policy_handler_->policy_name())) { |
473 new_policy_handler_->ApplyPolicySettings(policies, prefs); | 468 new_policy_handler_->ApplyPolicySettingsWithParameters(policies, parameters, |
469 prefs); | |
474 } else { | 470 } else { |
475 // The new policy is not set, fall back to legacy ones. | 471 // The new policy is not set, fall back to legacy ones. |
476 PolicyErrorMap scoped_errors; | 472 PolicyErrorMap scoped_errors; |
477 ScopedVector<ConfigurationPolicyHandler>::iterator handler; | 473 ScopedVector<ConfigurationPolicyHandler>::iterator handler; |
478 for (handler = legacy_policy_handlers_.begin(); | 474 for (handler = legacy_policy_handlers_.begin(); |
479 handler != legacy_policy_handlers_.end(); | 475 handler != legacy_policy_handlers_.end(); |
480 ++handler) { | 476 ++handler) { |
481 if ((*handler)->CheckPolicySettings(policies, &scoped_errors)) | 477 if (!(*handler)->CheckPolicySettings(policies, &scoped_errors)) { |
Mattias Nissler (ping if slow)
2015/03/26 11:13:59
Wait, is the change of polarity in this conditiona
pneubeck (no reviews)
2015/03/26 14:53:34
Thanks for catching!
that's also why the tests fai
| |
482 (*handler)->ApplyPolicySettings(policies, prefs); | 478 (*handler) |
479 ->ApplyPolicySettingsWithParameters(policies, parameters, prefs); | |
480 } | |
483 } | 481 } |
484 } | 482 } |
485 } | 483 } |
484 void LegacyPoliciesDeprecatingPolicyHandler::ApplyPolicySettings( | |
485 const policy::PolicyMap& /* policies */, | |
486 PrefValueMap* /* prefs */) { | |
487 NOTREACHED(); | |
488 } | |
486 | 489 |
487 } // namespace policy | 490 } // namespace policy |
OLD | NEW |