| 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/geolocation/geolocation_infobar_queue_controller.h" | 7 #include "chrome/browser/geolocation/geolocation_infobar_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_service.h" | 9 #include "chrome/browser/infobars/infobar_service.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" | |
| 19 | 18 |
| 20 #if defined(OS_ANDROID) | 19 #if defined(OS_ANDROID) |
| 21 #include "chrome/browser/geolocation/geolocation_infobar_delegate_android.h" | 20 #include "chrome/browser/geolocation/geolocation_infobar_delegate_android.h" |
| 22 typedef GeolocationInfoBarDelegateAndroid DelegateType; | 21 typedef GeolocationInfoBarDelegateAndroid DelegateType; |
| 23 #else | 22 #else |
| 24 typedef GeolocationInfoBarDelegate DelegateType; | 23 typedef GeolocationInfoBarDelegate DelegateType; |
| 25 #endif | 24 #endif |
| 26 | 25 |
| 27 | 26 |
| 28 // static | 27 // static |
| (...skipping 29 matching lines...) Expand all Loading... |
| 58 return true; | 57 return true; |
| 59 } | 58 } |
| 60 | 59 |
| 61 void GeolocationInfoBarDelegate::SetPermission(bool update_content_setting, | 60 void GeolocationInfoBarDelegate::SetPermission(bool update_content_setting, |
| 62 bool allowed) { | 61 bool allowed) { |
| 63 controller_->OnPermissionSet(id_, requesting_frame_, | 62 controller_->OnPermissionSet(id_, requesting_frame_, |
| 64 web_contents()->GetURL(), | 63 web_contents()->GetURL(), |
| 65 update_content_setting, allowed); | 64 update_content_setting, allowed); |
| 66 } | 65 } |
| 67 | 66 |
| 68 gfx::Image* GeolocationInfoBarDelegate::GetIcon() const { | 67 int GeolocationInfoBarDelegate::GetIconID() const { |
| 69 return &ResourceBundle::GetSharedInstance().GetNativeImageNamed( | 68 return IDR_GEOLOCATION_INFOBAR_ICON; |
| 70 IDR_GEOLOCATION_INFOBAR_ICON); | |
| 71 } | 69 } |
| 72 | 70 |
| 73 InfoBarDelegate::Type GeolocationInfoBarDelegate::GetInfoBarType() const { | 71 InfoBarDelegate::Type GeolocationInfoBarDelegate::GetInfoBarType() const { |
| 74 return PAGE_ACTION_TYPE; | 72 return PAGE_ACTION_TYPE; |
| 75 } | 73 } |
| 76 | 74 |
| 77 bool GeolocationInfoBarDelegate::ShouldExpireInternal( | 75 bool GeolocationInfoBarDelegate::ShouldExpireInternal( |
| 78 const content::LoadCommittedDetails& details) const { | 76 const content::LoadCommittedDetails& details) const { |
| 79 // This implementation matches InfoBarDelegate::ShouldExpireInternal(), but | 77 // This implementation matches InfoBarDelegate::ShouldExpireInternal(), but |
| 80 // uses the unique ID we set in the constructor instead of that stored in the | 78 // uses the unique ID we set in the constructor instead of that stored in the |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 #endif | 113 #endif |
| 116 | 114 |
| 117 content::OpenURLParams params( | 115 content::OpenURLParams params( |
| 118 google_util::AppendGoogleLocaleParam(GURL(kGeolocationLearnMoreUrl)), | 116 google_util::AppendGoogleLocaleParam(GURL(kGeolocationLearnMoreUrl)), |
| 119 content::Referrer(), | 117 content::Referrer(), |
| 120 (disposition == CURRENT_TAB) ? NEW_FOREGROUND_TAB : disposition, | 118 (disposition == CURRENT_TAB) ? NEW_FOREGROUND_TAB : disposition, |
| 121 content::PAGE_TRANSITION_LINK, false); | 119 content::PAGE_TRANSITION_LINK, false); |
| 122 web_contents()->OpenURL(params); | 120 web_contents()->OpenURL(params); |
| 123 return false; // Do not dismiss the info bar. | 121 return false; // Do not dismiss the info bar. |
| 124 } | 122 } |
| OLD | NEW |