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 13 matching lines...) Expand all Loading... | |
24 #include "chrome/browser/profiles/profile.h" | 24 #include "chrome/browser/profiles/profile.h" |
25 #include "chrome/browser/storage/durable_storage_permission_context.h" | 25 #include "chrome/browser/storage/durable_storage_permission_context.h" |
26 #include "chrome/browser/tab_contents/tab_util.h" | 26 #include "chrome/browser/tab_contents/tab_util.h" |
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 "ppapi/features/features.h" | 35 #include "ppapi/features/features.h" |
35 | 36 |
37 #if BUILDFLAG(ENABLE_VR) | |
38 #include "chrome/browser/android/vr_shell/vr_tab_helper.h" | |
39 #endif // BUILDFLAG(ENABLE_VR) | |
40 | |
36 #if BUILDFLAG(ENABLE_PLUGINS) | 41 #if BUILDFLAG(ENABLE_PLUGINS) |
37 #include "chrome/browser/plugins/flash_permission_context.h" | 42 #include "chrome/browser/plugins/flash_permission_context.h" |
38 #endif | 43 #endif |
39 | 44 |
40 #if defined(OS_ANDROID) || defined(OS_CHROMEOS) | 45 #if defined(OS_ANDROID) || defined(OS_CHROMEOS) |
41 #include "chrome/browser/media/protected_media_identifier_permission_context.h" | 46 #include "chrome/browser/media/protected_media_identifier_permission_context.h" |
42 #endif | 47 #endif |
43 | 48 |
44 #if defined(OS_ANDROID) | 49 #if defined(OS_ANDROID) |
45 #include "chrome/browser/geolocation/geolocation_permission_context_android.h" | 50 #include "chrome/browser/geolocation/geolocation_permission_context_android.h" |
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
275 bool user_gesture, | 280 bool user_gesture, |
276 const base::Callback<void(const std::vector<ContentSetting>&)>& callback) { | 281 const base::Callback<void(const std::vector<ContentSetting>&)>& callback) { |
277 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 282 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
278 if (permissions.empty()) { | 283 if (permissions.empty()) { |
279 callback.Run(std::vector<ContentSetting>()); | 284 callback.Run(std::vector<ContentSetting>()); |
280 return kNoPendingOperation; | 285 return kNoPendingOperation; |
281 } | 286 } |
282 | 287 |
283 content::WebContents* web_contents = | 288 content::WebContents* web_contents = |
284 content::WebContents::FromRenderFrameHost(render_frame_host); | 289 content::WebContents::FromRenderFrameHost(render_frame_host); |
290 | |
291 #if BUILDFLAG(ENABLE_VR) | |
292 if (vr_shell::VrTabHelper::IsInVr(web_contents)) { | |
raymes
2017/05/31 23:10:07
This is missing:
callback.Run(std::vector<Content
asimjour1
2017/06/06 17:58:56
Done.
| |
293 return kNoPendingOperation; | |
294 } | |
295 #endif // BUILDFLAG(ENABLE_VR) | |
296 | |
285 GURL embedding_origin = web_contents->GetLastCommittedURL().GetOrigin(); | 297 GURL embedding_origin = web_contents->GetLastCommittedURL().GetOrigin(); |
286 | 298 |
287 int request_id = pending_requests_.Add(base::MakeUnique<PendingRequest>( | 299 int request_id = pending_requests_.Add(base::MakeUnique<PendingRequest>( |
288 render_frame_host, permissions, callback)); | 300 render_frame_host, permissions, callback)); |
289 | 301 |
290 const PermissionRequestID request(render_frame_host, request_id); | 302 const PermissionRequestID request(render_frame_host, request_id); |
291 | 303 |
292 for (size_t i = 0; i < permissions.size(); ++i) { | 304 for (size_t i = 0; i < permissions.size(); ++i) { |
293 const ContentSettingsType permission = permissions[i]; | 305 const ContentSettingsType permission = permissions[i]; |
294 | 306 |
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
522 const GURL& embedding_origin) { | 534 const GURL& embedding_origin) { |
523 PermissionContextBase* context = GetPermissionContext(permission); | 535 PermissionContextBase* context = GetPermissionContext(permission); |
524 PermissionResult result = context->GetPermissionStatus( | 536 PermissionResult result = context->GetPermissionStatus( |
525 render_frame_host, requesting_origin.GetOrigin(), | 537 render_frame_host, requesting_origin.GetOrigin(), |
526 embedding_origin.GetOrigin()); | 538 embedding_origin.GetOrigin()); |
527 DCHECK(result.content_setting == CONTENT_SETTING_ALLOW || | 539 DCHECK(result.content_setting == CONTENT_SETTING_ALLOW || |
528 result.content_setting == CONTENT_SETTING_ASK || | 540 result.content_setting == CONTENT_SETTING_ASK || |
529 result.content_setting == CONTENT_SETTING_BLOCK); | 541 result.content_setting == CONTENT_SETTING_BLOCK); |
530 return result; | 542 return result; |
531 } | 543 } |
OLD | NEW |