| 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 #ifndef CHROME_BROWSER_POLICY_CONFIGURATION_POLICY_HANDLER_H_ | 5 #ifndef CHROME_BROWSER_POLICY_CONFIGURATION_POLICY_HANDLER_H_ |
| 6 #define CHROME_BROWSER_POLICY_CONFIGURATION_POLICY_HANDLER_H_ | 6 #define CHROME_BROWSER_POLICY_CONFIGURATION_POLICY_HANDLER_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
| 12 #include "base/values.h" | 12 #include "base/values.h" |
| 13 #include "chrome/browser/prefs/incognito_mode_prefs.h" | 13 #include "chrome/browser/prefs/incognito_mode_prefs.h" |
| 14 #include "chrome/common/content_settings.h" |
| 14 | 15 |
| 15 class PrefValueMap; | 16 class PrefValueMap; |
| 16 | 17 |
| 17 namespace policy { | 18 namespace policy { |
| 18 | 19 |
| 19 class PolicyErrorMap; | 20 class PolicyErrorMap; |
| 20 class PolicyMap; | 21 class PolicyMap; |
| 21 | 22 |
| 22 // An abstract super class that subclasses should implement to map policies to | 23 // An abstract super class that subclasses should implement to map policies to |
| 23 // their corresponding preferences, and to check whether the policies are valid. | 24 // their corresponding preferences, and to check whether the policies are valid. |
| (...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 348 // ConfigurationPolicyHandler methods: | 349 // ConfigurationPolicyHandler methods: |
| 349 virtual bool CheckPolicySettings(const PolicyMap& policies, | 350 virtual bool CheckPolicySettings(const PolicyMap& policies, |
| 350 PolicyErrorMap* errors) OVERRIDE; | 351 PolicyErrorMap* errors) OVERRIDE; |
| 351 virtual void ApplyPolicySettings(const PolicyMap& policies, | 352 virtual void ApplyPolicySettings(const PolicyMap& policies, |
| 352 PrefValueMap* prefs) OVERRIDE; | 353 PrefValueMap* prefs) OVERRIDE; |
| 353 | 354 |
| 354 private: | 355 private: |
| 355 DISALLOW_COPY_AND_ASSIGN(JavascriptPolicyHandler); | 356 DISALLOW_COPY_AND_ASSIGN(JavascriptPolicyHandler); |
| 356 }; | 357 }; |
| 357 | 358 |
| 359 // Handles the (deprecated) ClearSiteDataOnExit policy. |
| 360 // TODO(mnissler): Remove the policy eventually (http://crbug.com/133291). |
| 361 class ClearSiteDataOnExitPolicyHandler : public TypeCheckingPolicyHandler { |
| 362 public: |
| 363 ClearSiteDataOnExitPolicyHandler(); |
| 364 virtual ~ClearSiteDataOnExitPolicyHandler(); |
| 365 |
| 366 // ConfigurationPolicyHandler methods: |
| 367 virtual bool CheckPolicySettings(const PolicyMap& policies, |
| 368 PolicyErrorMap* errors) OVERRIDE; |
| 369 virtual void ApplyPolicySettings(const PolicyMap& policies, |
| 370 PrefValueMap* prefs) OVERRIDE; |
| 371 |
| 372 private: |
| 373 // Checks whether the clear site data policy is enabled in |policies|. |
| 374 bool ClearSiteDataEnabled(const PolicyMap& policies); |
| 375 |
| 376 // Checks |policies| for the cookies setting and returns it in |
| 377 // |content_setting|. Returns true if the setting is found, false if not. |
| 378 static bool GetContentSetting(const PolicyMap& policies, |
| 379 ContentSetting* content_setting); |
| 380 |
| 381 DISALLOW_COPY_AND_ASSIGN(ClearSiteDataOnExitPolicyHandler); |
| 382 }; |
| 383 |
| 358 // Handles RestoreOnStartup policy. | 384 // Handles RestoreOnStartup policy. |
| 359 class RestoreOnStartupPolicyHandler : public TypeCheckingPolicyHandler { | 385 class RestoreOnStartupPolicyHandler : public TypeCheckingPolicyHandler { |
| 360 public: | 386 public: |
| 361 RestoreOnStartupPolicyHandler(); | 387 RestoreOnStartupPolicyHandler(); |
| 362 virtual ~RestoreOnStartupPolicyHandler(); | 388 virtual ~RestoreOnStartupPolicyHandler(); |
| 363 | 389 |
| 364 // ConfigurationPolicyHandler methods: | 390 // ConfigurationPolicyHandler methods: |
| 365 virtual bool CheckPolicySettings(const PolicyMap& policies, | 391 virtual bool CheckPolicySettings(const PolicyMap& policies, |
| 366 PolicyErrorMap* errors) OVERRIDE; | 392 PolicyErrorMap* errors) OVERRIDE; |
| 367 virtual void ApplyPolicySettings(const PolicyMap& policies, | 393 virtual void ApplyPolicySettings(const PolicyMap& policies, |
| 368 PrefValueMap* prefs) OVERRIDE; | 394 PrefValueMap* prefs) OVERRIDE; |
| 369 | 395 |
| 370 private: | 396 private: |
| 371 void ApplyPolicySettingsFromHomePage(const PolicyMap& policies, | 397 void ApplyPolicySettingsFromHomePage(const PolicyMap& policies, |
| 372 PrefValueMap* prefs); | 398 PrefValueMap* prefs); |
| 373 | 399 |
| 374 DISALLOW_COPY_AND_ASSIGN(RestoreOnStartupPolicyHandler); | 400 DISALLOW_COPY_AND_ASSIGN(RestoreOnStartupPolicyHandler); |
| 375 }; | 401 }; |
| 376 | 402 |
| 377 } // namespace policy | 403 } // namespace policy |
| 378 | 404 |
| 379 #endif // CHROME_BROWSER_POLICY_CONFIGURATION_POLICY_HANDLER_H_ | 405 #endif // CHROME_BROWSER_POLICY_CONFIGURATION_POLICY_HANDLER_H_ |
| OLD | NEW |