OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_request_impl.h" | 5 #include "chrome/browser/permissions/permission_request_impl.h" |
6 | 6 |
7 #include "build/build_config.h" | 7 #include "build/build_config.h" |
8 #include "chrome/browser/permissions/permission_context_base.h" | 8 #include "chrome/browser/permissions/permission_context_base.h" |
9 #include "chrome/browser/permissions/permission_uma_util.h" | 9 #include "chrome/browser/permissions/permission_uma_util.h" |
10 #include "chrome/grit/generated_resources.h" | 10 #include "chrome/grit/generated_resources.h" |
11 #include "components/url_formatter/elide_url.h" | 11 #include "components/url_formatter/elide_url.h" |
12 #include "grit/theme_resources.h" | 12 #include "grit/theme_resources.h" |
13 #include "net/base/escape.h" | 13 #include "net/base/escape.h" |
14 #include "ui/base/l10n/l10n_util.h" | 14 #include "ui/base/l10n/l10n_util.h" |
15 #include "ui/gfx/vector_icons_public.h" | 15 #include "ui/gfx/vector_icons_public.h" |
16 | 16 |
17 PermissionRequestImpl::PermissionRequestImpl( | 17 PermissionRequestImpl::PermissionRequestImpl( |
18 const GURL& request_origin, | 18 const GURL& request_origin, |
19 content::PermissionType permission_type, | 19 content::PermissionType permission_type, |
| 20 bool user_gesture, |
20 Profile* profile, | 21 Profile* profile, |
21 const PermissionDecidedCallback& permission_decided_callback, | 22 const PermissionDecidedCallback& permission_decided_callback, |
22 const base::Closure delete_callback) | 23 const base::Closure delete_callback) |
23 : request_origin_(request_origin), | 24 : request_origin_(request_origin), |
24 permission_type_(permission_type), | 25 permission_type_(permission_type), |
| 26 user_gesture_(user_gesture), |
25 profile_(profile), | 27 profile_(profile), |
26 permission_decided_callback_(permission_decided_callback), | 28 permission_decided_callback_(permission_decided_callback), |
27 delete_callback_(delete_callback), | 29 delete_callback_(delete_callback), |
28 is_finished_(false), | 30 is_finished_(false), |
29 action_taken_(false) {} | 31 action_taken_(false) {} |
30 | 32 |
31 PermissionRequestImpl::~PermissionRequestImpl() { | 33 PermissionRequestImpl::~PermissionRequestImpl() { |
32 DCHECK(is_finished_); | 34 DCHECK(is_finished_); |
33 if (!action_taken_) { | 35 if (!action_taken_) { |
34 PermissionUmaUtil::PermissionIgnored(permission_type_, request_origin_, | 36 PermissionUmaUtil::PermissionIgnored(permission_type_, user_gesture_, |
35 profile_); | 37 request_origin_, profile_); |
36 } | 38 } |
37 } | 39 } |
38 | 40 |
39 gfx::VectorIconId PermissionRequestImpl::GetVectorIconId() const { | 41 gfx::VectorIconId PermissionRequestImpl::GetVectorIconId() const { |
40 #if !defined(OS_MACOSX) && !defined(OS_ANDROID) | 42 #if !defined(OS_MACOSX) && !defined(OS_ANDROID) |
41 switch (permission_type_) { | 43 switch (permission_type_) { |
42 case content::PermissionType::GEOLOCATION: | 44 case content::PermissionType::GEOLOCATION: |
43 return gfx::VectorIconId::LOCATION_ON; | 45 return gfx::VectorIconId::LOCATION_ON; |
44 #if defined(ENABLE_NOTIFICATIONS) | 46 #if defined(ENABLE_NOTIFICATIONS) |
45 case content::PermissionType::NOTIFICATIONS: | 47 case content::PermissionType::NOTIFICATIONS: |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 return PermissionRequestType::PERMISSION_PUSH_MESSAGING; | 153 return PermissionRequestType::PERMISSION_PUSH_MESSAGING; |
152 #if defined(OS_CHROMEOS) | 154 #if defined(OS_CHROMEOS) |
153 case content::PermissionType::PROTECTED_MEDIA_IDENTIFIER: | 155 case content::PermissionType::PROTECTED_MEDIA_IDENTIFIER: |
154 return PermissionRequestType::PERMISSION_PROTECTED_MEDIA_IDENTIFIER; | 156 return PermissionRequestType::PERMISSION_PROTECTED_MEDIA_IDENTIFIER; |
155 #endif | 157 #endif |
156 default: | 158 default: |
157 NOTREACHED(); | 159 NOTREACHED(); |
158 return PermissionRequestType::UNKNOWN; | 160 return PermissionRequestType::UNKNOWN; |
159 } | 161 } |
160 } | 162 } |
OLD | NEW |