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

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

Issue 2930843002: Allow modal mic+camera permission prompts in PRM codepath (Closed)
Patch Set: check all gesture bits 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
« no previous file with comments | « chrome/browser/permissions/permission_dialog_delegate.cc ('k') | 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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_prompt_android.h" 5 #include "chrome/browser/permissions/permission_prompt_android.h"
6 6
7 #include "base/memory/ptr_util.h" 7 #include "base/memory/ptr_util.h"
8 #include "chrome/browser/infobars/infobar_service.h" 8 #include "chrome/browser/infobars/infobar_service.h"
9 #include "chrome/browser/permissions/grouped_permission_infobar_delegate_android .h" 9 #include "chrome/browser/permissions/grouped_permission_infobar_delegate_android .h"
10 #include "chrome/browser/permissions/permission_dialog_delegate.h" 10 #include "chrome/browser/permissions/permission_dialog_delegate.h"
(...skipping 11 matching lines...) Expand all
22 DCHECK(web_contents); 22 DCHECK(web_contents);
23 } 23 }
24 24
25 PermissionPromptAndroid::~PermissionPromptAndroid() {} 25 PermissionPromptAndroid::~PermissionPromptAndroid() {}
26 26
27 void PermissionPromptAndroid::SetDelegate(Delegate* delegate) { 27 void PermissionPromptAndroid::SetDelegate(Delegate* delegate) {
28 delegate_ = delegate; 28 delegate_ = delegate;
29 } 29 }
30 30
31 void PermissionPromptAndroid::Show() { 31 void PermissionPromptAndroid::Show() {
32 // Grouped permission requests are not yet supported in dialogs. 32 bool has_gesture = true;
33 // TODO(timloh): Handle grouped media permissions (camera + microphone). 33 for (const PermissionRequest* request : delegate_->Requests()) {
34 if (delegate_->Requests().size() == 1) { 34 has_gesture &=
35 bool has_gesture = delegate_->Requests()[0]->GetGestureType() == 35 request->GetGestureType() == PermissionRequestGestureType::GESTURE;
36 PermissionRequestGestureType::GESTURE; 36 }
37 if (PermissionDialogDelegate::ShouldShowDialog(has_gesture)) { 37 if (PermissionDialogDelegate::ShouldShowDialog(has_gesture)) {
38 PermissionDialogDelegate::Create(web_contents_, this); 38 PermissionDialogDelegate::Create(web_contents_, this);
39 return; 39 return;
40 }
41 } 40 }
42 41
43 InfoBarService* infobar_service = 42 InfoBarService* infobar_service =
44 InfoBarService::FromWebContents(web_contents_); 43 InfoBarService::FromWebContents(web_contents_);
45 if (!infobar_service) 44 if (!infobar_service)
46 return; 45 return;
47 46
48 GroupedPermissionInfoBarDelegate::Create( 47 GroupedPermissionInfoBarDelegate::Create(
49 this, infobar_service, delegate_->Requests()[0]->GetOrigin()); 48 this, infobar_service, delegate_->Requests()[0]->GetOrigin());
50 } 49 }
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 return GURL(chrome::kEnhancedPlaybackNotificationLearnMoreURL); 159 return GURL(chrome::kEnhancedPlaybackNotificationLearnMoreURL);
161 } 160 }
162 return GURL(); 161 return GURL();
163 } 162 }
164 163
165 // static 164 // static
166 std::unique_ptr<PermissionPrompt> PermissionPrompt::Create( 165 std::unique_ptr<PermissionPrompt> PermissionPrompt::Create(
167 content::WebContents* web_contents) { 166 content::WebContents* web_contents) {
168 return base::MakeUnique<PermissionPromptAndroid>(web_contents); 167 return base::MakeUnique<PermissionPromptAndroid>(web_contents);
169 } 168 }
OLDNEW
« no previous file with comments | « chrome/browser/permissions/permission_dialog_delegate.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698