summaryrefslogtreecommitdiffstats
path: root/chrome/browser/geolocation
diff options
context:
space:
mode:
authorjoth@chromium.org <joth@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-18 13:48:02 +0000
committerjoth@chromium.org <joth@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-18 13:48:02 +0000
commitff667b93c29a81d1446ed9a220f8f762fbf6b7d4 (patch)
tree81c02afbf3c22890da5aa4256ad63441fe0c8eb1 /chrome/browser/geolocation
parent19d81be80dec350f85e6beb21845203179eb34f2 (diff)
downloadchromium_src-ff667b93c29a81d1446ed9a220f8f762fbf6b7d4.zip
chromium_src-ff667b93c29a81d1446ed9a220f8f762fbf6b7d4.tar.gz
chromium_src-ff667b93c29a81d1446ed9a220f8f762fbf6b7d4.tar.bz2
Finish implementing the geolocation infobar; adds a Learn more link pointing to the (placeholder) help center page.
This extends ConfirmInfoBar to support to have optional link support (simple support, i.e. not the inserted mid-label link that LinkInfoBar sports) Note 1: this does not exactly match the mock; the allow/deny buttons and link are swapped. I think this looks nicer, is more consistent with other confirm infobars, and happens to be easier to code Note 2: linux & mac will need follow-up CLs, but will simply ignore the link in the meantime BUG=11246 TEST=browser_tests.exe --gtest_filter=Geol* Review URL: http://codereview.chromium.org/1037006 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@41951 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/geolocation')
-rw-r--r--chrome/browser/geolocation/geolocation_permission_context.cc28
1 files changed, 22 insertions, 6 deletions
diff --git a/chrome/browser/geolocation/geolocation_permission_context.cc b/chrome/browser/geolocation/geolocation_permission_context.cc
index f9fa9e2..2ff2f12 100644
--- a/chrome/browser/geolocation/geolocation_permission_context.cc
+++ b/chrome/browser/geolocation/geolocation_permission_context.cc
@@ -21,6 +21,7 @@
#include "chrome/common/json_value_serializer.h"
#include "chrome/common/render_messages.h"
#include "grit/generated_resources.h"
+#include "grit/locale_settings.h"
#include "grit/theme_resources.h"
namespace {
@@ -37,17 +38,21 @@ class GeolocationConfirmInfoBarDelegate : public ConfirmInfoBarDelegate {
TabContents* tab_contents, GeolocationPermissionContext* context,
int render_process_id, int render_view_id, int bridge_id,
const std::string& host)
- : ConfirmInfoBarDelegate(tab_contents), context_(context),
- render_process_id_(render_process_id), render_view_id_(render_view_id),
- bridge_id_(bridge_id), host_(host) {
+ : ConfirmInfoBarDelegate(tab_contents),
+ tab_contents_(tab_contents),
+ context_(context),
+ render_process_id_(render_process_id),
+ render_view_id_(render_view_id),
+ bridge_id_(bridge_id),
+ host_(host) {
}
// ConfirmInfoBarDelegate
+ virtual void InfoBarClosed() { delete this; }
virtual Type GetInfoBarType() { return INFO_TYPE; }
virtual bool Accept() { return SetPermission(true); }
virtual bool Cancel() { return SetPermission(false); }
virtual int GetButtons() const { return BUTTON_OK | BUTTON_CANCEL; }
-
virtual std::wstring GetButtonLabel(InfoBarButton button) const {
switch (button) {
case BUTTON_OK:
@@ -60,16 +65,24 @@ class GeolocationConfirmInfoBarDelegate : public ConfirmInfoBarDelegate {
return L"";
}
}
-
virtual std::wstring GetMessageText() const {
return l10n_util::GetStringF(
IDS_GEOLOCATION_INFOBAR_QUESTION, UTF8ToWide(host_));
}
-
virtual SkBitmap* GetIcon() const {
return ResourceBundle::GetSharedInstance().GetBitmapNamed(
IDR_GEOLOCATION_INFOBAR_ICON);
}
+ virtual std::wstring GetLinkText() {
+ return l10n_util::GetString(IDS_LEARN_MORE);
+ }
+ virtual bool LinkClicked(WindowOpenDisposition disposition) {
+ // Ignore the click dispostion and always open in a new top level tab.
+ tab_contents_->OpenURL(
+ GURL(l10n_util::GetStringUTF8(IDS_LEARN_MORE_GEOLOCATION_URL)), GURL(),
+ NEW_FOREGROUND_TAB, PageTransition::LINK);
+ return false; // Do not dismiss the info bar.
+ }
private:
bool SetPermission(bool confirm) {
@@ -78,11 +91,14 @@ class GeolocationConfirmInfoBarDelegate : public ConfirmInfoBarDelegate {
return true;
}
+ TabContents* tab_contents_;
scoped_refptr<GeolocationPermissionContext> context_;
int render_process_id_;
int render_view_id_;
int bridge_id_;
std::string host_;
+
+ DISALLOW_IMPLICIT_CONSTRUCTORS(GeolocationConfirmInfoBarDelegate);
};
// TODO(bulach): use HostContentSettingsMap instead!