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/media/protected_media_identifier_permission_context.h" | 5 #include "chrome/browser/media/protected_media_identifier_permission_context.h" |
6 | 6 |
7 #include "base/prefs/pref_service.h" | 7 #include "base/prefs/pref_service.h" |
8 #include "chrome/browser/content_settings/tab_specific_content_settings.h" | 8 #include "chrome/browser/content_settings/tab_specific_content_settings.h" |
9 #include "chrome/browser/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
10 #include "chrome/common/pref_names.h" | 10 #include "chrome/common/pref_names.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 #if defined(ENABLE_EXTENSIONS) | 43 #if defined(ENABLE_EXTENSIONS) |
44 if (extensions::GetViewType(web_contents) != | 44 if (extensions::GetViewType(web_contents) != |
45 extensions::VIEW_TYPE_TAB_CONTENTS) { | 45 extensions::VIEW_TYPE_TAB_CONTENTS) { |
46 // The tab may have gone away, or the request may not be from a tab at all. | 46 // The tab may have gone away, or the request may not be from a tab at all. |
47 DVLOG(1) | 47 DVLOG(1) |
48 << "Attempt to use protected media identifier in tabless renderer: " | 48 << "Attempt to use protected media identifier in tabless renderer: " |
49 << id.ToString() | 49 << id.ToString() |
50 << " (can't prompt user without a visible tab)"; | 50 << " (can't prompt user without a visible tab)"; |
51 NotifyPermissionSet(id, | 51 NotifyPermissionSet(id, requesting_frame_origin, |
52 origin, | |
53 web_contents->GetLastCommittedURL().GetOrigin(), | 52 web_contents->GetLastCommittedURL().GetOrigin(), |
54 callback, false, false); | 53 callback, false, false); |
55 return; | 54 return; |
56 } | 55 } |
57 #endif | 56 #endif |
58 | 57 |
59 #if defined(OS_ANDROID) | 58 #if defined(OS_ANDROID) |
60 // Check if the protected media identifier master switch is disabled. | 59 // Check if the protected media identifier master switch is disabled. |
61 if (!profile()->GetPrefs()->GetBoolean( | 60 if (!profile()->GetPrefs()->GetBoolean( |
62 prefs::kProtectedMediaIdentifierEnabled)) { | 61 prefs::kProtectedMediaIdentifierEnabled)) { |
(...skipping 20 matching lines...) Expand all Loading... |
83 // WebContents may have gone away. | 82 // WebContents may have gone away. |
84 TabSpecificContentSettings* content_settings = | 83 TabSpecificContentSettings* content_settings = |
85 TabSpecificContentSettings::Get(id.render_process_id(), | 84 TabSpecificContentSettings::Get(id.render_process_id(), |
86 id.render_view_id()); | 85 id.render_view_id()); |
87 if (content_settings) { | 86 if (content_settings) { |
88 content_settings->OnProtectedMediaIdentifierPermissionSet( | 87 content_settings->OnProtectedMediaIdentifierPermissionSet( |
89 requesting_frame.GetOrigin(), allowed); | 88 requesting_frame.GetOrigin(), allowed); |
90 } | 89 } |
91 | 90 |
92 } | 91 } |
OLD | NEW |