OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/permissions/permission_manager.h" | 5 #include "chrome/browser/permissions/permission_manager.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
(...skipping 16 matching lines...) Expand all Loading... |
27 #include "chrome/common/features.h" | 27 #include "chrome/common/features.h" |
28 #include "components/content_settings/core/browser/host_content_settings_map.h" | 28 #include "components/content_settings/core/browser/host_content_settings_map.h" |
29 #include "content/public/browser/browser_thread.h" | 29 #include "content/public/browser/browser_thread.h" |
30 #include "content/public/browser/permission_type.h" | 30 #include "content/public/browser/permission_type.h" |
31 #include "content/public/browser/render_frame_host.h" | 31 #include "content/public/browser/render_frame_host.h" |
32 #include "content/public/browser/render_process_host.h" | 32 #include "content/public/browser/render_process_host.h" |
33 #include "content/public/browser/web_contents.h" | 33 #include "content/public/browser/web_contents.h" |
34 #include "device/vr/features/features.h" | 34 #include "device/vr/features/features.h" |
35 #include "ppapi/features/features.h" | 35 #include "ppapi/features/features.h" |
36 | 36 |
37 #if BUILDFLAG(ENABLE_VR) | 37 #if BUILDFLAG(ENABLE_VR) && defined(OS_ANDROID) |
38 #include "chrome/browser/android/vr_shell/vr_tab_helper.h" | 38 #include "chrome/browser/android/vr_shell/vr_tab_helper.h" |
39 #endif // BUILDFLAG(ENABLE_VR) | 39 #endif // BUILDFLAG(ENABLE_VR) && defined(OS_ANDROID) |
40 | 40 |
41 #if BUILDFLAG(ENABLE_PLUGINS) | 41 #if BUILDFLAG(ENABLE_PLUGINS) |
42 #include "chrome/browser/plugins/flash_permission_context.h" | 42 #include "chrome/browser/plugins/flash_permission_context.h" |
43 #endif | 43 #endif |
44 | 44 |
45 #if defined(OS_ANDROID) || defined(OS_CHROMEOS) | 45 #if defined(OS_ANDROID) || defined(OS_CHROMEOS) |
46 #include "chrome/browser/media/protected_media_identifier_permission_context.h" | 46 #include "chrome/browser/media/protected_media_identifier_permission_context.h" |
47 #endif | 47 #endif |
48 | 48 |
49 #if defined(OS_ANDROID) | 49 #if defined(OS_ANDROID) |
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
281 const base::Callback<void(const std::vector<ContentSetting>&)>& callback) { | 281 const base::Callback<void(const std::vector<ContentSetting>&)>& callback) { |
282 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 282 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
283 if (permissions.empty()) { | 283 if (permissions.empty()) { |
284 callback.Run(std::vector<ContentSetting>()); | 284 callback.Run(std::vector<ContentSetting>()); |
285 return kNoPendingOperation; | 285 return kNoPendingOperation; |
286 } | 286 } |
287 | 287 |
288 content::WebContents* web_contents = | 288 content::WebContents* web_contents = |
289 content::WebContents::FromRenderFrameHost(render_frame_host); | 289 content::WebContents::FromRenderFrameHost(render_frame_host); |
290 | 290 |
291 #if BUILDFLAG(ENABLE_VR) | 291 #if BUILDFLAG(ENABLE_VR) && defined(OS_ANDROID) |
292 if (vr_shell::VrTabHelper::IsInVr(web_contents)) { | 292 if (vr_shell::VrTabHelper::IsInVr(web_contents)) { |
293 callback.Run( | 293 callback.Run( |
294 std::vector<ContentSetting>(permissions.size(), CONTENT_SETTING_BLOCK)); | 294 std::vector<ContentSetting>(permissions.size(), CONTENT_SETTING_BLOCK)); |
295 return kNoPendingOperation; | 295 return kNoPendingOperation; |
296 } | 296 } |
297 #endif // BUILDFLAG(ENABLE_VR) | 297 #endif // BUILDFLAG(ENABLE_VR) && defined(OS_ANDROID) |
298 | 298 |
299 GURL embedding_origin = web_contents->GetLastCommittedURL().GetOrigin(); | 299 GURL embedding_origin = web_contents->GetLastCommittedURL().GetOrigin(); |
300 | 300 |
301 int request_id = pending_requests_.Add(base::MakeUnique<PendingRequest>( | 301 int request_id = pending_requests_.Add(base::MakeUnique<PendingRequest>( |
302 render_frame_host, permissions, callback)); | 302 render_frame_host, permissions, callback)); |
303 | 303 |
304 const PermissionRequestID request(render_frame_host, request_id); | 304 const PermissionRequestID request(render_frame_host, request_id); |
305 | 305 |
306 for (size_t i = 0; i < permissions.size(); ++i) { | 306 for (size_t i = 0; i < permissions.size(); ++i) { |
307 const ContentSettingsType permission = permissions[i]; | 307 const ContentSettingsType permission = permissions[i]; |
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
536 const GURL& embedding_origin) { | 536 const GURL& embedding_origin) { |
537 PermissionContextBase* context = GetPermissionContext(permission); | 537 PermissionContextBase* context = GetPermissionContext(permission); |
538 PermissionResult result = context->GetPermissionStatus( | 538 PermissionResult result = context->GetPermissionStatus( |
539 render_frame_host, requesting_origin.GetOrigin(), | 539 render_frame_host, requesting_origin.GetOrigin(), |
540 embedding_origin.GetOrigin()); | 540 embedding_origin.GetOrigin()); |
541 DCHECK(result.content_setting == CONTENT_SETTING_ALLOW || | 541 DCHECK(result.content_setting == CONTENT_SETTING_ALLOW || |
542 result.content_setting == CONTENT_SETTING_ASK || | 542 result.content_setting == CONTENT_SETTING_ASK || |
543 result.content_setting == CONTENT_SETTING_BLOCK); | 543 result.content_setting == CONTENT_SETTING_BLOCK); |
544 return result; | 544 return result; |
545 } | 545 } |
OLD | NEW |