| 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 "chrome/browser/content_settings/permission_queue_controller.h" | 7 #include "chrome/browser/content_settings/permission_queue_controller.h" |
| 8 #include "chrome/browser/google/google_util.h" | 8 #include "chrome/browser/google/google_util.h" |
| 9 #include "chrome/browser/infobars/infobar.h" |
| 9 #include "chrome/browser/infobars/infobar_service.h" | 10 #include "chrome/browser/infobars/infobar_service.h" |
| 10 #include "content/public/browser/navigation_details.h" | 11 #include "content/public/browser/navigation_details.h" |
| 11 #include "content/public/browser/navigation_entry.h" | 12 #include "content/public/browser/navigation_entry.h" |
| 12 #include "content/public/browser/web_contents.h" | 13 #include "content/public/browser/web_contents.h" |
| 13 #include "grit/generated_resources.h" | 14 #include "grit/generated_resources.h" |
| 14 #include "grit/locale_settings.h" | 15 #include "grit/locale_settings.h" |
| 15 #include "grit/theme_resources.h" | 16 #include "grit/theme_resources.h" |
| 16 #include "net/base/net_util.h" | 17 #include "net/base/net_util.h" |
| 17 #include "ui/base/l10n/l10n_util.h" | 18 #include "ui/base/l10n/l10n_util.h" |
| 18 | 19 |
| 19 #if defined(OS_ANDROID) | 20 #if defined(OS_ANDROID) |
| 20 #include "chrome/browser/geolocation/geolocation_infobar_delegate_android.h" | 21 #include "chrome/browser/geolocation/geolocation_infobar_delegate_android.h" |
| 21 typedef GeolocationInfoBarDelegateAndroid DelegateType; | 22 typedef GeolocationInfoBarDelegateAndroid DelegateType; |
| 22 #else | 23 #else |
| 23 typedef GeolocationInfoBarDelegate DelegateType; | 24 typedef GeolocationInfoBarDelegate DelegateType; |
| 24 #endif | 25 #endif |
| 25 | 26 |
| 26 | 27 |
| 27 // static | 28 // static |
| 28 InfoBarDelegate* GeolocationInfoBarDelegate::Create( | 29 InfoBar* GeolocationInfoBarDelegate::Create( |
| 29 InfoBarService* infobar_service, | 30 InfoBarService* infobar_service, |
| 30 PermissionQueueController* controller, | 31 PermissionQueueController* controller, |
| 31 const PermissionRequestID& id, | 32 const PermissionRequestID& id, |
| 32 const GURL& requesting_frame, | 33 const GURL& requesting_frame, |
| 33 const std::string& display_languages) { | 34 const std::string& display_languages) { |
| 34 const content::NavigationEntry* committed_entry = | 35 const content::NavigationEntry* committed_entry = |
| 35 infobar_service->web_contents()->GetController().GetLastCommittedEntry(); | 36 infobar_service->web_contents()->GetController().GetLastCommittedEntry(); |
| 36 return infobar_service->AddInfoBar(scoped_ptr<InfoBarDelegate>( | 37 return infobar_service->AddInfoBar(ConfirmInfoBarDelegate::CreateInfoBar( |
| 37 new DelegateType(infobar_service, controller, id, requesting_frame, | 38 scoped_ptr<ConfirmInfoBarDelegate>(new DelegateType( |
| 38 committed_entry ? committed_entry->GetUniqueID() : 0, | 39 controller, id, requesting_frame, |
| 39 display_languages))); | 40 committed_entry ? committed_entry->GetUniqueID() : 0, |
| 41 display_languages)))); |
| 40 } | 42 } |
| 41 | 43 |
| 42 GeolocationInfoBarDelegate::GeolocationInfoBarDelegate( | 44 GeolocationInfoBarDelegate::GeolocationInfoBarDelegate( |
| 43 InfoBarService* infobar_service, | |
| 44 PermissionQueueController* controller, | 45 PermissionQueueController* controller, |
| 45 const PermissionRequestID& id, | 46 const PermissionRequestID& id, |
| 46 const GURL& requesting_frame, | 47 const GURL& requesting_frame, |
| 47 int contents_unique_id, | 48 int contents_unique_id, |
| 48 const std::string& display_languages) | 49 const std::string& display_languages) |
| 49 : ConfirmInfoBarDelegate(infobar_service), | 50 : ConfirmInfoBarDelegate(), |
| 50 controller_(controller), | 51 controller_(controller), |
| 51 id_(id), | 52 id_(id), |
| 52 requesting_frame_(requesting_frame.GetOrigin()), | 53 requesting_frame_(requesting_frame.GetOrigin()), |
| 53 contents_unique_id_(contents_unique_id), | 54 contents_unique_id_(contents_unique_id), |
| 54 display_languages_(display_languages) { | 55 display_languages_(display_languages) { |
| 55 } | 56 } |
| 56 | 57 |
| 57 GeolocationInfoBarDelegate::~GeolocationInfoBarDelegate() { | 58 GeolocationInfoBarDelegate::~GeolocationInfoBarDelegate() { |
| 58 } | 59 } |
| 59 | 60 |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 "https://www.google.com/support/chrome/bin/answer.py?answer=142065"; | 124 "https://www.google.com/support/chrome/bin/answer.py?answer=142065"; |
| 124 #endif | 125 #endif |
| 125 | 126 |
| 126 web_contents()->OpenURL(content::OpenURLParams( | 127 web_contents()->OpenURL(content::OpenURLParams( |
| 127 google_util::AppendGoogleLocaleParam(GURL(kGeolocationLearnMoreUrl)), | 128 google_util::AppendGoogleLocaleParam(GURL(kGeolocationLearnMoreUrl)), |
| 128 content::Referrer(), | 129 content::Referrer(), |
| 129 (disposition == CURRENT_TAB) ? NEW_FOREGROUND_TAB : disposition, | 130 (disposition == CURRENT_TAB) ? NEW_FOREGROUND_TAB : disposition, |
| 130 content::PAGE_TRANSITION_LINK, false)); | 131 content::PAGE_TRANSITION_LINK, false)); |
| 131 return false; // Do not dismiss the info bar. | 132 return false; // Do not dismiss the info bar. |
| 132 } | 133 } |
| OLD | NEW |