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

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

Issue 2904623002: Disable permissions dialog in VR (Closed)
Patch Set: Address comments Created 3 years, 6 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
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 13 matching lines...) Expand all
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 234 matching lines...) Expand 10 before | Expand all | Expand 10 after
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);
285 GURL embedding_origin = web_contents->GetLastCommittedURL().GetOrigin(); 290 GURL embedding_origin = web_contents->GetLastCommittedURL().GetOrigin();
286 291
287 int request_id = pending_requests_.Add(base::MakeUnique<PendingRequest>( 292 int request_id = pending_requests_.Add(base::MakeUnique<PendingRequest>(
288 render_frame_host, permissions, callback)); 293 render_frame_host, permissions, callback));
289 294
295 #if BUILDFLAG(ENABLE_VR)
296 if (vr_shell::VrTabHelper::IsInVr(web_contents)) {
297 CancelPermissionRequest(request_id);
298 return kNoPendingOperation;
299 }
raymes 2017/05/31 00:56:00 nit: you can just do this before we create the Pen
asimjour1 2017/05/31 15:06:11 Done. I moved it to line 289 (web_contents is need
300 #endif // BUILDFLAG(ENABLE_VR)
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
295 PermissionContextBase* context = GetPermissionContext(permission); 307 PermissionContextBase* context = GetPermissionContext(permission);
296 DCHECK(context); 308 DCHECK(context);
297 context->RequestPermission( 309 context->RequestPermission(
298 web_contents, request, requesting_origin, user_gesture, 310 web_contents, request, requesting_origin, user_gesture,
299 base::Bind(&PermissionManager::OnPermissionsRequestResponseStatus, 311 base::Bind(&PermissionManager::OnPermissionsRequestResponseStatus,
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698