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() | |
mlamouri (slow - plz ping)
2014/10/16 09:04:57
nit: do you really need a line break here?
Miguel Garcia
2014/10/16 13:50:26
Done.
| |
56 ->GetContentSetting( | |
57 requesting_origin, embedder_origin, permission_type_, std::string()); | |
58 } | |
59 | |
60 | |
51 void PermissionContextBase::CancelPermissionRequest( | 61 void PermissionContextBase::CancelPermissionRequest( |
52 content::WebContents* web_contents, | 62 content::WebContents* web_contents, |
53 const PermissionRequestID& id) { | 63 const PermissionRequestID& id) { |
54 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); | 64 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); |
55 | 65 |
56 if (PermissionBubbleManager::Enabled()) { | 66 if (PermissionBubbleManager::Enabled()) { |
57 PermissionBubbleRequest* cancelling = | 67 PermissionBubbleRequest* cancelling = |
58 pending_bubbles_.get(id.ToString()); | 68 pending_bubbles_.get(id.ToString()); |
59 if (cancelling != NULL && web_contents != NULL && | 69 if (cancelling != NULL && web_contents != NULL && |
60 PermissionBubbleManager::FromWebContents(web_contents) != NULL) { | 70 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()); | 210 DCHECK_EQ(embedder_origin, embedder_origin.GetOrigin()); |
201 ContentSetting content_setting = | 211 ContentSetting content_setting = |
202 allowed ? CONTENT_SETTING_ALLOW : CONTENT_SETTING_BLOCK; | 212 allowed ? CONTENT_SETTING_ALLOW : CONTENT_SETTING_BLOCK; |
203 profile_->GetHostContentSettingsMap()->SetContentSetting( | 213 profile_->GetHostContentSettingsMap()->SetContentSetting( |
204 ContentSettingsPattern::FromURLNoWildcard(requesting_origin), | 214 ContentSettingsPattern::FromURLNoWildcard(requesting_origin), |
205 ContentSettingsPattern::FromURLNoWildcard(embedder_origin), | 215 ContentSettingsPattern::FromURLNoWildcard(embedder_origin), |
206 permission_type_, | 216 permission_type_, |
207 std::string(), | 217 std::string(), |
208 content_setting); | 218 content_setting); |
209 } | 219 } |
OLD | NEW |