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

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: 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 = delegate_->Requests()[0]->GetGestureType() ==
33 // TODO(timloh): Handle grouped media permissions (camera + microphone). 33 PermissionRequestGestureType::GESTURE;
raymes 2017/06/13 04:27:30 Should this check all the requests? It looks a bit
Timothy Loh 2017/06/14 04:56:43 Done.
34 if (delegate_->Requests().size() == 1) { 34 if (PermissionDialogDelegate::ShouldShowDialog(has_gesture)) {
35 bool has_gesture = delegate_->Requests()[0]->GetGestureType() == 35 PermissionDialogDelegate::Create(web_contents_, this);
36 PermissionRequestGestureType::GESTURE; 36 return;
37 if (PermissionDialogDelegate::ShouldShowDialog(has_gesture)) {
38 PermissionDialogDelegate::Create(web_contents_, this);
39 return;
40 }
41 } 37 }
42 38
43 InfoBarService* infobar_service = 39 InfoBarService* infobar_service =
44 InfoBarService::FromWebContents(web_contents_); 40 InfoBarService::FromWebContents(web_contents_);
45 if (!infobar_service) 41 if (!infobar_service)
46 return; 42 return;
47 43
48 GroupedPermissionInfoBarDelegate::Create( 44 GroupedPermissionInfoBarDelegate::Create(
49 this, infobar_service, delegate_->Requests()[0]->GetOrigin()); 45 this, infobar_service, delegate_->Requests()[0]->GetOrigin());
50 } 46 }
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 return GURL(chrome::kEnhancedPlaybackNotificationLearnMoreURL); 156 return GURL(chrome::kEnhancedPlaybackNotificationLearnMoreURL);
161 } 157 }
162 return GURL(); 158 return GURL();
163 } 159 }
164 160
165 // static 161 // static
166 std::unique_ptr<PermissionPrompt> PermissionPrompt::Create( 162 std::unique_ptr<PermissionPrompt> PermissionPrompt::Create(
167 content::WebContents* web_contents) { 163 content::WebContents* web_contents) {
168 return base::MakeUnique<PermissionPromptAndroid>(web_contents); 164 return base::MakeUnique<PermissionPromptAndroid>(web_contents);
169 } 165 }
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