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_confirm_infobar_delegate.h" | 5 #include "chrome/browser/geolocation/geolocation_confirm_infobar_delegate.h" |
6 | 6 |
7 #include "chrome/browser/api/infobars/infobar_service.h" | 7 #include "chrome/browser/api/infobars/infobar_service.h" |
8 #include "chrome/browser/geolocation/geolocation_infobar_queue_controller.h" | 8 #include "chrome/browser/geolocation/geolocation_infobar_queue_controller.h" |
9 #include "chrome/browser/google/google_util.h" | 9 #include "chrome/browser/google/google_util.h" |
10 #include "content/public/browser/navigation_details.h" | 10 #include "content/public/browser/navigation_details.h" |
11 #include "content/public/browser/navigation_entry.h" | 11 #include "content/public/browser/navigation_entry.h" |
12 #include "content/public/browser/web_contents.h" | 12 #include "content/public/browser/web_contents.h" |
13 #include "grit/generated_resources.h" | 13 #include "grit/generated_resources.h" |
14 #include "grit/locale_settings.h" | 14 #include "grit/locale_settings.h" |
15 #include "grit/theme_resources.h" | 15 #include "grit/theme_resources.h" |
16 #include "net/base/net_util.h" | 16 #include "net/base/net_util.h" |
17 #include "ui/base/l10n/l10n_util.h" | 17 #include "ui/base/l10n/l10n_util.h" |
18 #include "ui/base/resource/resource_bundle.h" | 18 #include "ui/base/resource/resource_bundle.h" |
19 | 19 |
| 20 #if defined(OS_ANDROID) |
| 21 #include "chrome/browser/geolocation/geolocation_confirm_infobar_delegate_androi
d.h" |
| 22 typedef GeolocationConfirmInfoBarDelegateAndroid DelegateType; |
| 23 #else |
| 24 typedef GeolocationConfirmInfoBarDelegate DelegateType; |
| 25 #endif |
| 26 |
| 27 |
| 28 // static |
| 29 InfoBarDelegate* GeolocationConfirmInfoBarDelegate::Create( |
| 30 InfoBarService* infobar_service, |
| 31 GeolocationInfoBarQueueController* controller, |
| 32 const GeolocationPermissionRequestID& id, |
| 33 const GURL& requesting_frame, |
| 34 const std::string& display_languages) { |
| 35 return infobar_service->AddInfoBar(scoped_ptr<InfoBarDelegate>( |
| 36 new DelegateType(infobar_service, controller, id, requesting_frame, |
| 37 display_languages))); |
| 38 } |
20 | 39 |
21 GeolocationConfirmInfoBarDelegate::GeolocationConfirmInfoBarDelegate( | 40 GeolocationConfirmInfoBarDelegate::GeolocationConfirmInfoBarDelegate( |
22 InfoBarService* infobar_service, | 41 InfoBarService* infobar_service, |
23 GeolocationInfoBarQueueController* controller, | 42 GeolocationInfoBarQueueController* controller, |
24 const GeolocationPermissionRequestID& id, | 43 const GeolocationPermissionRequestID& id, |
25 const GURL& requesting_frame, | 44 const GURL& requesting_frame, |
26 const std::string& display_languages) | 45 const std::string& display_languages) |
27 : ConfirmInfoBarDelegate(infobar_service), | 46 : ConfirmInfoBarDelegate(infobar_service), |
28 controller_(controller), | 47 controller_(controller), |
29 id_(id), | 48 id_(id), |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 #endif | 116 #endif |
98 | 117 |
99 content::OpenURLParams params( | 118 content::OpenURLParams params( |
100 google_util::AppendGoogleLocaleParam(GURL(kGeolocationLearnMoreUrl)), | 119 google_util::AppendGoogleLocaleParam(GURL(kGeolocationLearnMoreUrl)), |
101 content::Referrer(), | 120 content::Referrer(), |
102 (disposition == CURRENT_TAB) ? NEW_FOREGROUND_TAB : disposition, | 121 (disposition == CURRENT_TAB) ? NEW_FOREGROUND_TAB : disposition, |
103 content::PAGE_TRANSITION_LINK, false); | 122 content::PAGE_TRANSITION_LINK, false); |
104 owner()->GetWebContents()->OpenURL(params); | 123 owner()->GetWebContents()->OpenURL(params); |
105 return false; // Do not dismiss the info bar. | 124 return false; // Do not dismiss the info bar. |
106 } | 125 } |
OLD | NEW |