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

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

Issue 2931943002: Disable permissions dialog in VR (Closed)
Patch Set: 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 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 251 matching lines...) Expand 10 before | Expand all | Expand 10 after
296 bool user_gesture, 301 bool user_gesture,
297 const base::Callback<void(const std::vector<ContentSetting>&)>& callback) { 302 const base::Callback<void(const std::vector<ContentSetting>&)>& callback) {
298 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); 303 DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
299 if (permissions.empty()) { 304 if (permissions.empty()) {
300 callback.Run(std::vector<ContentSetting>()); 305 callback.Run(std::vector<ContentSetting>());
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);
311
312 #if BUILDFLAG(ENABLE_VR)
313 if (vr_shell::VrTabHelper::IsInVr(web_contents)) {
314 callback.Run(
315 std::vector<ContentSetting>(permissions.size(), CONTENT_SETTING_BLOCK));
316 return kNoPendingOperation;
317 }
318 #endif // BUILDFLAG(ENABLE_VR)
319
306 GURL embedding_origin = web_contents->GetLastCommittedURL().GetOrigin(); 320 GURL embedding_origin = web_contents->GetLastCommittedURL().GetOrigin();
307 321
308 int request_id = pending_requests_.Add(base::MakeUnique<PendingRequest>( 322 int request_id = pending_requests_.Add(base::MakeUnique<PendingRequest>(
309 render_frame_host, permissions, callback)); 323 render_frame_host, permissions, callback));
310 324
311 const PermissionRequestID request(render_frame_host, request_id); 325 const PermissionRequestID request(render_frame_host, request_id);
312 326
313 for (size_t i = 0; i < permissions.size(); ++i) { 327 for (size_t i = 0; i < permissions.size(); ++i) {
314 const ContentSettingsType permission = permissions[i]; 328 const ContentSettingsType permission = permissions[i];
315 329
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after
557 } 571 }
558 PermissionContextBase* context = GetPermissionContext(permission); 572 PermissionContextBase* context = GetPermissionContext(permission);
559 PermissionResult result = context->GetPermissionStatus( 573 PermissionResult result = context->GetPermissionStatus(
560 nullptr /* render_frame_host */, requesting_origin.GetOrigin(), 574 nullptr /* render_frame_host */, requesting_origin.GetOrigin(),
561 embedding_origin.GetOrigin()); 575 embedding_origin.GetOrigin());
562 DCHECK(result.content_setting == CONTENT_SETTING_ALLOW || 576 DCHECK(result.content_setting == CONTENT_SETTING_ALLOW ||
563 result.content_setting == CONTENT_SETTING_ASK || 577 result.content_setting == CONTENT_SETTING_ASK ||
564 result.content_setting == CONTENT_SETTING_BLOCK); 578 result.content_setting == CONTENT_SETTING_BLOCK);
565 return result; 579 return result;
566 } 580 }
OLDNEW
« no previous file with comments | « chrome/browser/android/vr_shell/vr_tab_helper.cc ('k') | chrome/browser/permissions/permission_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698