OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 const std::string& display_languages); | 128 const std::string& display_languages); |
129 | 129 |
130 private: | 130 private: |
131 virtual ~GeolocationConfirmInfoBarDelegate(); | 131 virtual ~GeolocationConfirmInfoBarDelegate(); |
132 | 132 |
133 // ConfirmInfoBarDelegate: | 133 // ConfirmInfoBarDelegate: |
134 virtual void InfoBarClosed(); | 134 virtual void InfoBarClosed(); |
135 virtual SkBitmap* GetIcon() const; | 135 virtual SkBitmap* GetIcon() const; |
136 virtual Type GetInfoBarType() const; | 136 virtual Type GetInfoBarType() const; |
137 virtual string16 GetMessageText() const; | 137 virtual string16 GetMessageText() const; |
138 virtual int GetButtons() const; | |
139 virtual string16 GetButtonLabel(InfoBarButton button) const; | 138 virtual string16 GetButtonLabel(InfoBarButton button) const; |
140 virtual bool Accept(); | 139 virtual bool Accept(); |
141 virtual bool Cancel(); | 140 virtual bool Cancel(); |
142 virtual string16 GetLinkText(); | 141 virtual string16 GetLinkText(); |
143 virtual bool LinkClicked(WindowOpenDisposition disposition); | 142 virtual bool LinkClicked(WindowOpenDisposition disposition); |
144 | 143 |
145 TabContents* tab_contents_; | 144 TabContents* tab_contents_; |
146 GeolocationInfoBarQueueController* controller_; | 145 GeolocationInfoBarQueueController* controller_; |
147 int render_process_id_; | 146 int render_process_id_; |
148 int render_view_id_; | 147 int render_view_id_; |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
188 InfoBarDelegate::Type | 187 InfoBarDelegate::Type |
189 GeolocationConfirmInfoBarDelegate::GetInfoBarType() const { | 188 GeolocationConfirmInfoBarDelegate::GetInfoBarType() const { |
190 return PAGE_ACTION_TYPE; | 189 return PAGE_ACTION_TYPE; |
191 } | 190 } |
192 | 191 |
193 string16 GeolocationConfirmInfoBarDelegate::GetMessageText() const { | 192 string16 GeolocationConfirmInfoBarDelegate::GetMessageText() const { |
194 return l10n_util::GetStringFUTF16(IDS_GEOLOCATION_INFOBAR_QUESTION, | 193 return l10n_util::GetStringFUTF16(IDS_GEOLOCATION_INFOBAR_QUESTION, |
195 net::FormatUrl(requesting_frame_url_.GetOrigin(), display_languages_)); | 194 net::FormatUrl(requesting_frame_url_.GetOrigin(), display_languages_)); |
196 } | 195 } |
197 | 196 |
198 int GeolocationConfirmInfoBarDelegate::GetButtons() const { | |
199 return BUTTON_OK | BUTTON_CANCEL; | |
200 } | |
201 | |
202 string16 GeolocationConfirmInfoBarDelegate::GetButtonLabel( | 197 string16 GeolocationConfirmInfoBarDelegate::GetButtonLabel( |
203 InfoBarButton button) const { | 198 InfoBarButton button) const { |
204 return l10n_util::GetStringUTF16((button == BUTTON_OK) ? | 199 return l10n_util::GetStringUTF16((button == BUTTON_OK) ? |
205 IDS_GEOLOCATION_ALLOW_BUTTON : IDS_GEOLOCATION_DENY_BUTTON); | 200 IDS_GEOLOCATION_ALLOW_BUTTON : IDS_GEOLOCATION_DENY_BUTTON); |
206 } | 201 } |
207 | 202 |
208 bool GeolocationConfirmInfoBarDelegate::Accept() { | 203 bool GeolocationConfirmInfoBarDelegate::Accept() { |
209 controller_->OnPermissionSet(render_process_id_, render_view_id_, bridge_id_, | 204 controller_->OnPermissionSet(render_process_id_, render_view_id_, bridge_id_, |
210 requesting_frame_url_, tab_contents_->GetURL(), true); | 205 requesting_frame_url_, tab_contents_->GetURL(), true); |
211 return true; | 206 return true; |
(...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
561 if (!BrowserThread::CurrentlyOn(BrowserThread::UI)) { | 556 if (!BrowserThread::CurrentlyOn(BrowserThread::UI)) { |
562 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, NewRunnableMethod( | 557 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, NewRunnableMethod( |
563 this, &GeolocationPermissionContext::CancelPendingInfoBarRequest, | 558 this, &GeolocationPermissionContext::CancelPendingInfoBarRequest, |
564 render_process_id, render_view_id, bridge_id)); | 559 render_process_id, render_view_id, bridge_id)); |
565 return; | 560 return; |
566 } | 561 } |
567 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 562 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
568 geolocation_infobar_queue_controller_->CancelInfoBarRequest(render_process_id, | 563 geolocation_infobar_queue_controller_->CancelInfoBarRequest(render_process_id, |
569 render_view_id, bridge_id); | 564 render_view_id, bridge_id); |
570 } | 565 } |
OLD | NEW |