| 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/storage/durable_storage_permission_context.h" | 5 #include "chrome/browser/storage/durable_storage_permission_context.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "chrome/browser/bookmarks/bookmark_model_factory.h" | 10 #include "chrome/browser/bookmarks/bookmark_model_factory.h" |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 // origin is the last committed navigation origin to the web contents. | 50 // origin is the last committed navigation origin to the web contents. |
| 51 if (requesting_origin != embedding_origin) { | 51 if (requesting_origin != embedding_origin) { |
| 52 NotifyPermissionSet(id, requesting_origin, embedding_origin, callback, | 52 NotifyPermissionSet(id, requesting_origin, embedding_origin, callback, |
| 53 false /* persist */, CONTENT_SETTING_DEFAULT); | 53 false /* persist */, CONTENT_SETTING_DEFAULT); |
| 54 return; | 54 return; |
| 55 } | 55 } |
| 56 | 56 |
| 57 // Don't grant durable if we can't write cookies. | 57 // Don't grant durable if we can't write cookies. |
| 58 scoped_refptr<content_settings::CookieSettings> cookie_settings = | 58 scoped_refptr<content_settings::CookieSettings> cookie_settings = |
| 59 CookieSettingsFactory::GetForProfile(profile()); | 59 CookieSettingsFactory::GetForProfile(profile()); |
| 60 if (!cookie_settings->IsSettingCookieAllowed(requesting_origin, | 60 if (!cookie_settings->IsCookieAccessAllowed(requesting_origin, |
| 61 requesting_origin)) { | 61 requesting_origin)) { |
| 62 NotifyPermissionSet(id, requesting_origin, embedding_origin, callback, | 62 NotifyPermissionSet(id, requesting_origin, embedding_origin, callback, |
| 63 false /* persist */, CONTENT_SETTING_DEFAULT); | 63 false /* persist */, CONTENT_SETTING_DEFAULT); |
| 64 return; | 64 return; |
| 65 } | 65 } |
| 66 | 66 |
| 67 const size_t kMaxImportantResults = 10; | 67 const size_t kMaxImportantResults = 10; |
| 68 std::vector<ImportantSitesUtil::ImportantDomainInfo> important_sites = | 68 std::vector<ImportantSitesUtil::ImportantDomainInfo> important_sites = |
| 69 ImportantSitesUtil::GetImportantRegisterableDomains(profile(), | 69 ImportantSitesUtil::GetImportantRegisterableDomains(profile(), |
| 70 kMaxImportantResults); | 70 kMaxImportantResults); |
| 71 | 71 |
| (...skipping 27 matching lines...) Expand all Loading... |
| 99 | 99 |
| 100 HostContentSettingsMapFactory::GetForProfile(profile()) | 100 HostContentSettingsMapFactory::GetForProfile(profile()) |
| 101 ->SetContentSettingDefaultScope(requesting_origin, GURL(), | 101 ->SetContentSettingDefaultScope(requesting_origin, GURL(), |
| 102 CONTENT_SETTINGS_TYPE_DURABLE_STORAGE, | 102 CONTENT_SETTINGS_TYPE_DURABLE_STORAGE, |
| 103 std::string(), content_setting); | 103 std::string(), content_setting); |
| 104 } | 104 } |
| 105 | 105 |
| 106 bool DurableStoragePermissionContext::IsRestrictedToSecureOrigins() const { | 106 bool DurableStoragePermissionContext::IsRestrictedToSecureOrigins() const { |
| 107 return true; | 107 return true; |
| 108 } | 108 } |
| OLD | NEW |