Commit 279bb409 authored by pkasting@chromium.org's avatar pkasting@chromium.org

GeolocationConfirmInfoBarDelegate* -> GeolocationInfoBarDelegate*, for...

GeolocationConfirmInfoBarDelegate* -> GeolocationInfoBarDelegate*, for consistency with other infobars and brevity.

BUG=none
TEST=none
Review URL: https://codereview.chromium.org/11785030

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@194478 0039d316-1c4b-4281-b951-d872f2087c98
parent 2788083f
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#include "chrome/browser/geolocation/geolocation_confirm_infobar_delegate.h" #include "chrome/browser/geolocation/geolocation_infobar_delegate.h"
#include "chrome/browser/geolocation/geolocation_infobar_queue_controller.h" #include "chrome/browser/geolocation/geolocation_infobar_queue_controller.h"
#include "chrome/browser/google/google_util.h" #include "chrome/browser/google/google_util.h"
...@@ -18,15 +18,15 @@ ...@@ -18,15 +18,15 @@
#include "ui/base/resource/resource_bundle.h" #include "ui/base/resource/resource_bundle.h"
#if defined(OS_ANDROID) #if defined(OS_ANDROID)
#include "chrome/browser/geolocation/geolocation_confirm_infobar_delegate_android.h" #include "chrome/browser/geolocation/geolocation_infobar_delegate_android.h"
typedef GeolocationConfirmInfoBarDelegateAndroid DelegateType; typedef GeolocationInfoBarDelegateAndroid DelegateType;
#else #else
typedef GeolocationConfirmInfoBarDelegate DelegateType; typedef GeolocationInfoBarDelegate DelegateType;
#endif #endif
// static // static
InfoBarDelegate* GeolocationConfirmInfoBarDelegate::Create( InfoBarDelegate* GeolocationInfoBarDelegate::Create(
InfoBarService* infobar_service, InfoBarService* infobar_service,
GeolocationInfoBarQueueController* controller, GeolocationInfoBarQueueController* controller,
const GeolocationPermissionRequestID& id, const GeolocationPermissionRequestID& id,
...@@ -37,7 +37,7 @@ InfoBarDelegate* GeolocationConfirmInfoBarDelegate::Create( ...@@ -37,7 +37,7 @@ InfoBarDelegate* GeolocationConfirmInfoBarDelegate::Create(
display_languages))); display_languages)));
} }
GeolocationConfirmInfoBarDelegate::GeolocationConfirmInfoBarDelegate( GeolocationInfoBarDelegate::GeolocationInfoBarDelegate(
InfoBarService* infobar_service, InfoBarService* infobar_service,
GeolocationInfoBarQueueController* controller, GeolocationInfoBarQueueController* controller,
const GeolocationPermissionRequestID& id, const GeolocationPermissionRequestID& id,
...@@ -53,17 +53,16 @@ GeolocationConfirmInfoBarDelegate::GeolocationConfirmInfoBarDelegate( ...@@ -53,17 +53,16 @@ GeolocationConfirmInfoBarDelegate::GeolocationConfirmInfoBarDelegate(
contents_unique_id_ = committed_entry ? committed_entry->GetUniqueID() : 0; contents_unique_id_ = committed_entry ? committed_entry->GetUniqueID() : 0;
} }
gfx::Image* GeolocationConfirmInfoBarDelegate::GetIcon() const { gfx::Image* GeolocationInfoBarDelegate::GetIcon() const {
return &ResourceBundle::GetSharedInstance().GetNativeImageNamed( return &ResourceBundle::GetSharedInstance().GetNativeImageNamed(
IDR_GEOLOCATION_INFOBAR_ICON); IDR_GEOLOCATION_INFOBAR_ICON);
} }
InfoBarDelegate::Type InfoBarDelegate::Type GeolocationInfoBarDelegate::GetInfoBarType() const {
GeolocationConfirmInfoBarDelegate::GetInfoBarType() const {
return PAGE_ACTION_TYPE; return PAGE_ACTION_TYPE;
} }
bool GeolocationConfirmInfoBarDelegate::ShouldExpireInternal( bool GeolocationInfoBarDelegate::ShouldExpireInternal(
const content::LoadCommittedDetails& details) const { const content::LoadCommittedDetails& details) const {
// This implementation matches InfoBarDelegate::ShouldExpireInternal(), but // This implementation matches InfoBarDelegate::ShouldExpireInternal(), but
// uses the unique ID we set in the constructor instead of that stored in the // uses the unique ID we set in the constructor instead of that stored in the
...@@ -74,39 +73,39 @@ bool GeolocationConfirmInfoBarDelegate::ShouldExpireInternal( ...@@ -74,39 +73,39 @@ bool GeolocationConfirmInfoBarDelegate::ShouldExpireInternal(
content::PAGE_TRANSITION_RELOAD); content::PAGE_TRANSITION_RELOAD);
} }
string16 GeolocationConfirmInfoBarDelegate::GetMessageText() const { string16 GeolocationInfoBarDelegate::GetMessageText() const {
return l10n_util::GetStringFUTF16(IDS_GEOLOCATION_INFOBAR_QUESTION, return l10n_util::GetStringFUTF16(IDS_GEOLOCATION_INFOBAR_QUESTION,
net::FormatUrl(requesting_frame_.GetOrigin(), display_languages_)); net::FormatUrl(requesting_frame_.GetOrigin(), display_languages_));
} }
string16 GeolocationConfirmInfoBarDelegate::GetButtonLabel( string16 GeolocationInfoBarDelegate::GetButtonLabel(
InfoBarButton button) const { InfoBarButton button) const {
return l10n_util::GetStringUTF16((button == BUTTON_OK) ? return l10n_util::GetStringUTF16((button == BUTTON_OK) ?
IDS_GEOLOCATION_ALLOW_BUTTON : IDS_GEOLOCATION_DENY_BUTTON); IDS_GEOLOCATION_ALLOW_BUTTON : IDS_GEOLOCATION_DENY_BUTTON);
} }
void GeolocationConfirmInfoBarDelegate::SetPermission( void GeolocationInfoBarDelegate::SetPermission(bool update_content_setting,
bool update_content_setting, bool allowed) { bool allowed) {
controller_->OnPermissionSet(id_, requesting_frame_, controller_->OnPermissionSet(id_, requesting_frame_,
owner()->GetWebContents()->GetURL(), owner()->GetWebContents()->GetURL(),
update_content_setting, allowed); update_content_setting, allowed);
} }
bool GeolocationConfirmInfoBarDelegate::Accept() { bool GeolocationInfoBarDelegate::Accept() {
SetPermission(true, true); SetPermission(true, true);
return true; return true;
} }
bool GeolocationConfirmInfoBarDelegate::Cancel() { bool GeolocationInfoBarDelegate::Cancel() {
SetPermission(true, false); SetPermission(true, false);
return true; return true;
} }
string16 GeolocationConfirmInfoBarDelegate::GetLinkText() const { string16 GeolocationInfoBarDelegate::GetLinkText() const {
return l10n_util::GetStringUTF16(IDS_LEARN_MORE); return l10n_util::GetStringUTF16(IDS_LEARN_MORE);
} }
bool GeolocationConfirmInfoBarDelegate::LinkClicked( bool GeolocationInfoBarDelegate::LinkClicked(
WindowOpenDisposition disposition) { WindowOpenDisposition disposition) {
const char kGeolocationLearnMoreUrl[] = const char kGeolocationLearnMoreUrl[] =
#if defined(OS_CHROMEOS) #if defined(OS_CHROMEOS)
......
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#ifndef CHROME_BROWSER_GEOLOCATION_GEOLOCATION_CONFIRM_INFOBAR_DELEGATE_H_ #ifndef CHROME_BROWSER_GEOLOCATION_GEOLOCATION_INFOBAR_DELEGATE_H_
#define CHROME_BROWSER_GEOLOCATION_GEOLOCATION_CONFIRM_INFOBAR_DELEGATE_H_ #define CHROME_BROWSER_GEOLOCATION_GEOLOCATION_INFOBAR_DELEGATE_H_
#include "chrome/browser/geolocation/geolocation_permission_request_id.h" #include "chrome/browser/geolocation/geolocation_permission_request_id.h"
#include "chrome/browser/infobars/confirm_infobar_delegate.h" #include "chrome/browser/infobars/confirm_infobar_delegate.h"
...@@ -17,7 +17,7 @@ class InfoBarService; ...@@ -17,7 +17,7 @@ class InfoBarService;
// GeolocationInfoBarDelegates are created by the // GeolocationInfoBarDelegates are created by the
// GeolocationInfoBarQueueController to control the display // GeolocationInfoBarQueueController to control the display
// and handling of geolocation permission infobars to the user. // and handling of geolocation permission infobars to the user.
class GeolocationConfirmInfoBarDelegate : public ConfirmInfoBarDelegate { class GeolocationInfoBarDelegate : public ConfirmInfoBarDelegate {
public: public:
// Creates a geolocation delegate and adds it to |infobar_service|. Returns // Creates a geolocation delegate and adds it to |infobar_service|. Returns
// the delegate if it was successfully added. // the delegate if it was successfully added.
...@@ -28,12 +28,11 @@ class GeolocationConfirmInfoBarDelegate : public ConfirmInfoBarDelegate { ...@@ -28,12 +28,11 @@ class GeolocationConfirmInfoBarDelegate : public ConfirmInfoBarDelegate {
const std::string& display_languages); const std::string& display_languages);
protected: protected:
GeolocationConfirmInfoBarDelegate( GeolocationInfoBarDelegate(InfoBarService* infobar_service,
InfoBarService* infobar_service, GeolocationInfoBarQueueController* controller,
GeolocationInfoBarQueueController* controller, const GeolocationPermissionRequestID& id,
const GeolocationPermissionRequestID& id, const GURL& requesting_frame,
const GURL& requesting_frame, const std::string& display_languages);
const std::string& display_languages);
const GeolocationPermissionRequestID& id() const { return id_; } const GeolocationPermissionRequestID& id() const { return id_; }
...@@ -59,7 +58,7 @@ class GeolocationConfirmInfoBarDelegate : public ConfirmInfoBarDelegate { ...@@ -59,7 +58,7 @@ class GeolocationConfirmInfoBarDelegate : public ConfirmInfoBarDelegate {
int contents_unique_id_; int contents_unique_id_;
std::string display_languages_; std::string display_languages_;
DISALLOW_IMPLICIT_CONSTRUCTORS(GeolocationConfirmInfoBarDelegate); DISALLOW_IMPLICIT_CONSTRUCTORS(GeolocationInfoBarDelegate);
}; };
#endif // CHROME_BROWSER_GEOLOCATION_GEOLOCATION_CONFIRM_INFOBAR_DELEGATE_H_ #endif // CHROME_BROWSER_GEOLOCATION_GEOLOCATION_INFOBAR_DELEGATE_H_
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#include "chrome/browser/geolocation/geolocation_confirm_infobar_delegate_android.h" #include "chrome/browser/geolocation/geolocation_infobar_delegate_android.h"
#include "base/utf_string_conversions.h" #include "base/utf_string_conversions.h"
#include "chrome/browser/android/google_location_settings_helper.h" #include "chrome/browser/android/google_location_settings_helper.h"
...@@ -11,29 +11,26 @@ ...@@ -11,29 +11,26 @@
#include "grit/theme_resources.h" #include "grit/theme_resources.h"
#include "ui/base/l10n/l10n_util.h" #include "ui/base/l10n/l10n_util.h"
GeolocationConfirmInfoBarDelegateAndroid:: GeolocationInfoBarDelegateAndroid::GeolocationInfoBarDelegateAndroid(
GeolocationConfirmInfoBarDelegateAndroid(
InfoBarService* infobar_service, InfoBarService* infobar_service,
GeolocationInfoBarQueueController* controller, GeolocationInfoBarQueueController* controller,
const GeolocationPermissionRequestID& id, const GeolocationPermissionRequestID& id,
const GURL& requesting_frame_url, const GURL& requesting_frame_url,
const std::string& display_languages) const std::string& display_languages)
: GeolocationConfirmInfoBarDelegate(infobar_service, controller, id, : GeolocationInfoBarDelegate(infobar_service, controller, id,
requesting_frame_url, requesting_frame_url, display_languages),
display_languages),
google_location_settings_helper_( google_location_settings_helper_(
GoogleLocationSettingsHelper::Create()) { GoogleLocationSettingsHelper::Create()) {
} }
GeolocationConfirmInfoBarDelegateAndroid:: GeolocationInfoBarDelegateAndroid::~GeolocationInfoBarDelegateAndroid() {
~GeolocationConfirmInfoBarDelegateAndroid() {
} }
bool GeolocationConfirmInfoBarDelegateAndroid::Accept() { bool GeolocationInfoBarDelegateAndroid::Accept() {
// Accept button text could be either 'Allow' or 'Google Location Settings'. // Accept button text could be either 'Allow' or 'Google Location Settings'.
// If 'Allow' we follow the regular flow. // If 'Allow' we follow the regular flow.
if (google_location_settings_helper_->IsGoogleAppsLocationSettingEnabled()) if (google_location_settings_helper_->IsGoogleAppsLocationSettingEnabled())
return GeolocationConfirmInfoBarDelegate::Accept(); return GeolocationInfoBarDelegate::Accept();
// If 'Google Location Settings', we need to open the system Google Location // If 'Google Location Settings', we need to open the system Google Location
// Settings activity. // Settings activity.
...@@ -42,7 +39,7 @@ bool GeolocationConfirmInfoBarDelegateAndroid::Accept() { ...@@ -42,7 +39,7 @@ bool GeolocationConfirmInfoBarDelegateAndroid::Accept() {
return true; return true;
} }
string16 GeolocationConfirmInfoBarDelegateAndroid::GetButtonLabel( string16 GeolocationInfoBarDelegateAndroid::GetButtonLabel(
InfoBarButton button) const { InfoBarButton button) const {
if (button == BUTTON_OK) { if (button == BUTTON_OK) {
return UTF8ToUTF16( return UTF8ToUTF16(
......
...@@ -2,24 +2,23 @@ ...@@ -2,24 +2,23 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#ifndef CHROME_BROWSER_GEOLOCATION_GEOLOCATION_CONFIRM_INFOBAR_DELEGATE_ANDROID_H_ #ifndef CHROME_BROWSER_GEOLOCATION_GEOLOCATION_INFOBAR_DELEGATE_ANDROID_H_
#define CHROME_BROWSER_GEOLOCATION_GEOLOCATION_CONFIRM_INFOBAR_DELEGATE_ANDROID_H_ #define CHROME_BROWSER_GEOLOCATION_GEOLOCATION_INFOBAR_DELEGATE_ANDROID_H_
#include "base/memory/scoped_ptr.h" #include "base/memory/scoped_ptr.h"
#include "chrome/browser/geolocation/geolocation_confirm_infobar_delegate.h" #include "chrome/browser/geolocation/geolocation_infobar_delegate.h"
class GoogleLocationSettingsHelper; class GoogleLocationSettingsHelper;
class GeolocationConfirmInfoBarDelegateAndroid class GeolocationInfoBarDelegateAndroid: public GeolocationInfoBarDelegate {
: public GeolocationConfirmInfoBarDelegate {
public: public:
GeolocationConfirmInfoBarDelegateAndroid( GeolocationInfoBarDelegateAndroid(
InfoBarService* infobar_service, InfoBarService* infobar_service,
GeolocationInfoBarQueueController* controller, GeolocationInfoBarQueueController* controller,
const GeolocationPermissionRequestID& id, const GeolocationPermissionRequestID& id,
const GURL& requesting_frame_url, const GURL& requesting_frame_url,
const std::string& display_languages); const std::string& display_languages);
virtual ~GeolocationConfirmInfoBarDelegateAndroid(); virtual ~GeolocationInfoBarDelegateAndroid();
private: private:
// ConfirmInfoBarDelegate: // ConfirmInfoBarDelegate:
...@@ -30,4 +29,4 @@ class GeolocationConfirmInfoBarDelegateAndroid ...@@ -30,4 +29,4 @@ class GeolocationConfirmInfoBarDelegateAndroid
}; };
#endif // CHROME_BROWSER_GEOLOCATION_GEOLOCATION_CONFIRM_INFOBAR_DELEGATE_ANDROID_H_ #endif // CHROME_BROWSER_GEOLOCATION_GEOLOCATION_INFOBAR_DELEGATE_ANDROID_H_
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
#include "base/prefs/pref_service.h" #include "base/prefs/pref_service.h"
#include "chrome/browser/content_settings/host_content_settings_map.h" #include "chrome/browser/content_settings/host_content_settings_map.h"
#include "chrome/browser/geolocation/geolocation_confirm_infobar_delegate.h" #include "chrome/browser/geolocation/geolocation_infobar_delegate.h"
#include "chrome/browser/infobars/infobar.h" #include "chrome/browser/infobars/infobar.h"
#include "chrome/browser/infobars/infobar_service.h" #include "chrome/browser/infobars/infobar_service.h"
#include "chrome/browser/profiles/profile.h" #include "chrome/browser/profiles/profile.h"
...@@ -96,7 +96,7 @@ void GeolocationInfoBarQueueController::PendingInfoBarRequest::RunCallback( ...@@ -96,7 +96,7 @@ void GeolocationInfoBarQueueController::PendingInfoBarRequest::RunCallback(
void GeolocationInfoBarQueueController::PendingInfoBarRequest:: void GeolocationInfoBarQueueController::PendingInfoBarRequest::
CreateInfoBarDelegate(GeolocationInfoBarQueueController* controller, CreateInfoBarDelegate(GeolocationInfoBarQueueController* controller,
const std::string& display_languages) { const std::string& display_languages) {
infobar_delegate_ = GeolocationConfirmInfoBarDelegate::Create( infobar_delegate_ = GeolocationInfoBarDelegate::Create(
GetInfoBarService(id_), controller, id_, requesting_frame_, GetInfoBarService(id_), controller, id_, requesting_frame_,
display_languages); display_languages);
...@@ -216,8 +216,7 @@ void GeolocationInfoBarQueueController::Observe( ...@@ -216,8 +216,7 @@ void GeolocationInfoBarQueueController::Observe(
content::Details<InfoBarRemovedDetails>(details)->first; content::Details<InfoBarRemovedDetails>(details)->first;
for (PendingInfoBarRequests::iterator i = pending_infobar_requests_.begin(); for (PendingInfoBarRequests::iterator i = pending_infobar_requests_.begin();
i != pending_infobar_requests_.end(); ++i) { i != pending_infobar_requests_.end(); ++i) {
InfoBarDelegate* confirm_delegate = i->infobar_delegate(); if (i->infobar_delegate() == delegate) {
if (confirm_delegate == delegate) {
GeolocationPermissionRequestID id(i->id()); GeolocationPermissionRequestID id(i->id());
pending_infobar_requests_.erase(i); pending_infobar_requests_.erase(i);
ShowQueuedInfoBarForTab(id); ShowQueuedInfoBarForTab(id);
......
...@@ -10,7 +10,6 @@ ...@@ -10,7 +10,6 @@
#include "content/public/browser/notification_registrar.h" #include "content/public/browser/notification_registrar.h"
class GURL; class GURL;
class GeolocationConfirmInfoBarDelegate;
class GeolocationPermissionRequestID; class GeolocationPermissionRequestID;
class InfoBarService; class InfoBarService;
class Profile; class Profile;
......
...@@ -542,10 +542,10 @@ ...@@ -542,10 +542,10 @@
'browser/geolocation/chrome_geolocation_permission_context_android.h', 'browser/geolocation/chrome_geolocation_permission_context_android.h',
'browser/geolocation/chrome_geolocation_permission_context_factory.cc', 'browser/geolocation/chrome_geolocation_permission_context_factory.cc',
'browser/geolocation/chrome_geolocation_permission_context_factory.h', 'browser/geolocation/chrome_geolocation_permission_context_factory.h',
'browser/geolocation/geolocation_confirm_infobar_delegate.cc', 'browser/geolocation/geolocation_infobar_delegate.cc',
'browser/geolocation/geolocation_confirm_infobar_delegate.h', 'browser/geolocation/geolocation_infobar_delegate.h',
'browser/geolocation/geolocation_confirm_infobar_delegate_android.cc', 'browser/geolocation/geolocation_infobar_delegate_android.cc',
'browser/geolocation/geolocation_confirm_infobar_delegate_android.h', 'browser/geolocation/geolocation_infobar_delegate_android.h',
'browser/geolocation/geolocation_infobar_queue_controller.cc', 'browser/geolocation/geolocation_infobar_queue_controller.cc',
'browser/geolocation/geolocation_infobar_queue_controller.h', 'browser/geolocation/geolocation_infobar_queue_controller.h',
'browser/geolocation/geolocation_permission_request_id.cc', 'browser/geolocation/geolocation_permission_request_id.cc',
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment