Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(125)

Side by Side Diff: chrome/browser/permissions/permission_manager.cc

Issue 2904623002: Disable permissions dialog in VR (Closed)
Patch Set: Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 12 matching lines...) Expand all
23 #include "chrome/browser/profiles/profile.h" 23 #include "chrome/browser/profiles/profile.h"
24 #include "chrome/browser/storage/durable_storage_permission_context.h" 24 #include "chrome/browser/storage/durable_storage_permission_context.h"
25 #include "chrome/browser/tab_contents/tab_util.h" 25 #include "chrome/browser/tab_contents/tab_util.h"
26 #include "chrome/common/features.h" 26 #include "chrome/common/features.h"
27 #include "components/content_settings/core/browser/host_content_settings_map.h" 27 #include "components/content_settings/core/browser/host_content_settings_map.h"
28 #include "content/public/browser/browser_thread.h" 28 #include "content/public/browser/browser_thread.h"
29 #include "content/public/browser/permission_type.h" 29 #include "content/public/browser/permission_type.h"
30 #include "content/public/browser/render_frame_host.h" 30 #include "content/public/browser/render_frame_host.h"
31 #include "content/public/browser/render_process_host.h" 31 #include "content/public/browser/render_process_host.h"
32 #include "content/public/browser/web_contents.h" 32 #include "content/public/browser/web_contents.h"
33 #include "device/vr/features/features.h"
33 #include "ppapi/features/features.h" 34 #include "ppapi/features/features.h"
34 35
36 #if BUILDFLAG(ENABLE_VR)
37 #include "chrome/browser/android/vr_shell/vr_tab_helper.h"
38 #endif // BUILDFLAG(ENABLE_VR)
39
35 #if BUILDFLAG(ENABLE_PLUGINS) 40 #if BUILDFLAG(ENABLE_PLUGINS)
36 #include "chrome/browser/plugins/flash_permission_context.h" 41 #include "chrome/browser/plugins/flash_permission_context.h"
37 #endif 42 #endif
38 43
39 #if defined(OS_ANDROID) || defined(OS_CHROMEOS) 44 #if defined(OS_ANDROID) || defined(OS_CHROMEOS)
40 #include "chrome/browser/media/protected_media_identifier_permission_context.h" 45 #include "chrome/browser/media/protected_media_identifier_permission_context.h"
41 #endif 46 #endif
42 47
43 #if defined(OS_ANDROID) 48 #if defined(OS_ANDROID)
44 #include "chrome/browser/geolocation/geolocation_permission_context_android.h" 49 #include "chrome/browser/geolocation/geolocation_permission_context_android.h"
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after
301 return kNoPendingOperation; 306 return kNoPendingOperation;
302 } 307 }
303 308
304 content::WebContents* web_contents = 309 content::WebContents* web_contents =
305 content::WebContents::FromRenderFrameHost(render_frame_host); 310 content::WebContents::FromRenderFrameHost(render_frame_host);
306 GURL embedding_origin = web_contents->GetLastCommittedURL().GetOrigin(); 311 GURL embedding_origin = web_contents->GetLastCommittedURL().GetOrigin();
307 312
308 int request_id = pending_requests_.Add(base::MakeUnique<PendingRequest>( 313 int request_id = pending_requests_.Add(base::MakeUnique<PendingRequest>(
309 render_frame_host, permissions, callback)); 314 render_frame_host, permissions, callback));
310 315
316 #if BUILDFLAG(ENABLE_VR)
317 if (vr_shell::VrTabHelper::IsInVr(web_contents)) {
318 CancelPermissionRequest(request_id);
319 return kNoPendingOperation;
320 }
321 #endif // BUILDFLAG(ENABLE_VR)
raymes 2017/05/24 22:07:45 This will cancel all permission requests, even if
raymes 2017/05/24 22:13:43 I just noticed the related thread. I think the lac
asimjour1 2017/05/29 18:41:57 Unittest is added. Bluetooth chooser is disabled
322
311 const PermissionRequestID request(render_frame_host, request_id); 323 const PermissionRequestID request(render_frame_host, request_id);
312 324
313 for (size_t i = 0; i < permissions.size(); ++i) { 325 for (size_t i = 0; i < permissions.size(); ++i) {
314 const ContentSettingsType permission = permissions[i]; 326 const ContentSettingsType permission = permissions[i];
315 327
316 if (IsConstantPermission(permission) || !GetPermissionContext(permission)) { 328 if (IsConstantPermission(permission) || !GetPermissionContext(permission)) {
317 // Track permission request usages even for constant permissions. 329 // Track permission request usages even for constant permissions.
318 PermissionUmaUtil::PermissionRequested(permission, requesting_origin, 330 PermissionUmaUtil::PermissionRequested(permission, requesting_origin,
319 embedding_origin, profile_); 331 embedding_origin, profile_);
320 OnPermissionsRequestResponseStatus( 332 OnPermissionsRequestResponseStatus(
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
557 } 569 }
558 PermissionContextBase* context = GetPermissionContext(permission); 570 PermissionContextBase* context = GetPermissionContext(permission);
559 PermissionResult result = context->GetPermissionStatus( 571 PermissionResult result = context->GetPermissionStatus(
560 nullptr /* render_frame_host */, requesting_origin.GetOrigin(), 572 nullptr /* render_frame_host */, requesting_origin.GetOrigin(),
561 embedding_origin.GetOrigin()); 573 embedding_origin.GetOrigin());
562 DCHECK(result.content_setting == CONTENT_SETTING_ALLOW || 574 DCHECK(result.content_setting == CONTENT_SETTING_ALLOW ||
563 result.content_setting == CONTENT_SETTING_ASK || 575 result.content_setting == CONTENT_SETTING_ASK ||
564 result.content_setting == CONTENT_SETTING_BLOCK); 576 result.content_setting == CONTENT_SETTING_BLOCK);
565 return result; 577 return result;
566 } 578 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698