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

Side by Side Diff: chrome/browser/content_settings/permission_bubble_request_impl.cc

Issue 371933002: Add UMA for the new generic permisison class (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 5 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 | Annotate | Revision Log
OLDNEW
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/content_settings/permission_bubble_request_impl.h" 5 #include "chrome/browser/content_settings/permission_bubble_request_impl.h"
6 6
7 #include "chrome/browser/content_settings/permission_context_base.h" 7 #include "chrome/browser/content_settings/permission_context_base.h"
8 #include "chrome/browser/content_settings/permission_context_uma_util.h"
8 #include "grit/generated_resources.h" 9 #include "grit/generated_resources.h"
9 #include "grit/theme_resources.h" 10 #include "grit/theme_resources.h"
10 #include "net/base/net_util.h" 11 #include "net/base/net_util.h"
11 #include "ui/base/l10n/l10n_util.h" 12 #include "ui/base/l10n/l10n_util.h"
12 13
13 PermissionBubbleRequestImpl::PermissionBubbleRequestImpl( 14 PermissionBubbleRequestImpl::PermissionBubbleRequestImpl(
14 const GURL& request_origin, 15 const GURL& request_origin,
15 bool user_gesture, 16 bool user_gesture,
16 ContentSettingsType type, 17 ContentSettingsType type,
17 const std::string& display_languages, 18 const std::string& display_languages,
18 const base::Callback<void(bool, bool)> permission_decided_callback, 19 const base::Callback<void(bool, bool)> permission_decided_callback,
19 const base::Closure delete_callback) 20 const base::Closure delete_callback)
20 : request_origin_(request_origin), 21 : request_origin_(request_origin),
21 user_gesture_(user_gesture), 22 user_gesture_(user_gesture),
22 type_(type), 23 type_(type),
23 display_languages_(display_languages), 24 display_languages_(display_languages),
24 permission_decided_callback_(permission_decided_callback), 25 permission_decided_callback_(permission_decided_callback),
25 delete_callback_(delete_callback), 26 delete_callback_(delete_callback),
26 is_finished_(false) { 27 is_finished_(false),
28 action_taken_(false) {
27 } 29 }
28 30
29 PermissionBubbleRequestImpl::~PermissionBubbleRequestImpl() { 31 PermissionBubbleRequestImpl::~PermissionBubbleRequestImpl() {
30 DCHECK(is_finished_); 32 DCHECK(is_finished_);
33 if (!action_taken_)
34 PermissionContextUmaUtil::PermissionIgnored(type_);
31 } 35 }
32 36
33 int PermissionBubbleRequestImpl::GetIconID() const { 37 int PermissionBubbleRequestImpl::GetIconID() const {
34 int icon_id; 38 int icon_id;
35 switch (type_) { 39 switch (type_) {
36 case CONTENT_SETTINGS_TYPE_MIDI_SYSEX: 40 case CONTENT_SETTINGS_TYPE_MIDI_SYSEX:
37 icon_id = IDR_ALLOWED_MIDI_SYSEX; 41 icon_id = IDR_ALLOWED_MIDI_SYSEX;
38 break; 42 break;
39 case CONTENT_SETTINGS_TYPE_PUSH_MESSAGING: 43 case CONTENT_SETTINGS_TYPE_PUSH_MESSAGING:
40 icon_id = IDR_INFOBAR_WARNING; 44 icon_id = IDR_INFOBAR_WARNING;
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 89
86 bool PermissionBubbleRequestImpl::HasUserGesture() const { 90 bool PermissionBubbleRequestImpl::HasUserGesture() const {
87 return user_gesture_; 91 return user_gesture_;
88 } 92 }
89 93
90 GURL PermissionBubbleRequestImpl::GetRequestingHostname() const { 94 GURL PermissionBubbleRequestImpl::GetRequestingHostname() const {
91 return request_origin_; 95 return request_origin_;
92 } 96 }
93 97
94 void PermissionBubbleRequestImpl::PermissionGranted() { 98 void PermissionBubbleRequestImpl::PermissionGranted() {
99 RegisterActionTaken();
95 permission_decided_callback_.Run(true, true); 100 permission_decided_callback_.Run(true, true);
96 } 101 }
97 102
98 void PermissionBubbleRequestImpl::PermissionDenied() { 103 void PermissionBubbleRequestImpl::PermissionDenied() {
104 RegisterActionTaken();
99 permission_decided_callback_.Run(true, false); 105 permission_decided_callback_.Run(true, false);
100 } 106 }
101 107
102 void PermissionBubbleRequestImpl::Cancelled() { 108 void PermissionBubbleRequestImpl::Cancelled() {
109 RegisterActionTaken();
103 permission_decided_callback_.Run(false, false); 110 permission_decided_callback_.Run(false, false);
104 } 111 }
105 112
106 void PermissionBubbleRequestImpl::RequestFinished() { 113 void PermissionBubbleRequestImpl::RequestFinished() {
107 is_finished_ = true; 114 is_finished_ = true;
108 delete_callback_.Run(); 115 delete_callback_.Run();
109 } 116 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698