| 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/chrome_geolocation_permission_context.h" | 5 #include "chrome/browser/geolocation/chrome_geolocation_permission_context.h" |
| 6 | 6 |
| 7 #include <functional> | 7 #include <functional> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 171 const GURL& requesting_frame_url, | 171 const GURL& requesting_frame_url, |
| 172 const std::string& display_languages) | 172 const std::string& display_languages) |
| 173 : ConfirmInfoBarDelegate(infobar_helper), | 173 : ConfirmInfoBarDelegate(infobar_helper), |
| 174 controller_(controller), | 174 controller_(controller), |
| 175 render_process_id_(render_process_id), | 175 render_process_id_(render_process_id), |
| 176 render_view_id_(render_view_id), | 176 render_view_id_(render_view_id), |
| 177 bridge_id_(bridge_id), | 177 bridge_id_(bridge_id), |
| 178 requesting_frame_url_(requesting_frame_url), | 178 requesting_frame_url_(requesting_frame_url), |
| 179 display_languages_(display_languages) { | 179 display_languages_(display_languages) { |
| 180 const NavigationEntry* committed_entry = | 180 const NavigationEntry* committed_entry = |
| 181 infobar_helper->web_contents()->GetController().GetLastCommittedEntry(); | 181 infobar_helper->GetWebContents()->GetController().GetLastCommittedEntry(); |
| 182 set_contents_unique_id(committed_entry ? committed_entry->GetUniqueID() : 0); | 182 set_contents_unique_id(committed_entry ? committed_entry->GetUniqueID() : 0); |
| 183 } | 183 } |
| 184 | 184 |
| 185 gfx::Image* GeolocationConfirmInfoBarDelegate::GetIcon() const { | 185 gfx::Image* GeolocationConfirmInfoBarDelegate::GetIcon() const { |
| 186 return &ResourceBundle::GetSharedInstance().GetNativeImageNamed( | 186 return &ResourceBundle::GetSharedInstance().GetNativeImageNamed( |
| 187 IDR_GEOLOCATION_INFOBAR_ICON); | 187 IDR_GEOLOCATION_INFOBAR_ICON); |
| 188 } | 188 } |
| 189 | 189 |
| 190 InfoBarDelegate::Type | 190 InfoBarDelegate::Type |
| 191 GeolocationConfirmInfoBarDelegate::GetInfoBarType() const { | 191 GeolocationConfirmInfoBarDelegate::GetInfoBarType() const { |
| 192 return PAGE_ACTION_TYPE; | 192 return PAGE_ACTION_TYPE; |
| 193 } | 193 } |
| 194 | 194 |
| 195 string16 GeolocationConfirmInfoBarDelegate::GetMessageText() const { | 195 string16 GeolocationConfirmInfoBarDelegate::GetMessageText() const { |
| 196 return l10n_util::GetStringFUTF16(IDS_GEOLOCATION_INFOBAR_QUESTION, | 196 return l10n_util::GetStringFUTF16(IDS_GEOLOCATION_INFOBAR_QUESTION, |
| 197 net::FormatUrl(requesting_frame_url_.GetOrigin(), display_languages_)); | 197 net::FormatUrl(requesting_frame_url_.GetOrigin(), display_languages_)); |
| 198 } | 198 } |
| 199 | 199 |
| 200 string16 GeolocationConfirmInfoBarDelegate::GetButtonLabel( | 200 string16 GeolocationConfirmInfoBarDelegate::GetButtonLabel( |
| 201 InfoBarButton button) const { | 201 InfoBarButton button) const { |
| 202 return l10n_util::GetStringUTF16((button == BUTTON_OK) ? | 202 return l10n_util::GetStringUTF16((button == BUTTON_OK) ? |
| 203 IDS_GEOLOCATION_ALLOW_BUTTON : IDS_GEOLOCATION_DENY_BUTTON); | 203 IDS_GEOLOCATION_ALLOW_BUTTON : IDS_GEOLOCATION_DENY_BUTTON); |
| 204 } | 204 } |
| 205 | 205 |
| 206 bool GeolocationConfirmInfoBarDelegate::Accept() { | 206 bool GeolocationConfirmInfoBarDelegate::Accept() { |
| 207 controller_->OnPermissionSet(render_process_id_, render_view_id_, bridge_id_, | 207 controller_->OnPermissionSet(render_process_id_, render_view_id_, bridge_id_, |
| 208 requesting_frame_url_, owner()->web_contents()->GetURL(), true); | 208 requesting_frame_url_, owner()->GetWebContents()->GetURL(), true); |
| 209 return true; | 209 return true; |
| 210 } | 210 } |
| 211 | 211 |
| 212 bool GeolocationConfirmInfoBarDelegate::Cancel() { | 212 bool GeolocationConfirmInfoBarDelegate::Cancel() { |
| 213 controller_->OnPermissionSet(render_process_id_, render_view_id_, bridge_id_, | 213 controller_->OnPermissionSet(render_process_id_, render_view_id_, bridge_id_, |
| 214 requesting_frame_url_, owner()->web_contents()->GetURL(), | 214 requesting_frame_url_, owner()->GetWebContents()->GetURL(), |
| 215 false); | 215 false); |
| 216 return true; | 216 return true; |
| 217 } | 217 } |
| 218 | 218 |
| 219 string16 GeolocationConfirmInfoBarDelegate::GetLinkText() const { | 219 string16 GeolocationConfirmInfoBarDelegate::GetLinkText() const { |
| 220 return l10n_util::GetStringUTF16(IDS_LEARN_MORE); | 220 return l10n_util::GetStringUTF16(IDS_LEARN_MORE); |
| 221 } | 221 } |
| 222 | 222 |
| 223 bool GeolocationConfirmInfoBarDelegate::LinkClicked( | 223 bool GeolocationConfirmInfoBarDelegate::LinkClicked( |
| 224 WindowOpenDisposition disposition) { | 224 WindowOpenDisposition disposition) { |
| 225 const char kGeolocationLearnMoreUrl[] = | 225 const char kGeolocationLearnMoreUrl[] = |
| 226 #if defined(OS_CHROMEOS) | 226 #if defined(OS_CHROMEOS) |
| 227 "https://www.google.com/support/chromeos/bin/answer.py?answer=142065"; | 227 "https://www.google.com/support/chromeos/bin/answer.py?answer=142065"; |
| 228 #else | 228 #else |
| 229 "https://www.google.com/support/chrome/bin/answer.py?answer=142065"; | 229 "https://www.google.com/support/chrome/bin/answer.py?answer=142065"; |
| 230 #endif | 230 #endif |
| 231 | 231 |
| 232 OpenURLParams params( | 232 OpenURLParams params( |
| 233 google_util::AppendGoogleLocaleParam(GURL(kGeolocationLearnMoreUrl)), | 233 google_util::AppendGoogleLocaleParam(GURL(kGeolocationLearnMoreUrl)), |
| 234 Referrer(), | 234 Referrer(), |
| 235 (disposition == CURRENT_TAB) ? NEW_FOREGROUND_TAB : disposition, | 235 (disposition == CURRENT_TAB) ? NEW_FOREGROUND_TAB : disposition, |
| 236 content::PAGE_TRANSITION_LINK, false); | 236 content::PAGE_TRANSITION_LINK, false); |
| 237 owner()->web_contents()->OpenURL(params); | 237 owner()->GetWebContents()->OpenURL(params); |
| 238 return false; // Do not dismiss the info bar. | 238 return false; // Do not dismiss the info bar. |
| 239 } | 239 } |
| 240 | 240 |
| 241 } // namespace | 241 } // namespace |
| 242 | 242 |
| 243 | 243 |
| 244 // GeolocationInfoBarQueueController::PendingInfoBarRequest ------------------- | 244 // GeolocationInfoBarQueueController::PendingInfoBarRequest ------------------- |
| 245 | 245 |
| 246 struct GeolocationInfoBarQueueController::PendingInfoBarRequest { | 246 struct GeolocationInfoBarQueueController::PendingInfoBarRequest { |
| 247 public: | 247 public: |
| (...skipping 456 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 704 BrowserThread::UI, FROM_HERE, | 704 BrowserThread::UI, FROM_HERE, |
| 705 base::Bind( | 705 base::Bind( |
| 706 &ChromeGeolocationPermissionContext::CancelPendingInfoBarRequest, | 706 &ChromeGeolocationPermissionContext::CancelPendingInfoBarRequest, |
| 707 this, render_process_id, render_view_id, bridge_id)); | 707 this, render_process_id, render_view_id, bridge_id)); |
| 708 return; | 708 return; |
| 709 } | 709 } |
| 710 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 710 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 711 geolocation_infobar_queue_controller_->CancelInfoBarRequest(render_process_id, | 711 geolocation_infobar_queue_controller_->CancelInfoBarRequest(render_process_id, |
| 712 render_view_id, bridge_id); | 712 render_view_id, bridge_id); |
| 713 } | 713 } |
| OLD | NEW |