Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(38)

Unified Diff: chrome/browser/geolocation/geolocation_permission_context.cc

Issue 1037006: Finish implementing the geolocation infobar; adds a Learn more link pointing ... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/app/resources/locale_settings.grd ('k') | chrome/browser/tab_contents/infobar_delegate.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/geolocation/geolocation_permission_context.cc
===================================================================
--- chrome/browser/geolocation/geolocation_permission_context.cc (revision 41849)
+++ chrome/browser/geolocation/geolocation_permission_context.cc (working copy)
@@ -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 @@
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 @@
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 @@
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!
« no previous file with comments | « chrome/app/resources/locale_settings.grd ('k') | chrome/browser/tab_contents/infobar_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698