| 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" |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 GeolocationInfoBarQueueController* controller, | 42 GeolocationInfoBarQueueController* controller, |
| 43 const GeolocationPermissionRequestID& id, | 43 const GeolocationPermissionRequestID& id, |
| 44 const GURL& requesting_frame, | 44 const GURL& requesting_frame, |
| 45 const std::string& display_languages) | 45 const std::string& display_languages) |
| 46 : ConfirmInfoBarDelegate(infobar_service), | 46 : ConfirmInfoBarDelegate(infobar_service), |
| 47 controller_(controller), | 47 controller_(controller), |
| 48 id_(id), | 48 id_(id), |
| 49 requesting_frame_(requesting_frame), | 49 requesting_frame_(requesting_frame), |
| 50 display_languages_(display_languages) { | 50 display_languages_(display_languages) { |
| 51 const content::NavigationEntry* committed_entry = infobar_service-> | 51 const content::NavigationEntry* committed_entry = infobar_service-> |
| 52 GetWebContents()->GetController().GetLastCommittedEntry(); | 52 web_contents()->GetController().GetLastCommittedEntry(); |
| 53 contents_unique_id_ = committed_entry ? committed_entry->GetUniqueID() : 0; | 53 contents_unique_id_ = committed_entry ? committed_entry->GetUniqueID() : 0; |
| 54 } | 54 } |
| 55 | 55 |
| 56 gfx::Image* GeolocationInfoBarDelegate::GetIcon() const { | 56 gfx::Image* GeolocationInfoBarDelegate::GetIcon() const { |
| 57 return &ResourceBundle::GetSharedInstance().GetNativeImageNamed( | 57 return &ResourceBundle::GetSharedInstance().GetNativeImageNamed( |
| 58 IDR_GEOLOCATION_INFOBAR_ICON); | 58 IDR_GEOLOCATION_INFOBAR_ICON); |
| 59 } | 59 } |
| 60 | 60 |
| 61 InfoBarDelegate::Type GeolocationInfoBarDelegate::GetInfoBarType() const { | 61 InfoBarDelegate::Type GeolocationInfoBarDelegate::GetInfoBarType() const { |
| 62 return PAGE_ACTION_TYPE; | 62 return PAGE_ACTION_TYPE; |
| (...skipping 17 matching lines...) Expand all Loading... |
| 80 | 80 |
| 81 string16 GeolocationInfoBarDelegate::GetButtonLabel( | 81 string16 GeolocationInfoBarDelegate::GetButtonLabel( |
| 82 InfoBarButton button) const { | 82 InfoBarButton button) const { |
| 83 return l10n_util::GetStringUTF16((button == BUTTON_OK) ? | 83 return l10n_util::GetStringUTF16((button == BUTTON_OK) ? |
| 84 IDS_GEOLOCATION_ALLOW_BUTTON : IDS_GEOLOCATION_DENY_BUTTON); | 84 IDS_GEOLOCATION_ALLOW_BUTTON : IDS_GEOLOCATION_DENY_BUTTON); |
| 85 } | 85 } |
| 86 | 86 |
| 87 void GeolocationInfoBarDelegate::SetPermission(bool update_content_setting, | 87 void GeolocationInfoBarDelegate::SetPermission(bool update_content_setting, |
| 88 bool allowed) { | 88 bool allowed) { |
| 89 controller_->OnPermissionSet(id_, requesting_frame_, | 89 controller_->OnPermissionSet(id_, requesting_frame_, |
| 90 owner()->GetWebContents()->GetURL(), | 90 owner()->web_contents()->GetURL(), |
| 91 update_content_setting, allowed); | 91 update_content_setting, allowed); |
| 92 } | 92 } |
| 93 | 93 |
| 94 bool GeolocationInfoBarDelegate::Accept() { | 94 bool GeolocationInfoBarDelegate::Accept() { |
| 95 SetPermission(true, true); | 95 SetPermission(true, true); |
| 96 return true; | 96 return true; |
| 97 } | 97 } |
| 98 | 98 |
| 99 bool GeolocationInfoBarDelegate::Cancel() { | 99 bool GeolocationInfoBarDelegate::Cancel() { |
| 100 SetPermission(true, false); | 100 SetPermission(true, false); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 112 "https://www.google.com/support/chromeos/bin/answer.py?answer=142065"; | 112 "https://www.google.com/support/chromeos/bin/answer.py?answer=142065"; |
| 113 #else | 113 #else |
| 114 "https://www.google.com/support/chrome/bin/answer.py?answer=142065"; | 114 "https://www.google.com/support/chrome/bin/answer.py?answer=142065"; |
| 115 #endif | 115 #endif |
| 116 | 116 |
| 117 content::OpenURLParams params( | 117 content::OpenURLParams params( |
| 118 google_util::AppendGoogleLocaleParam(GURL(kGeolocationLearnMoreUrl)), | 118 google_util::AppendGoogleLocaleParam(GURL(kGeolocationLearnMoreUrl)), |
| 119 content::Referrer(), | 119 content::Referrer(), |
| 120 (disposition == CURRENT_TAB) ? NEW_FOREGROUND_TAB : disposition, | 120 (disposition == CURRENT_TAB) ? NEW_FOREGROUND_TAB : disposition, |
| 121 content::PAGE_TRANSITION_LINK, false); | 121 content::PAGE_TRANSITION_LINK, false); |
| 122 owner()->GetWebContents()->OpenURL(params); | 122 owner()->web_contents()->OpenURL(params); |
| 123 return false; // Do not dismiss the info bar. | 123 return false; // Do not dismiss the info bar. |
| 124 } | 124 } |
| OLD | NEW |