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

Side by Side Diff: chrome/browser/media/webrtc/media_stream_infobar_delegate_android.cc

Issue 2415863002: Use PermissionType instead of ContentSettingsType in Android permission infobars (Closed)
Patch Set: Merge branch 'master' into use_permission_type_for_infobar Created 4 years, 2 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/media/webrtc/media_stream_infobar_delegate_android.h" 5 #include "chrome/browser/media/webrtc/media_stream_infobar_delegate_android.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/logging.h" 10 #include "base/logging.h"
11 #include "base/metrics/histogram_macros.h" 11 #include "base/metrics/histogram_macros.h"
12 #include "base/strings/utf_string_conversions.h" 12 #include "base/strings/utf_string_conversions.h"
13 #include "chrome/browser/infobars/infobar_service.h" 13 #include "chrome/browser/infobars/infobar_service.h"
14 #include "chrome/browser/permissions/permission_uma_util.h" 14 #include "chrome/browser/permissions/permission_uma_util.h"
15 #include "chrome/browser/profiles/profile.h" 15 #include "chrome/browser/profiles/profile.h"
16 #include "chrome/common/url_constants.h" 16 #include "chrome/common/url_constants.h"
17 #include "chrome/grit/generated_resources.h" 17 #include "chrome/grit/generated_resources.h"
18 #include "chrome/grit/theme_resources.h" 18 #include "chrome/grit/theme_resources.h"
19 #include "components/content_settings/core/common/content_settings_types.h"
20 #include "components/google/core/browser/google_util.h" 19 #include "components/google/core/browser/google_util.h"
21 #include "components/infobars/core/infobar.h" 20 #include "components/infobars/core/infobar.h"
21 #include "content/public/browser/permission_type.h"
22 #include "content/public/browser/web_contents.h" 22 #include "content/public/browser/web_contents.h"
23 #include "content/public/common/origin_util.h" 23 #include "content/public/common/origin_util.h"
24 #include "ui/base/l10n/l10n_util.h" 24 #include "ui/base/l10n/l10n_util.h"
25 #include "url/gurl.h" 25 #include "url/gurl.h"
26 26
27 namespace { 27 namespace {
28 28
29 void DoNothing(bool update_content_setting, PermissionAction decision) {} 29 void DoNothing(bool update_content_setting, PermissionAction decision) {}
30 30
31 } // namespace 31 } // namespace
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 std::unique_ptr<MediaStreamDevicesController> controller) 79 std::unique_ptr<MediaStreamDevicesController> controller)
80 : PermissionInfoBarDelegate( 80 : PermissionInfoBarDelegate(
81 controller->GetOrigin(), 81 controller->GetOrigin(),
82 // The content setting type and permission type here are only passed 82 // The content setting type and permission type here are only passed
83 // in to fit into PermissionInfoBarDelegate, even though media infobar 83 // in to fit into PermissionInfoBarDelegate, even though media infobar
84 // controls both mic and camera. This is a temporary state for easy 84 // controls both mic and camera. This is a temporary state for easy
85 // refactoring. 85 // refactoring.
86 // TODO(lshang): Merge MediaStreamInfoBarDelegateAndroid into 86 // TODO(lshang): Merge MediaStreamInfoBarDelegateAndroid into
87 // GroupedPermissionInfoBarDelegate. See crbug.com/606138. 87 // GroupedPermissionInfoBarDelegate. See crbug.com/606138.
88 content::PermissionType::AUDIO_CAPTURE, 88 content::PermissionType::AUDIO_CAPTURE,
89 CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC,
90 false, 89 false,
91 profile, 90 profile,
92 // This is only passed in to fit into PermissionInfoBarDelegate. 91 // This is only passed in to fit into PermissionInfoBarDelegate.
93 // Infobar accepted/denied/dismissed is handled by controller, not via 92 // Infobar accepted/denied/dismissed is handled by controller, not via
94 // callbacks. 93 // callbacks.
95 base::Bind(&DoNothing)), 94 base::Bind(&DoNothing)),
96 controller_(std::move(controller)) { 95 controller_(std::move(controller)) {
97 DCHECK(controller_.get()); 96 DCHECK(controller_.get());
98 DCHECK(controller_->IsAskingForAudio() || controller_->IsAskingForVideo()); 97 DCHECK(controller_->IsAskingForAudio() || controller_->IsAskingForVideo());
99 } 98 }
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 } 179 }
181 180
182 base::string16 MediaStreamInfoBarDelegateAndroid::GetLinkText() const { 181 base::string16 MediaStreamInfoBarDelegateAndroid::GetLinkText() const {
183 return base::string16(); 182 return base::string16();
184 } 183 }
185 184
186 GURL MediaStreamInfoBarDelegateAndroid::GetLinkURL() const { 185 GURL MediaStreamInfoBarDelegateAndroid::GetLinkURL() const {
187 return GURL(chrome::kMediaAccessLearnMoreUrl); 186 return GURL(chrome::kMediaAccessLearnMoreUrl);
188 } 187 }
189 188
190 std::vector<int> MediaStreamInfoBarDelegateAndroid::content_settings() const { 189 std::vector<int> MediaStreamInfoBarDelegateAndroid::permission_types() const {
191 std::vector<int> types; 190 std::vector<int> types;
192 if (controller_->IsAskingForAudio()) 191 if (controller_->IsAskingForAudio())
193 types.push_back(CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC); 192 types.push_back(static_cast<int>(content::PermissionType::AUDIO_CAPTURE));
194 if (controller_->IsAskingForVideo()) 193 if (controller_->IsAskingForVideo())
195 types.push_back(CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA); 194 types.push_back(static_cast<int>(content::PermissionType::VIDEO_CAPTURE));
196 return types; 195 return types;
197 } 196 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698