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/google/google_util.h" | 9 #include "chrome/browser/google/google_util.h" |
10 #include "chrome/browser/infobars/infobar.h" | 10 #include "chrome/browser/infobars/infobar.h" |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 | 106 |
107 bool GeolocationInfoBarDelegate::Accept() { | 107 bool GeolocationInfoBarDelegate::Accept() { |
108 RecordUmaEvent(GEOLOCATION_INFO_BAR_DELEGATE_EVENT_ALLOW); | 108 RecordUmaEvent(GEOLOCATION_INFO_BAR_DELEGATE_EVENT_ALLOW); |
109 set_user_has_interacted(); | 109 set_user_has_interacted(); |
110 SetPermission(true, true); | 110 SetPermission(true, true); |
111 return true; | 111 return true; |
112 } | 112 } |
113 | 113 |
114 void GeolocationInfoBarDelegate::SetPermission(bool update_content_setting, | 114 void GeolocationInfoBarDelegate::SetPermission(bool update_content_setting, |
115 bool allowed) { | 115 bool allowed) { |
| 116 content::WebContents* web_contents = |
| 117 InfoBarService::WebContentsFromInfoBar(infobar()); |
116 controller_->OnPermissionSet( | 118 controller_->OnPermissionSet( |
117 id_, requesting_frame_, | 119 id_, requesting_frame_, |
118 web_contents()->GetLastCommittedURL().GetOrigin(), | 120 web_contents->GetLastCommittedURL().GetOrigin(), |
119 update_content_setting, allowed); | 121 update_content_setting, allowed); |
120 } | 122 } |
121 | 123 |
122 void GeolocationInfoBarDelegate::InfoBarDismissed() { | 124 void GeolocationInfoBarDelegate::InfoBarDismissed() { |
123 RecordUmaEvent(GEOLOCATION_INFO_BAR_DELEGATE_EVENT_DISMISS); | 125 RecordUmaEvent(GEOLOCATION_INFO_BAR_DELEGATE_EVENT_DISMISS); |
124 set_user_has_interacted(); | 126 set_user_has_interacted(); |
125 SetPermission(false, false); | 127 SetPermission(false, false); |
126 } | 128 } |
127 | 129 |
128 int GeolocationInfoBarDelegate::GetIconID() const { | 130 int GeolocationInfoBarDelegate::GetIconID() const { |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 RecordUmaEvent(GEOLOCATION_INFO_BAR_DELEGATE_EVENT_LINK_CLICK); | 170 RecordUmaEvent(GEOLOCATION_INFO_BAR_DELEGATE_EVENT_LINK_CLICK); |
169 const char kGeolocationLearnMoreUrl[] = | 171 const char kGeolocationLearnMoreUrl[] = |
170 #if defined(OS_CHROMEOS) | 172 #if defined(OS_CHROMEOS) |
171 "https://www.google.com/support/chromeos/bin/answer.py?answer=142065"; | 173 "https://www.google.com/support/chromeos/bin/answer.py?answer=142065"; |
172 #elif defined(OS_ANDROID) | 174 #elif defined(OS_ANDROID) |
173 "https://support.google.com/chrome/?p=mobile_location"; | 175 "https://support.google.com/chrome/?p=mobile_location"; |
174 #else | 176 #else |
175 "https://www.google.com/support/chrome/bin/answer.py?answer=142065"; | 177 "https://www.google.com/support/chrome/bin/answer.py?answer=142065"; |
176 #endif | 178 #endif |
177 | 179 |
178 web_contents()->OpenURL(content::OpenURLParams( | 180 InfoBarService::WebContentsFromInfoBar(infobar())->OpenURL( |
179 google_util::AppendGoogleLocaleParam(GURL(kGeolocationLearnMoreUrl)), | 181 content::OpenURLParams( |
180 content::Referrer(), | 182 google_util::AppendGoogleLocaleParam(GURL(kGeolocationLearnMoreUrl)), |
181 (disposition == CURRENT_TAB) ? NEW_FOREGROUND_TAB : disposition, | 183 content::Referrer(), |
182 content::PAGE_TRANSITION_LINK, false)); | 184 (disposition == CURRENT_TAB) ? NEW_FOREGROUND_TAB : disposition, |
| 185 content::PAGE_TRANSITION_LINK, false)); |
183 return false; // Do not dismiss the info bar. | 186 return false; // Do not dismiss the info bar. |
184 } | 187 } |
OLD | NEW |