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" |
11 #include "chrome/browser/content_settings/cookie_settings_factory.h" | 11 #include "chrome/browser/content_settings/cookie_settings_factory.h" |
12 #include "chrome/browser/content_settings/host_content_settings_map_factory.h" | 12 #include "chrome/browser/content_settings/host_content_settings_map_factory.h" |
13 #include "chrome/browser/content_settings/tab_specific_content_settings.h" | 13 #include "chrome/browser/content_settings/tab_specific_content_settings.h" |
14 #include "chrome/browser/engagement/important_sites_util.h" | 14 #include "chrome/browser/engagement/important_sites_util.h" |
15 #include "chrome/browser/permissions/permission_request_id.h" | 15 #include "chrome/browser/permissions/permission_request_id.h" |
16 #include "chrome/browser/profiles/profile.h" | 16 #include "chrome/browser/profiles/profile.h" |
17 #include "components/bookmarks/browser/bookmark_model.h" | 17 #include "components/bookmarks/browser/bookmark_model.h" |
18 #include "components/content_settings/core/browser/cookie_settings.h" | 18 #include "components/content_settings/core/browser/cookie_settings.h" |
19 #include "components/content_settings/core/browser/host_content_settings_map.h" | 19 #include "components/content_settings/core/browser/host_content_settings_map.h" |
20 #include "components/content_settings/core/browser/website_settings_registry.h" | 20 #include "components/content_settings/core/browser/website_settings_registry.h" |
21 #include "content/public/browser/browser_thread.h" | 21 #include "content/public/browser/browser_thread.h" |
22 #include "content/public/browser/child_process_security_policy.h" | 22 #include "content/public/browser/child_process_security_policy.h" |
23 #include "content/public/browser/permission_type.h" | |
24 #include "content/public/common/origin_util.h" | 23 #include "content/public/common/origin_util.h" |
25 #include "net/base/registry_controlled_domains/registry_controlled_domain.h" | 24 #include "net/base/registry_controlled_domains/registry_controlled_domain.h" |
26 #include "url/gurl.h" | 25 #include "url/gurl.h" |
27 | 26 |
28 using bookmarks::BookmarkModel; | 27 using bookmarks::BookmarkModel; |
29 | 28 |
30 DurableStoragePermissionContext::DurableStoragePermissionContext( | 29 DurableStoragePermissionContext::DurableStoragePermissionContext( |
31 Profile* profile) | 30 Profile* profile) |
32 : PermissionContextBase(profile, | 31 : PermissionContextBase(profile, |
33 content::PermissionType::DURABLE_STORAGE, | |
34 CONTENT_SETTINGS_TYPE_DURABLE_STORAGE) {} | 32 CONTENT_SETTINGS_TYPE_DURABLE_STORAGE) {} |
35 | 33 |
36 void DurableStoragePermissionContext::DecidePermission( | 34 void DurableStoragePermissionContext::DecidePermission( |
37 content::WebContents* web_contents, | 35 content::WebContents* web_contents, |
38 const PermissionRequestID& id, | 36 const PermissionRequestID& id, |
39 const GURL& requesting_origin, | 37 const GURL& requesting_origin, |
40 const GURL& embedding_origin, | 38 const GURL& embedding_origin, |
41 bool user_gesture, | 39 bool user_gesture, |
42 const BrowserPermissionCallback& callback) { | 40 const BrowserPermissionCallback& callback) { |
43 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); | 41 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 | 99 |
102 HostContentSettingsMapFactory::GetForProfile(profile()) | 100 HostContentSettingsMapFactory::GetForProfile(profile()) |
103 ->SetContentSettingDefaultScope(requesting_origin, GURL(), | 101 ->SetContentSettingDefaultScope(requesting_origin, GURL(), |
104 CONTENT_SETTINGS_TYPE_DURABLE_STORAGE, | 102 CONTENT_SETTINGS_TYPE_DURABLE_STORAGE, |
105 std::string(), content_setting); | 103 std::string(), content_setting); |
106 } | 104 } |
107 | 105 |
108 bool DurableStoragePermissionContext::IsRestrictedToSecureOrigins() const { | 106 bool DurableStoragePermissionContext::IsRestrictedToSecureOrigins() const { |
109 return true; | 107 return true; |
110 } | 108 } |
OLD | NEW |