1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "chrome/browser/ui/startup/obsolete_system_infobar_delegate.h"
7 #include "chrome/browser/infobars/infobar.h"
8 #include "chrome/browser/infobars/infobar_service.h"
9 #include "chrome/common/url_constants.h"
10 #include "content/public/browser/web_contents.h"
11 #include "grit/chromium_strings.h"
12 #include "grit/generated_resources.h"
13 #include "ui/base/l10n/l10n_util.h"
15 #if defined(OS_MACOSX)
16 #include "chrome/browser/mac/obsolete_system.h"
19 #if defined(TOOLKIT_GTK)
24 void ObsoleteSystemInfoBarDelegate::Create(InfoBarService
* infobar_service
) {
25 #if defined(OS_MACOSX)
26 if (!ObsoleteSystemMac::Is32BitObsoleteNowOrSoon() ||
27 !ObsoleteSystemMac::Has32BitOnlyCPU()) {
30 #elif defined(TOOLKIT_GTK)
31 // We've deprecated support for Ubuntu Lucid. Rather than attempting to
32 // determine whether you're using that, we instead key off the GTK version;
33 // this will also deprecate other distributions (including variants of Ubuntu)
34 // that are of a similar age.
37 // Debian 6 (Squeeze): GTK 2.20
38 // Ubuntu Lucid: GTK 2.20
39 // openSUSE 12.2 GTK 2.24
40 // Ubuntu Precise: GTK 2.24
41 if (!gtk_check_version(2, 24, 0))
44 // No other platforms currently show this infobar.
48 infobar_service
->AddInfoBar(ConfirmInfoBarDelegate::CreateInfoBar(
49 scoped_ptr
<ConfirmInfoBarDelegate
>(new ObsoleteSystemInfoBarDelegate())));
52 ObsoleteSystemInfoBarDelegate::ObsoleteSystemInfoBarDelegate()
53 : ConfirmInfoBarDelegate() {
56 ObsoleteSystemInfoBarDelegate::~ObsoleteSystemInfoBarDelegate() {
59 base::string16
ObsoleteSystemInfoBarDelegate::GetMessageText() const {
60 #if defined(OS_MACOSX)
61 return ObsoleteSystemMac::LocalizedObsoleteSystemString();
63 return l10n_util::GetStringUTF16(IDS_SYSTEM_OBSOLETE_MESSAGE
);
67 int ObsoleteSystemInfoBarDelegate::GetButtons() const {
71 base::string16
ObsoleteSystemInfoBarDelegate::GetLinkText() const {
72 return l10n_util::GetStringUTF16(IDS_LEARN_MORE
);
75 bool ObsoleteSystemInfoBarDelegate::LinkClicked(
76 WindowOpenDisposition disposition
) {
77 web_contents()->OpenURL(content::OpenURLParams(
78 #if defined(OS_MACOSX)
79 GURL(chrome::kMac32BitDeprecationURL
),
81 GURL("http://www.google.com/support/chrome/bin/answer.py?answer=95411"),
84 (disposition
== CURRENT_TAB
) ? NEW_FOREGROUND_TAB
: disposition
,
85 content::PAGE_TRANSITION_LINK
, false));