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

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

Issue 2757483002: Move requests from GroupedPermissionInfoBarDelegate to PermissionPromptAndroid (Closed)
Patch Set: Created 3 years, 9 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 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/media/webrtc/media_stream_devices_controller.h" 9 #include "chrome/browser/media/webrtc/media_stream_devices_controller.h"
10 #include "chrome/browser/permissions/grouped_permission_infobar_delegate_android .h" 10 #include "chrome/browser/permissions/grouped_permission_infobar_delegate_android .h"
(...skipping 21 matching lines...) Expand all
32 } 32 }
33 33
34 void PermissionPromptAndroid::Show( 34 void PermissionPromptAndroid::Show(
35 const std::vector<PermissionRequest*>& requests, 35 const std::vector<PermissionRequest*>& requests,
36 const std::vector<bool>& values) { 36 const std::vector<bool>& values) {
37 InfoBarService* infobar_service = 37 InfoBarService* infobar_service =
38 InfoBarService::FromWebContents(web_contents_); 38 InfoBarService::FromWebContents(web_contents_);
39 if (!infobar_service) 39 if (!infobar_service)
40 return; 40 return;
41 41
42 infobar_ = GroupedPermissionInfoBarDelegate::Create( 42 requests_ = requests;
43 this, infobar_service, requests[0]->GetOrigin(), requests); 43 infobar_ = GroupedPermissionInfoBarDelegate::Create(this, infobar_service,
44 requests[0]->GetOrigin());
44 } 45 }
45 46
46 bool PermissionPromptAndroid::CanAcceptRequestUpdate() { 47 bool PermissionPromptAndroid::CanAcceptRequestUpdate() {
47 return false; 48 return false;
48 } 49 }
49 50
50 void PermissionPromptAndroid::Hide() { 51 void PermissionPromptAndroid::Hide() {
51 InfoBarService* infobar_service = 52 InfoBarService* infobar_service =
52 InfoBarService::FromWebContents(web_contents_); 53 InfoBarService::FromWebContents(web_contents_);
53 if (infobar_ && infobar_service) { 54 if (infobar_ && infobar_service) {
54 infobar_service->RemoveInfoBar(infobar_); 55 infobar_service->RemoveInfoBar(infobar_);
55 } 56 }
56 infobar_ = nullptr; 57 infobar_ = nullptr;
57 } 58 }
58 59
59 bool PermissionPromptAndroid::IsVisible() { 60 bool PermissionPromptAndroid::IsVisible() {
60 return infobar_ != nullptr; 61 return infobar_ != nullptr;
61 } 62 }
62 63
63 void PermissionPromptAndroid::UpdateAnchorPosition() { 64 void PermissionPromptAndroid::UpdateAnchorPosition() {
64 NOTREACHED() << "UpdateAnchorPosition is not implemented"; 65 NOTREACHED() << "UpdateAnchorPosition is not implemented";
65 } 66 }
66 67
67 gfx::NativeWindow PermissionPromptAndroid::GetNativeWindow() { 68 gfx::NativeWindow PermissionPromptAndroid::GetNativeWindow() {
68 NOTREACHED() << "GetNativeWindow is not implemented"; 69 NOTREACHED() << "GetNativeWindow is not implemented";
69 return nullptr; 70 return nullptr;
70 } 71 }
71 72
72 void PermissionPromptAndroid::Closing() { 73 void PermissionPromptAndroid::Closing() {
74 requests_.clear();
dominickn 2017/03/16 03:55:07 Should requests be cleared before or after calling
Timothy Loh 2017/03/17 00:47:27 If we have a queued request, the PermissionRequest
73 if (delegate_) 75 if (delegate_)
74 delegate_->Closing(); 76 delegate_->Closing();
75 } 77 }
76 78
77 void PermissionPromptAndroid::ToggleAccept(int index, bool value) { 79 void PermissionPromptAndroid::ToggleAccept(int index, bool value) {
78 if (delegate_) 80 if (delegate_)
79 delegate_->ToggleAccept(index, value); 81 delegate_->ToggleAccept(index, value);
80 } 82 }
81 83
82 void PermissionPromptAndroid::Accept() { 84 void PermissionPromptAndroid::Accept() {
85 requests_.clear();
83 if (delegate_) 86 if (delegate_)
84 delegate_->Accept(); 87 delegate_->Accept();
85 } 88 }
86 89
87 void PermissionPromptAndroid::Deny() { 90 void PermissionPromptAndroid::Deny() {
91 requests_.clear();
88 if (delegate_) 92 if (delegate_)
89 delegate_->Deny(); 93 delegate_->Deny();
90 } 94 }
91 95
92 // static 96 // static
93 std::unique_ptr<PermissionPrompt> PermissionPrompt::Create( 97 std::unique_ptr<PermissionPrompt> PermissionPrompt::Create(
94 content::WebContents* web_contents) { 98 content::WebContents* web_contents) {
95 return base::MakeUnique<PermissionPromptAndroid>(web_contents); 99 return base::MakeUnique<PermissionPromptAndroid>(web_contents);
96 } 100 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698