diff options
author | evan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-06-03 15:49:18 +0000 |
---|---|---|
committer | evan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-06-03 15:49:18 +0000 |
commit | f6c2409a556406f5f0928df980e8234d12529664 (patch) | |
tree | 92c079c09f0ce2cf55751f89df90d1c57713cdd0 | |
parent | ae8f615e637f57c8a15dc00956320aff41fbbf9e (diff) | |
download | chromium_src-f6c2409a556406f5f0928df980e8234d12529664.zip chromium_src-f6c2409a556406f5f0928df980e8234d12529664.tar.gz chromium_src-f6c2409a556406f5f0928df980e8234d12529664.tar.bz2 |
Merge 85977 - linux: infobar for obsolete OS
Merge 85946 - Refactor the "Learn more" DNS infobar shown on startup
We will stop providing Chrome releases for Ubuntu Hardy-era distros.
We should at least inform those users about this.
(Retry of r85956, with views fix.)
BUG=79401
TEST=tried manually changing code to require a newer GTK, saw infobar
Review URL: http://codereview.chromium.org/7012024
Review URL: http://codereview.chromium.org/7088014
git-svn-id: svn://svn.chromium.org/chrome/branches/742/src@87786 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/app/generated_resources.grd | 7 | ||||
-rw-r--r-- | chrome/browser/ui/browser_init.cc | 106 | ||||
-rw-r--r-- | chrome/browser/ui/browser_init.h | 5 |
3 files changed, 86 insertions, 32 deletions
diff --git a/chrome/app/generated_resources.grd b/chrome/app/generated_resources.grd index 8be9436..f066165 100644 --- a/chrome/app/generated_resources.grd +++ b/chrome/app/generated_resources.grd @@ -4368,10 +4368,15 @@ Keep your key file in a safe place. You will need it to create new versions of y </message> <!-- Monoscope warning info bar --> - <message name="IDS_DNS_CERT_PROVENANCE_CHECKING_WARNING_MESSAGE" desc="Message shown when the user has DNS certificate provenance checking enabled. This message is followed by a 'Learn more' button."> + <message name="IDS_DNS_CERT_PROVENANCE_CHECKING_WARNING_MESSAGE" desc="Message shown when the user has DNS certificate provenance checking enabled. This message is followed by a 'Learn more' link."> You have DNS certificate provenance checking enabled. This may result in private information being sent to Google. </message> + <!-- Obsolete System info bar --> + <message name="IDS_SYSTEM_OBSOLETE_MESSAGE" desc="Message shown when your OS is no longer supported. This messages is followed by a 'Learn more' link."> + <ph name="PRODUCT_NAME">$1<ex>Google Chrome</ex></ph> is no longer updating because your operating system is obsolete. + </message> + <if expr="pp_ifdef('chromeos')"> <!-- Locale Change Notification--> <message name="IDS_LOCALE_CHANGE_MESSAGE" desc="Message shown when locale was changed based on profile content."> diff --git a/chrome/browser/ui/browser_init.cc b/chrome/browser/ui/browser_init.cc index 71cd400..920b830 100644 --- a/chrome/browser/ui/browser_init.cc +++ b/chrome/browser/ui/browser_init.cc @@ -41,7 +41,7 @@ #include "chrome/browser/sessions/session_restore.h" #include "chrome/browser/sessions/session_service.h" #include "chrome/browser/shell_integration.h" -#include "chrome/browser/tab_contents/confirm_infobar_delegate.h" +#include "chrome/browser/tab_contents/link_infobar_delegate.h" #include "chrome/browser/tab_contents/simple_alert_infobar_delegate.h" #include "chrome/browser/tabs/pinned_tab_codec.h" #include "chrome/browser/tabs/tab_strip_model.h" @@ -77,7 +77,7 @@ #include "chrome/browser/ui/cocoa/keystone_infobar.h" #endif -#if defined(TOOLKIT_GTK) +#if defined(TOOLKIT_USES_GTK) #include "chrome/browser/ui/gtk/gtk_util.h" #endif @@ -1036,6 +1036,7 @@ void BrowserInit::LaunchWithProfile::AddInfoBarsIfNecessary(Browser* browser) { AddCrashedInfoBarIfNecessary(tab_contents); AddBadFlagsInfoBarIfNecessary(tab_contents); AddDNSCertProvenanceCheckingWarningInfoBarIfNecessary(tab_contents); + AddObsoleteSystemInfoBarIfNecessary(tab_contents); } void BrowserInit::LaunchWithProfile::AddCrashedInfoBarIfNecessary( @@ -1082,50 +1083,93 @@ void BrowserInit::LaunchWithProfile::AddBadFlagsInfoBarIfNecessary( } } -class DNSCertProvenanceCheckingInfoBar : public ConfirmInfoBarDelegate { +class LearnMoreInfoBar : public LinkInfoBarDelegate { public: - explicit DNSCertProvenanceCheckingInfoBar(TabContents* tab_contents) - : ConfirmInfoBarDelegate(tab_contents), - tab_contents_(tab_contents) { - } + explicit LearnMoreInfoBar(TabContents* tab_contents, + const string16& message, + const GURL& url); + virtual ~LearnMoreInfoBar(); - virtual string16 GetMessageText() const { - return l10n_util::GetStringUTF16( - IDS_DNS_CERT_PROVENANCE_CHECKING_WARNING_MESSAGE); - } + virtual string16 GetMessageTextWithOffset(size_t* link_offset) const OVERRIDE; + virtual string16 GetLinkText() const OVERRIDE; + virtual bool LinkClicked(WindowOpenDisposition disposition) OVERRIDE; - virtual int GetButtons() const { - return BUTTON_OK; - } + private: + TabContents* const tab_contents_; + string16 message_; + GURL learn_more_url_; - virtual string16 GetButtonLabel(InfoBarButton button) const { - return l10n_util::GetStringUTF16(IDS_LEARN_MORE); - } + DISALLOW_COPY_AND_ASSIGN(LearnMoreInfoBar); +}; - virtual bool Accept() { - tab_contents_->OpenURL(GURL(kLearnMoreURL), GURL(), NEW_FOREGROUND_TAB, - PageTransition::AUTO_BOOKMARK); - return true; - } +LearnMoreInfoBar::LearnMoreInfoBar(TabContents* tab_contents, + const string16& message, + const GURL& url) + : LinkInfoBarDelegate(tab_contents), + tab_contents_(tab_contents), + message_(message), + learn_more_url_(url) { +} - private: - DISALLOW_COPY_AND_ASSIGN(DNSCertProvenanceCheckingInfoBar); +LearnMoreInfoBar::~LearnMoreInfoBar() { +} - static const char kLearnMoreURL[]; - TabContents* const tab_contents_; -}; +string16 LearnMoreInfoBar::GetMessageTextWithOffset(size_t* link_offset) const { + string16 text = message_; + text.push_back(' '); // Add a space before the following link. + *link_offset = text.size(); + return text; +} + +string16 LearnMoreInfoBar::GetLinkText() const { + return l10n_util::GetStringUTF16(IDS_LEARN_MORE); +} + +bool LearnMoreInfoBar::LinkClicked(WindowOpenDisposition disposition) { + tab_contents_->OpenURL(learn_more_url_, GURL(), disposition, + PageTransition::LINK); + return false; +} // This is the page which provides information on DNS certificate provenance // checking. -const char DNSCertProvenanceCheckingInfoBar::kLearnMoreURL[] = - "http://dev.chromium.org/dnscertprovenancechecking"; - void BrowserInit::LaunchWithProfile:: AddDNSCertProvenanceCheckingWarningInfoBarIfNecessary(TabContents* tab) { if (!command_line_.HasSwitch(switches::kEnableDNSCertProvenanceChecking)) return; - tab->AddInfoBar(new DNSCertProvenanceCheckingInfoBar(tab)); + const char* kLearnMoreURL = + "http://dev.chromium.org/dnscertprovenancechecking"; + string16 message = l10n_util::GetStringUTF16( + IDS_DNS_CERT_PROVENANCE_CHECKING_WARNING_MESSAGE); + tab->AddInfoBar(new LearnMoreInfoBar(tab, + message, + GURL(kLearnMoreURL))); +} + +void BrowserInit::LaunchWithProfile::AddObsoleteSystemInfoBarIfNecessary( + TabContents* tab) { +#if defined(TOOLKIT_USES_GTK) + // We've deprecated support for Ubuntu Hardy. Rather than attempting to + // determine whether you're using that, we instead key off the GTK version; + // this will also deprecate other distributions (including variants of Ubuntu) + // that are of a similar age. + // Version key: + // Ubuntu Hardy: GTK 2.12 + // RHEL 6: GTK 2.18 + // Ubuntu Lucid: GTK 2.20 + if (gtk_check_version(2, 18, 0)) { + string16 message = + l10n_util::GetStringFUTF16(IDS_SYSTEM_OBSOLETE_MESSAGE, + l10n_util::GetStringUTF16(IDS_PRODUCT_NAME)); + // Link to an article in the help center on minimum system requirements. + const char* kLearnMoreURL = + "http://www.google.com/support/chrome/bin/answer.py?answer=95411"; + tab->AddInfoBar(new LearnMoreInfoBar(tab, + message, + GURL(kLearnMoreURL))); + } +#endif } void BrowserInit::LaunchWithProfile::AddStartupURLs( diff --git a/chrome/browser/ui/browser_init.h b/chrome/browser/ui/browser_init.h index c00ab09..900ccd7 100644 --- a/chrome/browser/ui/browser_init.h +++ b/chrome/browser/ui/browser_init.h @@ -186,6 +186,11 @@ class BrowserInit { void AddDNSCertProvenanceCheckingWarningInfoBarIfNecessary( TabContents* tab); + // If the user is using an operating system that we have deprecated + // support for and will no longer provide updates, warn the user + // about it. + void AddObsoleteSystemInfoBarIfNecessary(TabContents* tab); + // Adds additional startup URLs to the specified vector. void AddStartupURLs(std::vector<GURL>* startup_urls) const; |