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 "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 979 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
990 // If the restore urls at start up policy is set, session cookies are treated | 990 // If the restore urls at start up policy is set, session cookies are treated |
991 // as permanent cookies and site data needed to restore the session is not | 991 // as permanent cookies and site data needed to restore the session is not |
992 // cleared so we have to warn the user in that case. | 992 // cleared so we have to warn the user in that case. |
993 const base::Value* restore_policy = policies.GetValue(key::kRestoreOnStartup); | 993 const base::Value* restore_policy = policies.GetValue(key::kRestoreOnStartup); |
994 | 994 |
995 if (restore_policy) { | 995 if (restore_policy) { |
996 int restore_value; | 996 int restore_value; |
997 if (restore_policy->GetAsInteger(&restore_value) && | 997 if (restore_policy->GetAsInteger(&restore_value) && |
998 SessionStartupPref::PrefValueToType(restore_value) == | 998 SessionStartupPref::PrefValueToType(restore_value) == |
999 SessionStartupPref::LAST) { | 999 SessionStartupPref::LAST) { |
| 1000 |
1000 const base::Value* cookies_policy = | 1001 const base::Value* cookies_policy = |
1001 policies.GetValue(key::kCookiesSessionOnlyForUrls); | 1002 policies.GetValue(key::kCookiesSessionOnlyForUrls); |
1002 const base::Value* exit_policy = | |
1003 policies.GetValue(key::kClearSiteDataOnExit); | |
1004 | |
1005 const base::ListValue *cookies_value; | 1003 const base::ListValue *cookies_value; |
1006 if (cookies_policy->GetAsList(&cookies_value) && | 1004 if (cookies_policy && cookies_policy->GetAsList(&cookies_value) && |
1007 !cookies_value->empty()) { | 1005 !cookies_value->empty()) { |
1008 errors->AddError(key::kCookiesSessionOnlyForUrls, | 1006 errors->AddError(key::kCookiesSessionOnlyForUrls, |
1009 IDS_POLICY_OVERRIDDEN, | 1007 IDS_POLICY_OVERRIDDEN, |
1010 key::kRestoreOnStartup); | 1008 key::kRestoreOnStartup); |
1011 } | 1009 } |
1012 | 1010 |
| 1011 const base::Value* exit_policy = |
| 1012 policies.GetValue(key::kClearSiteDataOnExit); |
1013 bool exit_value; | 1013 bool exit_value; |
1014 if (exit_policy->GetAsBoolean(&exit_value) && exit_value) { | 1014 if (exit_policy && exit_policy->GetAsBoolean(&exit_value) && exit_value) { |
1015 errors->AddError(key::kClearSiteDataOnExit, | 1015 errors->AddError(key::kClearSiteDataOnExit, |
1016 IDS_POLICY_OVERRIDDEN, | 1016 IDS_POLICY_OVERRIDDEN, |
1017 key::kRestoreOnStartup); | 1017 key::kRestoreOnStartup); |
1018 } | 1018 } |
1019 } | 1019 } |
1020 } | 1020 } |
1021 | |
1022 return true; | 1021 return true; |
1023 } | 1022 } |
1024 | 1023 |
1025 } // namespace policy | 1024 } // namespace policy |
OLD | NEW |