OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/content_settings/permission_context_base.h" | 5 #include "chrome/browser/content_settings/permission_context_base.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/prefs/pref_service.h" | 8 #include "base/prefs/pref_service.h" |
9 #include "chrome/browser/content_settings/host_content_settings_map.h" | 9 #include "chrome/browser/content_settings/host_content_settings_map.h" |
10 #include "chrome/browser/content_settings/permission_bubble_request_impl.h" | 10 #include "chrome/browser/content_settings/permission_bubble_request_impl.h" |
(...skipping 30 matching lines...) Expand all Loading... |
41 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 41 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
42 | 42 |
43 DecidePermission(web_contents, | 43 DecidePermission(web_contents, |
44 id, | 44 id, |
45 requesting_frame.GetOrigin(), | 45 requesting_frame.GetOrigin(), |
46 web_contents->GetLastCommittedURL().GetOrigin(), | 46 web_contents->GetLastCommittedURL().GetOrigin(), |
47 user_gesture, | 47 user_gesture, |
48 callback); | 48 callback); |
49 } | 49 } |
50 | 50 |
| 51 ContentSetting PermissionContextBase::PermissionStatus( |
| 52 const GURL& requesting_origin, |
| 53 const GURL& embedder_origin) { |
| 54 return |
| 55 profile_->GetHostContentSettingsMap()->GetContentSetting( |
| 56 requesting_origin, embedder_origin, permission_type_, std::string()); |
| 57 } |
| 58 |
| 59 |
51 void PermissionContextBase::CancelPermissionRequest( | 60 void PermissionContextBase::CancelPermissionRequest( |
52 content::WebContents* web_contents, | 61 content::WebContents* web_contents, |
53 const PermissionRequestID& id) { | 62 const PermissionRequestID& id) { |
54 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); | 63 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); |
55 | 64 |
56 if (PermissionBubbleManager::Enabled()) { | 65 if (PermissionBubbleManager::Enabled()) { |
57 PermissionBubbleRequest* cancelling = | 66 PermissionBubbleRequest* cancelling = |
58 pending_bubbles_.get(id.ToString()); | 67 pending_bubbles_.get(id.ToString()); |
59 if (cancelling != NULL && web_contents != NULL && | 68 if (cancelling != NULL && web_contents != NULL && |
60 PermissionBubbleManager::FromWebContents(web_contents) != NULL) { | 69 PermissionBubbleManager::FromWebContents(web_contents) != NULL) { |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
200 DCHECK_EQ(embedder_origin, embedder_origin.GetOrigin()); | 209 DCHECK_EQ(embedder_origin, embedder_origin.GetOrigin()); |
201 ContentSetting content_setting = | 210 ContentSetting content_setting = |
202 allowed ? CONTENT_SETTING_ALLOW : CONTENT_SETTING_BLOCK; | 211 allowed ? CONTENT_SETTING_ALLOW : CONTENT_SETTING_BLOCK; |
203 profile_->GetHostContentSettingsMap()->SetContentSetting( | 212 profile_->GetHostContentSettingsMap()->SetContentSetting( |
204 ContentSettingsPattern::FromURLNoWildcard(requesting_origin), | 213 ContentSettingsPattern::FromURLNoWildcard(requesting_origin), |
205 ContentSettingsPattern::FromURLNoWildcard(embedder_origin), | 214 ContentSettingsPattern::FromURLNoWildcard(embedder_origin), |
206 permission_type_, | 215 permission_type_, |
207 std::string(), | 216 std::string(), |
208 content_setting); | 217 content_setting); |
209 } | 218 } |
OLD | NEW |