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_os_infobar_delegate.h"
7 #include "chrome/browser/infobars/infobar_service.h"
8 #include "content/public/browser/web_contents.h"
9 #include "grit/chromium_strings.h"
10 #include "grit/generated_resources.h"
11 #include "ui/base/l10n/l10n_util.h"
13 #if defined(TOOLKIT_GTK)
19 void ObsoleteOSInfoBarDelegate::Create(InfoBarService
* infobar_service
) {
20 #if defined(TOOLKIT_GTK)
21 // We've deprecated support for Ubuntu Lucid. Rather than attempting to
22 // determine whether you're using that, we instead key off the GTK version;
23 // this will also deprecate other distributions (including variants of Ubuntu)
24 // that are of a similar age.
27 // Debian 6 (Squeeze): GTK 2.20
28 // Ubuntu Lucid: GTK 2.20
29 // openSUSE 12.2 GTK 2.24
30 // Ubuntu Precise: GTK 2.24
31 if (!gtk_check_version(2, 24, 0))
34 // No other platforms currently show this infobar.
38 infobar_service
->AddInfoBar(scoped_ptr
<InfoBarDelegate
>(
39 new ObsoleteOSInfoBarDelegate(infobar_service
)));
42 ObsoleteOSInfoBarDelegate::ObsoleteOSInfoBarDelegate(
43 InfoBarService
* infobar_service
)
44 : ConfirmInfoBarDelegate(infobar_service
) {
47 ObsoleteOSInfoBarDelegate::~ObsoleteOSInfoBarDelegate() {
50 string16
ObsoleteOSInfoBarDelegate::GetMessageText() const {
51 return l10n_util::GetStringUTF16(IDS_SYSTEM_OBSOLETE_MESSAGE
);
54 int ObsoleteOSInfoBarDelegate::GetButtons() const {
58 string16
ObsoleteOSInfoBarDelegate::GetLinkText() const {
59 return l10n_util::GetStringUTF16(IDS_LEARN_MORE
);
62 bool ObsoleteOSInfoBarDelegate::LinkClicked(WindowOpenDisposition disposition
) {
63 web_contents()->OpenURL(content::OpenURLParams(
64 GURL("http://www.google.com/support/chrome/bin/answer.py?answer=95411"),
66 (disposition
== CURRENT_TAB
) ? NEW_FOREGROUND_TAB
: disposition
,
67 content::PAGE_TRANSITION_LINK
, false));