| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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/sessions/restore_on_startup_policy_handler.h" | 5 #include "chrome/browser/sessions/restore_on_startup_policy_handler.h" |
| 6 | 6 |
| 7 #include "base/strings/string_number_conversions.h" | 7 #include "base/strings/string_number_conversions.h" |
| 8 #include "base/values.h" | 8 #include "base/values.h" |
| 9 #include "chrome/browser/prefs/session_startup_pref.h" | 9 #include "chrome/browser/prefs/session_startup_pref.h" |
| 10 #include "chrome/common/pref_names.h" | 10 #include "chrome/common/pref_names.h" |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 // session is not cleared so we have to warn the user in that case. | 57 // session is not cleared so we have to warn the user in that case. |
| 58 const base::Value* cookies_policy = | 58 const base::Value* cookies_policy = |
| 59 policies.GetValue(key::kCookiesSessionOnlyForUrls); | 59 policies.GetValue(key::kCookiesSessionOnlyForUrls); |
| 60 const base::ListValue* cookies_value; | 60 const base::ListValue* cookies_value; |
| 61 if (cookies_policy && cookies_policy->GetAsList(&cookies_value) && | 61 if (cookies_policy && cookies_policy->GetAsList(&cookies_value) && |
| 62 !cookies_value->empty()) { | 62 !cookies_value->empty()) { |
| 63 errors->AddError(key::kCookiesSessionOnlyForUrls, | 63 errors->AddError(key::kCookiesSessionOnlyForUrls, |
| 64 IDS_POLICY_OVERRIDDEN, | 64 IDS_POLICY_OVERRIDDEN, |
| 65 key::kRestoreOnStartup); | 65 key::kRestoreOnStartup); |
| 66 } | 66 } |
| 67 | |
| 68 const base::Value* exit_policy = | |
| 69 policies.GetValue(key::kClearSiteDataOnExit); | |
| 70 bool exit_value; | |
| 71 if (exit_policy && exit_policy->GetAsBoolean(&exit_value) && | |
| 72 exit_value) { | |
| 73 errors->AddError(key::kClearSiteDataOnExit, | |
| 74 IDS_POLICY_OVERRIDDEN, | |
| 75 key::kRestoreOnStartup); | |
| 76 } | |
| 77 break; | 67 break; |
| 78 } | 68 } |
| 79 case SessionStartupPref::kPrefValueURLs: | 69 case SessionStartupPref::kPrefValueURLs: |
| 80 case SessionStartupPref::kPrefValueNewTab: | 70 case SessionStartupPref::kPrefValueNewTab: |
| 81 // No error | 71 // No error |
| 82 break; | 72 break; |
| 83 default: | 73 default: |
| 84 errors->AddError(policy_name(), | 74 errors->AddError(policy_name(), |
| 85 IDS_POLICY_OUT_OF_RANGE_ERROR, | 75 IDS_POLICY_OUT_OF_RANGE_ERROR, |
| 86 base::IntToString(restore_value)); | 76 base::IntToString(restore_value)); |
| 87 } | 77 } |
| 88 } | 78 } |
| 89 return true; | 79 return true; |
| 90 } | 80 } |
| 91 | 81 |
| 92 } // namespace policy | 82 } // namespace policy |
| OLD | NEW |