Commit edbe8a4d authored by pkasting@chromium.org's avatar pkasting@chromium.org

Improve the usability of the "TLD changed" infobar by changing the strings:

OLD:
It looks like you've moved.  Would you like to use http://www.google.de/?  [Yes] [No]

NEW:
Would you like to search with google.de instead of google.fr? [Switch to google.de] [Keep using google.fr] _Learn more_

BUG=85671
TEST=none
Review URL: http://codereview.chromium.org/7578015

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@95885 0039d316-1c4b-4281-b951-d872f2087c98
parent 84e4f021
...@@ -4519,9 +4519,6 @@ Keep your key file in a safe place. You will need it to create new versions of y ...@@ -4519,9 +4519,6 @@ Keep your key file in a safe place. You will need it to create new versions of y
<message name="IDS_CONFLICTS_EXPLANATION_TEXT" desc="The text blurb explaining what the compatibility page is."> <message name="IDS_CONFLICTS_EXPLANATION_TEXT" desc="The text blurb explaining what the compatibility page is.">
This page lists all modules loaded into the main process and modules registered to load at a later point. This page lists all modules loaded into the main process and modules registered to load at a later point.
</message> </message>
<message name="IDS_CONFLICTS_HELP_CENTER_LINK" desc="The text for the Help Center link.">
Learn more
</message>
<message name="IDS_CONFLICTS_CHECK_INVESTIGATING" desc="A label on the compatibility page saying we are investigating."> <message name="IDS_CONFLICTS_CHECK_INVESTIGATING" desc="A label on the compatibility page saying we are investigating.">
We are currently investigating this issue. We are currently investigating this issue.
</message> </message>
...@@ -13087,8 +13084,14 @@ Keep your key file in a safe place. You will need it to create new versions of y ...@@ -13087,8 +13084,14 @@ Keep your key file in a safe place. You will need it to create new versions of y
</if> </if>
<!-- GoogleURL tracker info bar --> <!-- GoogleURL tracker info bar -->
<message name="IDS_GOOGLE_URL_TRACKER_INFOBAR_MESSAGE" desc="Message displayed when the user's current Google TLD doesn't match the default for their location."> <message name="IDS_GOOGLE_URL_TRACKER_INFOBAR_MESSAGE" desc="Message displayed when the user's current Google TLD doesn't match the default for their location. This can be shortened in other languages (e.g. by removing 'would you like to') as needed to keep the translated strings from being much longer than English, so the infobar can still display all three IDS_GOOGLE_URL_TRACKER_ strings and a 'Learn more' link.">
It looks like you've moved. Would you like to use <ph name="NEW_GOOGLE_URL">$1<ex>google.com</ex></ph>? Would you like to search with <ph name="NEW_GOOGLE_HOST">$1<ex>google.de</ex></ph> instead of <ph name="CURRENT_GOOGLE_HOST">$2<ex>google.fr</ex></ph>?
</message>
<message name="IDS_GOOGLE_URL_TRACKER_INFOBAR_SWITCH" desc="Button text for button that changes user's default Google TLD to a new TLD.">
Switch to <ph name="NEW_GOOGLE_HOST">$1<ex>google.de</ex></ph>
</message>
<message name="IDS_GOOGLE_URL_TRACKER_INFOBAR_DONT_SWITCH" desc="Button text for button that leaves user's default Google TLD unchanged.">
Keep using <ph name="CURRENT_GOOGLE_HOST">$1<ex>google.fr</ex></ph>
</message> </message>
<message name="IDS_SPEECH_INPUT_BUBBLE_HEADING" desc="First line in the content area of the speech input bubble. Instructs the user that they can start speaking."> <message name="IDS_SPEECH_INPUT_BUBBLE_HEADING" desc="First line in the content area of the speech input bubble. Instructs the user that they can start speaking.">
......
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
#include "base/string_util.h" #include "base/string_util.h"
#include "base/utf_string_conversions.h" #include "base/utf_string_conversions.h"
#include "chrome/browser/browser_process.h" #include "chrome/browser/browser_process.h"
#include "chrome/browser/google/google_util.h"
#include "chrome/browser/prefs/pref_service.h" #include "chrome/browser/prefs/pref_service.h"
#include "chrome/browser/search_engines/template_url.h" #include "chrome/browser/search_engines/template_url.h"
#include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
...@@ -21,6 +22,7 @@ ...@@ -21,6 +22,7 @@
#include "content/common/notification_service.h" #include "content/common/notification_service.h"
#include "grit/generated_resources.h" #include "grit/generated_resources.h"
#include "net/base/load_flags.h" #include "net/base/load_flags.h"
#include "net/base/net_util.h"
#include "net/url_request/url_request_context_getter.h" #include "net/url_request/url_request_context_getter.h"
#include "net/url_request/url_request_status.h" #include "net/url_request/url_request_status.h"
#include "ui/base/l10n/l10n_util.h" #include "ui/base/l10n/l10n_util.h"
...@@ -48,7 +50,8 @@ GoogleURLTrackerInfoBarDelegate::GoogleURLTrackerInfoBarDelegate( ...@@ -48,7 +50,8 @@ GoogleURLTrackerInfoBarDelegate::GoogleURLTrackerInfoBarDelegate(
const GURL& new_google_url) const GURL& new_google_url)
: ConfirmInfoBarDelegate(tab_contents), : ConfirmInfoBarDelegate(tab_contents),
google_url_tracker_(google_url_tracker), google_url_tracker_(google_url_tracker),
new_google_url_(new_google_url) { new_google_url_(new_google_url),
tab_contents_(tab_contents) {
} }
bool GoogleURLTrackerInfoBarDelegate::Accept() { bool GoogleURLTrackerInfoBarDelegate::Accept() {
...@@ -62,21 +65,39 @@ bool GoogleURLTrackerInfoBarDelegate::Cancel() { ...@@ -62,21 +65,39 @@ bool GoogleURLTrackerInfoBarDelegate::Cancel() {
return true; return true;
} }
string16 GoogleURLTrackerInfoBarDelegate::GetLinkText() const {
return l10n_util::GetStringUTF16(IDS_LEARN_MORE);
}
bool GoogleURLTrackerInfoBarDelegate::LinkClicked(
WindowOpenDisposition disposition) {
tab_contents_->OpenURL(google_util::AppendGoogleLocaleParam(GURL(
"https://www.google.com/support/chrome/bin/answer.py?answer=1618699")),
GURL(), (disposition == CURRENT_TAB) ? NEW_FOREGROUND_TAB : disposition,
PageTransition::LINK);
return false;
}
GoogleURLTrackerInfoBarDelegate::~GoogleURLTrackerInfoBarDelegate() { GoogleURLTrackerInfoBarDelegate::~GoogleURLTrackerInfoBarDelegate() {
google_url_tracker_->InfoBarClosed(); google_url_tracker_->InfoBarClosed();
} }
string16 GoogleURLTrackerInfoBarDelegate::GetMessageText() const { string16 GoogleURLTrackerInfoBarDelegate::GetMessageText() const {
// TODO(ukai): change new_google_url to google_base_domain?
return l10n_util::GetStringFUTF16(IDS_GOOGLE_URL_TRACKER_INFOBAR_MESSAGE, return l10n_util::GetStringFUTF16(IDS_GOOGLE_URL_TRACKER_INFOBAR_MESSAGE,
UTF8ToUTF16(new_google_url_.spec())); GetHost(true), GetHost(false));
} }
string16 GoogleURLTrackerInfoBarDelegate::GetButtonLabel( string16 GoogleURLTrackerInfoBarDelegate::GetButtonLabel(
InfoBarButton button) const { InfoBarButton button) const {
return l10n_util::GetStringUTF16((button == BUTTON_OK) ? bool new_host = (button == BUTTON_OK);
IDS_CONFIRM_MESSAGEBOX_YES_BUTTON_LABEL : return l10n_util::GetStringFUTF16(new_host ?
IDS_CONFIRM_MESSAGEBOX_NO_BUTTON_LABEL); IDS_GOOGLE_URL_TRACKER_INFOBAR_SWITCH :
IDS_GOOGLE_URL_TRACKER_INFOBAR_DONT_SWITCH, GetHost(new_host));
}
string16 GoogleURLTrackerInfoBarDelegate::GetHost(bool new_host) const {
return net::StripWWW(UTF8ToUTF16(
(new_host ? new_google_url_ : google_url_tracker_->GoogleURL()).host()));
} }
......
...@@ -170,6 +170,8 @@ class GoogleURLTrackerInfoBarDelegate : public ConfirmInfoBarDelegate { ...@@ -170,6 +170,8 @@ class GoogleURLTrackerInfoBarDelegate : public ConfirmInfoBarDelegate {
// ConfirmInfoBarDelegate: // ConfirmInfoBarDelegate:
virtual bool Accept() OVERRIDE; virtual bool Accept() OVERRIDE;
virtual bool Cancel() OVERRIDE; virtual bool Cancel() OVERRIDE;
virtual string16 GetLinkText() const OVERRIDE;
virtual bool LinkClicked(WindowOpenDisposition disposition) OVERRIDE;
protected: protected:
virtual ~GoogleURLTrackerInfoBarDelegate(); virtual ~GoogleURLTrackerInfoBarDelegate();
...@@ -182,6 +184,11 @@ class GoogleURLTrackerInfoBarDelegate : public ConfirmInfoBarDelegate { ...@@ -182,6 +184,11 @@ class GoogleURLTrackerInfoBarDelegate : public ConfirmInfoBarDelegate {
virtual string16 GetMessageText() const OVERRIDE; virtual string16 GetMessageText() const OVERRIDE;
virtual string16 GetButtonLabel(InfoBarButton button) const OVERRIDE; virtual string16 GetButtonLabel(InfoBarButton button) const OVERRIDE;
// Returns the portion of the appropriate hostname to display.
string16 GetHost(bool new_host) const;
TabContents* tab_contents_;
DISALLOW_COPY_AND_ASSIGN(GoogleURLTrackerInfoBarDelegate); DISALLOW_COPY_AND_ASSIGN(GoogleURLTrackerInfoBarDelegate);
}; };
......
...@@ -45,7 +45,7 @@ ChromeWebUIDataSource* CreateConflictsUIHTMLSource() { ...@@ -45,7 +45,7 @@ ChromeWebUIDataSource* CreateConflictsUIHTMLSource() {
IDS_CONFLICTS_CHECK_WARNING_SUSPECTED); IDS_CONFLICTS_CHECK_WARNING_SUSPECTED);
source->AddLocalizedString("moduleConfirmedBad", source->AddLocalizedString("moduleConfirmedBad",
IDS_CONFLICTS_CHECK_WARNING_CONFIRMED); IDS_CONFLICTS_CHECK_WARNING_CONFIRMED);
source->AddLocalizedString("helpCenterLink", IDS_CONFLICTS_HELP_CENTER_LINK); source->AddLocalizedString("helpCenterLink", IDS_LEARN_MORE);
source->AddLocalizedString("investigatingText", source->AddLocalizedString("investigatingText",
IDS_CONFLICTS_CHECK_INVESTIGATING); IDS_CONFLICTS_CHECK_INVESTIGATING);
source->AddLocalizedString("modulesNoneLoaded", source->AddLocalizedString("modulesNoneLoaded",
......
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