OLD | NEW |
---|---|
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/media_stream_infobar_delegate_android.h" | 5 #include "chrome/browser/media/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.h" | 11 #include "base/metrics/histogram.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/common/url_constants.h" | 15 #include "chrome/common/url_constants.h" |
15 #include "chrome/grit/generated_resources.h" | 16 #include "chrome/grit/generated_resources.h" |
16 #include "components/content_settings/core/common/content_settings_types.h" | 17 #include "components/content_settings/core/common/content_settings_types.h" |
17 #include "components/google/core/browser/google_util.h" | 18 #include "components/google/core/browser/google_util.h" |
18 #include "components/infobars/core/infobar.h" | 19 #include "components/infobars/core/infobar.h" |
19 #include "content/public/browser/web_contents.h" | 20 #include "content/public/browser/web_contents.h" |
20 #include "content/public/common/origin_util.h" | 21 #include "content/public/common/origin_util.h" |
21 #include "grit/components_strings.h" | 22 #include "grit/components_strings.h" |
22 #include "grit/theme_resources.h" | 23 #include "grit/theme_resources.h" |
23 #include "ui/base/l10n/l10n_util.h" | 24 #include "ui/base/l10n/l10n_util.h" |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
99 return this; | 100 return this; |
100 } | 101 } |
101 | 102 |
102 bool MediaStreamInfoBarDelegateAndroid::Accept() { | 103 bool MediaStreamInfoBarDelegateAndroid::Accept() { |
103 if (GetPermissionCount() == 2) { | 104 if (GetPermissionCount() == 2) { |
104 controller_->GroupedRequestFinished( | 105 controller_->GroupedRequestFinished( |
105 GetAcceptState(kGroupedInfobarAudioPosition), | 106 GetAcceptState(kGroupedInfobarAudioPosition), |
106 GetAcceptState(kGroupedInfobarVideoPosition)); | 107 GetAcceptState(kGroupedInfobarVideoPosition)); |
107 } else { | 108 } else { |
108 DCHECK_EQ(1, GetPermissionCount()); | 109 DCHECK_EQ(1, GetPermissionCount()); |
109 controller_->PermissionGranted(); | 110 bool persist_permission = true; |
111 if (ShouldShowPersistenceToggle()) { | |
112 persist_permission = persist(); | |
113 PermissionUmaUtil::PermissionPromptAcceptedWithPersistenceToggle( | |
114 controller_->GetPermissionTypeForContentSettingsType( | |
115 GetContentSettingType(0)), | |
116 persist_permission); | |
117 } | |
118 controller_->PermissionGranted(persist_permission); | |
110 } | 119 } |
111 return true; | 120 return true; |
112 } | 121 } |
113 | 122 |
114 bool MediaStreamInfoBarDelegateAndroid::Cancel() { | 123 bool MediaStreamInfoBarDelegateAndroid::Cancel() { |
115 controller_->PermissionDenied(); | 124 bool persist_permission = true; |
125 if (ShouldShowPersistenceToggle()) { | |
126 persist_permission = persist(); | |
127 PermissionUmaUtil::PermissionPromptDeniedWithPersistenceToggle( | |
128 controller_->GetPermissionTypeForContentSettingsType( | |
129 GetContentSettingType(0)), | |
raymes
2016/08/18 06:10:01
How come we only deal with the case when one permi
dominickn
2016/08/18 06:38:20
As discussed, enabling for multiple.
| |
130 persist_permission); | |
131 } | |
132 controller_->PermissionDenied(persist_permission); | |
116 return true; | 133 return true; |
117 } | 134 } |
OLD | NEW |