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/geolocation/geolocation_infobar_delegate.h" | 5 #include "chrome/browser/geolocation/geolocation_infobar_delegate.h" |
6 | 6 |
7 #include "base/metrics/histogram.h" | 7 #include "base/metrics/histogram.h" |
8 #include "chrome/browser/content_settings/permission_queue_controller.h" | 8 #include "chrome/browser/content_settings/permission_queue_controller.h" |
9 #include "chrome/browser/infobars/infobar_service.h" | 9 #include "chrome/browser/infobars/infobar_service.h" |
10 #include "components/google/core/browser/google_util.h" | 10 #include "components/google/core/browser/google_util.h" |
(...skipping 27 matching lines...) Expand all Loading... |
38 // User allowed use of geolocation. | 38 // User allowed use of geolocation. |
39 GEOLOCATION_INFO_BAR_DELEGATE_EVENT_ALLOW = 1, | 39 GEOLOCATION_INFO_BAR_DELEGATE_EVENT_ALLOW = 1, |
40 | 40 |
41 // User denied use of geolocation. | 41 // User denied use of geolocation. |
42 GEOLOCATION_INFO_BAR_DELEGATE_EVENT_DENY = 2, | 42 GEOLOCATION_INFO_BAR_DELEGATE_EVENT_DENY = 2, |
43 | 43 |
44 // User dismissed the bar. | 44 // User dismissed the bar. |
45 GEOLOCATION_INFO_BAR_DELEGATE_EVENT_DISMISS = 3, | 45 GEOLOCATION_INFO_BAR_DELEGATE_EVENT_DISMISS = 3, |
46 | 46 |
47 // User clicked on link. | 47 // User clicked on link. |
48 GEOLOCATION_INFO_BAR_DELEGATE_EVENT_LINK_CLICK = 4, | 48 DEPRECATED_GEOLOCATION_INFO_BAR_DELEGATE_EVENT_LINK_CLICK = 4, |
49 | 49 |
50 // User ignored the bar. | 50 // User ignored the bar. |
51 GEOLOCATION_INFO_BAR_DELEGATE_EVENT_IGNORED = 5, | 51 GEOLOCATION_INFO_BAR_DELEGATE_EVENT_IGNORED = 5, |
52 | 52 |
53 // NOTE: Add entries only immediately above this line. | 53 // NOTE: Add entries only immediately above this line. |
54 GEOLOCATION_INFO_BAR_DELEGATE_EVENT_COUNT = 6 | 54 GEOLOCATION_INFO_BAR_DELEGATE_EVENT_COUNT = 6 |
55 }; | 55 }; |
56 | 56 |
57 void RecordUmaEvent(GeolocationInfoBarDelegateEvent event) { | 57 void RecordUmaEvent(GeolocationInfoBarDelegateEvent event) { |
58 UMA_HISTOGRAM_ENUMERATION("Geolocation.InfoBarDelegate.Event", | 58 UMA_HISTOGRAM_ENUMERATION("Geolocation.InfoBarDelegate.Event", |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 return l10n_util::GetStringUTF16((button == BUTTON_OK) ? | 156 return l10n_util::GetStringUTF16((button == BUTTON_OK) ? |
157 IDS_GEOLOCATION_ALLOW_BUTTON : IDS_GEOLOCATION_DENY_BUTTON); | 157 IDS_GEOLOCATION_ALLOW_BUTTON : IDS_GEOLOCATION_DENY_BUTTON); |
158 } | 158 } |
159 | 159 |
160 bool GeolocationInfoBarDelegate::Cancel() { | 160 bool GeolocationInfoBarDelegate::Cancel() { |
161 RecordUmaEvent(GEOLOCATION_INFO_BAR_DELEGATE_EVENT_DENY); | 161 RecordUmaEvent(GEOLOCATION_INFO_BAR_DELEGATE_EVENT_DENY); |
162 set_user_has_interacted(); | 162 set_user_has_interacted(); |
163 SetPermission(true, false); | 163 SetPermission(true, false); |
164 return true; | 164 return true; |
165 } | 165 } |
166 | |
167 base::string16 GeolocationInfoBarDelegate::GetLinkText() const { | |
168 return l10n_util::GetStringUTF16(IDS_LEARN_MORE); | |
169 } | |
170 | |
171 bool GeolocationInfoBarDelegate::LinkClicked( | |
172 WindowOpenDisposition disposition) { | |
173 RecordUmaEvent(GEOLOCATION_INFO_BAR_DELEGATE_EVENT_LINK_CLICK); | |
174 const char kGeolocationLearnMoreUrl[] = | |
175 #if defined(OS_CHROMEOS) | |
176 "https://www.google.com/support/chromeos/bin/answer.py?answer=142065"; | |
177 #elif defined(OS_ANDROID) | |
178 "https://support.google.com/chrome/?p=mobile_location"; | |
179 #else | |
180 "https://www.google.com/support/chrome/bin/answer.py?answer=142065"; | |
181 #endif | |
182 | |
183 InfoBarService::WebContentsFromInfoBar(infobar())->OpenURL( | |
184 content::OpenURLParams( | |
185 GURL(kGeolocationLearnMoreUrl), | |
186 content::Referrer(), | |
187 (disposition == CURRENT_TAB) ? NEW_FOREGROUND_TAB : disposition, | |
188 content::PAGE_TRANSITION_LINK, false)); | |
189 return false; // Do not dismiss the info bar. | |
190 } | |
OLD | NEW |