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/permission_bubble_request_impl.h" | 9 #include "chrome/browser/content_settings/permission_bubble_request_impl.h" |
10 #include "chrome/browser/content_settings/permission_context_uma_util.h" | 10 #include "chrome/browser/content_settings/permission_context_uma_util.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& embedding_origin) const { |
| 54 return profile_->GetHostContentSettingsMap()->GetContentSetting( |
| 55 requesting_origin, embedding_origin, permission_type_, std::string()); |
| 56 } |
| 57 |
51 void PermissionContextBase::CancelPermissionRequest( | 58 void PermissionContextBase::CancelPermissionRequest( |
52 content::WebContents* web_contents, | 59 content::WebContents* web_contents, |
53 const PermissionRequestID& id) { | 60 const PermissionRequestID& id) { |
54 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 61 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
55 | 62 |
56 if (PermissionBubbleManager::Enabled()) { | 63 if (PermissionBubbleManager::Enabled()) { |
57 PermissionBubbleRequest* cancelling = | 64 PermissionBubbleRequest* cancelling = |
58 pending_bubbles_.get(id.ToString()); | 65 pending_bubbles_.get(id.ToString()); |
59 if (cancelling != NULL && web_contents != NULL && | 66 if (cancelling != NULL && web_contents != NULL && |
60 PermissionBubbleManager::FromWebContents(web_contents) != NULL) { | 67 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()); | 207 DCHECK_EQ(embedder_origin, embedder_origin.GetOrigin()); |
201 ContentSetting content_setting = | 208 ContentSetting content_setting = |
202 allowed ? CONTENT_SETTING_ALLOW : CONTENT_SETTING_BLOCK; | 209 allowed ? CONTENT_SETTING_ALLOW : CONTENT_SETTING_BLOCK; |
203 profile_->GetHostContentSettingsMap()->SetContentSetting( | 210 profile_->GetHostContentSettingsMap()->SetContentSetting( |
204 ContentSettingsPattern::FromURLNoWildcard(requesting_origin), | 211 ContentSettingsPattern::FromURLNoWildcard(requesting_origin), |
205 ContentSettingsPattern::FromURLNoWildcard(embedder_origin), | 212 ContentSettingsPattern::FromURLNoWildcard(embedder_origin), |
206 permission_type_, | 213 permission_type_, |
207 std::string(), | 214 std::string(), |
208 content_setting); | 215 content_setting); |
209 } | 216 } |
OLD | NEW |