| OLD | NEW |
| 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" |
| 11 #include "chrome/browser/permissions/permission_request.h" | 11 #include "chrome/browser/permissions/permission_request.h" |
| 12 #include "chrome/browser/permissions/permission_request_id.h" | 12 #include "chrome/browser/permissions/permission_request_id.h" |
| 13 #include "components/infobars/core/infobar.h" | 13 #include "components/infobars/core/infobar.h" |
| 14 #include "content/public/browser/web_contents.h" | 14 #include "content/public/browser/web_contents.h" |
| 15 | 15 |
| 16 PermissionPromptAndroid::PermissionPromptAndroid( | 16 PermissionPromptAndroid::PermissionPromptAndroid( |
| 17 content::WebContents* web_contents) | 17 content::WebContents* web_contents) |
| 18 : web_contents_(web_contents), delegate_(nullptr), infobar_(nullptr) { | 18 : web_contents_(web_contents), delegate_(nullptr), infobar_(nullptr) { |
| 19 DCHECK(web_contents); | 19 DCHECK(web_contents); |
| 20 } | 20 } |
| 21 | 21 |
| 22 PermissionPromptAndroid::~PermissionPromptAndroid() { | 22 PermissionPromptAndroid::~PermissionPromptAndroid() { |
| 23 GroupedPermissionInfoBarDelegate* infobar_delegate = | 23 if (infobar_) { |
| 24 static_cast<GroupedPermissionInfoBarDelegate*>(infobar_->delegate()); | 24 GroupedPermissionInfoBarDelegate* infobar_delegate = |
| 25 infobar_delegate->PermissionPromptDestroyed(); | 25 static_cast<GroupedPermissionInfoBarDelegate*>(infobar_->delegate()); |
| 26 infobar_delegate->PermissionPromptDestroyed(); |
| 27 } |
| 26 } | 28 } |
| 27 | 29 |
| 28 void PermissionPromptAndroid::SetDelegate(Delegate* delegate) { | 30 void PermissionPromptAndroid::SetDelegate(Delegate* delegate) { |
| 29 delegate_ = delegate; | 31 delegate_ = delegate; |
| 30 } | 32 } |
| 31 | 33 |
| 32 void PermissionPromptAndroid::Show( | 34 void PermissionPromptAndroid::Show( |
| 33 const std::vector<PermissionRequest*>& requests, | 35 const std::vector<PermissionRequest*>& requests, |
| 34 const std::vector<bool>& values) { | 36 const std::vector<bool>& values) { |
| 35 InfoBarService* infobar_service = | 37 InfoBarService* infobar_service = |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 void PermissionPromptAndroid::Deny() { | 87 void PermissionPromptAndroid::Deny() { |
| 86 if (delegate_) | 88 if (delegate_) |
| 87 delegate_->Deny(); | 89 delegate_->Deny(); |
| 88 } | 90 } |
| 89 | 91 |
| 90 // static | 92 // static |
| 91 std::unique_ptr<PermissionPrompt> PermissionPrompt::Create( | 93 std::unique_ptr<PermissionPrompt> PermissionPrompt::Create( |
| 92 content::WebContents* web_contents) { | 94 content::WebContents* web_contents) { |
| 93 return base::MakeUnique<PermissionPromptAndroid>(web_contents); | 95 return base::MakeUnique<PermissionPromptAndroid>(web_contents); |
| 94 } | 96 } |
| OLD | NEW |