| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_permission_context.h" | 5 #include "chrome/browser/geolocation/geolocation_permission_context.h" |
| 6 | 6 |
| 7 #include "app/l10n_util.h" | 7 #include "app/l10n_util.h" |
| 8 #include "app/resource_bundle.h" | 8 #include "app/resource_bundle.h" |
| 9 #include "chrome/browser/browser.h" | 9 #include "chrome/browser/browser.h" |
| 10 #include "chrome/browser/chrome_thread.h" | 10 #include "chrome/browser/chrome_thread.h" |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 // ConfirmInfoBarDelegate | 105 // ConfirmInfoBarDelegate |
| 106 virtual void InfoBarClosed() { | 106 virtual void InfoBarClosed() { |
| 107 controller_->OnInfoBarClosed(render_process_id_, render_view_id_, | 107 controller_->OnInfoBarClosed(render_process_id_, render_view_id_, |
| 108 bridge_id_); | 108 bridge_id_); |
| 109 delete this; | 109 delete this; |
| 110 } | 110 } |
| 111 virtual Type GetInfoBarType() { return PAGE_ACTION_TYPE; } | 111 virtual Type GetInfoBarType() { return PAGE_ACTION_TYPE; } |
| 112 virtual bool Accept() { return OnPermissionSet(true); } | 112 virtual bool Accept() { return OnPermissionSet(true); } |
| 113 virtual bool Cancel() { return OnPermissionSet(false); } | 113 virtual bool Cancel() { return OnPermissionSet(false); } |
| 114 virtual int GetButtons() const { return BUTTON_OK | BUTTON_CANCEL; } | 114 virtual int GetButtons() const { return BUTTON_OK | BUTTON_CANCEL; } |
| 115 virtual std::wstring GetButtonLabel(InfoBarButton button) const { | 115 virtual string16 GetButtonLabel(InfoBarButton button) const { |
| 116 switch (button) { | 116 switch (button) { |
| 117 case BUTTON_OK: | 117 case BUTTON_OK: |
| 118 return l10n_util::GetString(IDS_GEOLOCATION_ALLOW_BUTTON); | 118 return l10n_util::GetStringUTF16(IDS_GEOLOCATION_ALLOW_BUTTON); |
| 119 case BUTTON_CANCEL: | 119 case BUTTON_CANCEL: |
| 120 return l10n_util::GetString(IDS_GEOLOCATION_DENY_BUTTON); | 120 return l10n_util::GetStringUTF16(IDS_GEOLOCATION_DENY_BUTTON); |
| 121 default: | 121 default: |
| 122 // All buttons are labeled above. | 122 // All buttons are labeled above. |
| 123 NOTREACHED() << "Bad button id " << button; | 123 NOTREACHED() << "Bad button id " << button; |
| 124 return L""; | 124 return string16(); |
| 125 } | 125 } |
| 126 } | 126 } |
| 127 virtual std::wstring GetMessageText() const { | 127 virtual string16 GetMessageText() const { |
| 128 return l10n_util::GetStringF( | 128 return l10n_util::GetStringFUTF16( |
| 129 IDS_GEOLOCATION_INFOBAR_QUESTION, | 129 IDS_GEOLOCATION_INFOBAR_QUESTION, |
| 130 net::FormatUrl(requesting_frame_url_.GetOrigin(), display_languages_)); | 130 WideToUTF16Hack(net::FormatUrl(requesting_frame_url_.GetOrigin(), |
| 131 display_languages_))); |
| 131 } | 132 } |
| 132 virtual SkBitmap* GetIcon() const { | 133 virtual SkBitmap* GetIcon() const { |
| 133 return ResourceBundle::GetSharedInstance().GetBitmapNamed( | 134 return ResourceBundle::GetSharedInstance().GetBitmapNamed( |
| 134 IDR_GEOLOCATION_INFOBAR_ICON); | 135 IDR_GEOLOCATION_INFOBAR_ICON); |
| 135 } | 136 } |
| 136 virtual std::wstring GetLinkText() { | 137 virtual string16 GetLinkText() { |
| 137 return l10n_util::GetString(IDS_LEARN_MORE); | 138 return l10n_util::GetStringUTF16(IDS_LEARN_MORE); |
| 138 } | 139 } |
| 139 virtual bool LinkClicked(WindowOpenDisposition disposition) { | 140 virtual bool LinkClicked(WindowOpenDisposition disposition) { |
| 140 // Ignore the click dispostion and always open in a new top level tab. | 141 // Ignore the click dispostion and always open in a new top level tab. |
| 141 tab_contents_->OpenURL( | 142 tab_contents_->OpenURL( |
| 142 GURL(l10n_util::GetStringUTF8(IDS_LEARN_MORE_GEOLOCATION_URL)), GURL(), | 143 GURL(l10n_util::GetStringUTF8(IDS_LEARN_MORE_GEOLOCATION_URL)), GURL(), |
| 143 NEW_FOREGROUND_TAB, PageTransition::LINK); | 144 NEW_FOREGROUND_TAB, PageTransition::LINK); |
| 144 return false; // Do not dismiss the info bar. | 145 return false; // Do not dismiss the info bar. |
| 145 } | 146 } |
| 146 | 147 |
| 147 private: | 148 private: |
| (...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 465 ChromeThread::UI, FROM_HERE, | 466 ChromeThread::UI, FROM_HERE, |
| 466 NewRunnableMethod(this, | 467 NewRunnableMethod(this, |
| 467 &GeolocationPermissionContext::CancelPendingInfoBarRequest, | 468 &GeolocationPermissionContext::CancelPendingInfoBarRequest, |
| 468 render_process_id, render_view_id, bridge_id)); | 469 render_process_id, render_view_id, bridge_id)); |
| 469 return; | 470 return; |
| 470 } | 471 } |
| 471 DCHECK(ChromeThread::CurrentlyOn(ChromeThread::UI)); | 472 DCHECK(ChromeThread::CurrentlyOn(ChromeThread::UI)); |
| 472 geolocation_infobar_queue_controller_->CancelInfoBarRequest( | 473 geolocation_infobar_queue_controller_->CancelInfoBarRequest( |
| 473 render_process_id, render_view_id, bridge_id); | 474 render_process_id, render_view_id, bridge_id); |
| 474 } | 475 } |
| OLD | NEW |