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