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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 | 54 |
55 if (IsRestrictedToSecureOrigins() && | 55 if (IsRestrictedToSecureOrigins() && |
56 !content::IsOriginSecure(requesting_origin)) { | 56 !content::IsOriginSecure(requesting_origin)) { |
57 NotifyPermissionSet(id, requesting_origin, embedding_origin, callback, | 57 NotifyPermissionSet(id, requesting_origin, embedding_origin, callback, |
58 false /* persist */, CONTENT_SETTING_BLOCK); | 58 false /* persist */, CONTENT_SETTING_BLOCK); |
59 return; | 59 return; |
60 } | 60 } |
61 | 61 |
62 ContentSetting content_setting = | 62 ContentSetting content_setting = |
63 HostContentSettingsMapFactory::GetForProfile(profile()) | 63 HostContentSettingsMapFactory::GetForProfile(profile()) |
64 ->GetContentSettingAndMaybeUpdateLastUsage( | 64 ->GetContentSetting( |
65 requesting_origin, embedding_origin, | 65 requesting_origin, embedding_origin, |
66 CONTENT_SETTINGS_TYPE_DURABLE_STORAGE, std::string()); | 66 CONTENT_SETTINGS_TYPE_DURABLE_STORAGE, std::string()); |
67 | 67 |
68 DCHECK_NE(CONTENT_SETTING_BLOCK, content_setting); | 68 DCHECK_NE(CONTENT_SETTING_BLOCK, content_setting); |
69 if (content_setting == CONTENT_SETTING_ALLOW) { | 69 if (content_setting == CONTENT_SETTING_ALLOW) { |
70 NotifyPermissionSet(id, requesting_origin, embedding_origin, callback, | 70 NotifyPermissionSet(id, requesting_origin, embedding_origin, callback, |
71 false /* persist */, content_setting); | 71 false /* persist */, content_setting); |
72 return; | 72 return; |
73 } | 73 } |
74 | 74 |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 const std::vector<bookmarks::BookmarkModel::URLAndTitle>& bookmarks, | 112 const std::vector<bookmarks::BookmarkModel::URLAndTitle>& bookmarks, |
113 const GURL& origin) { | 113 const GURL& origin) { |
114 BookmarkModel::URLAndTitle looking_for; | 114 BookmarkModel::URLAndTitle looking_for; |
115 looking_for.url = origin; | 115 looking_for.url = origin; |
116 return std::binary_search(bookmarks.begin(), bookmarks.end(), looking_for, | 116 return std::binary_search(bookmarks.begin(), bookmarks.end(), looking_for, |
117 [](const BookmarkModel::URLAndTitle& a, | 117 [](const BookmarkModel::URLAndTitle& a, |
118 const BookmarkModel::URLAndTitle& b) { | 118 const BookmarkModel::URLAndTitle& b) { |
119 return a.url.GetOrigin() < b.url.GetOrigin(); | 119 return a.url.GetOrigin() < b.url.GetOrigin(); |
120 }); | 120 }); |
121 } | 121 } |
OLD | NEW |