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_service.h"
8 #include "chrome/common/url_constants.h"
9 #include "chrome/grit/chromium_strings.h"
10 #include "components/infobars/core/infobar.h"
11 #include "content/public/browser/web_contents.h"
12 #include "grit/components_strings.h"
13 #include "ui/base/l10n/l10n_util.h"
15 #if defined(OS_MACOSX)
16 #include "chrome/browser/mac/obsolete_system.h"
20 void ObsoleteSystemInfoBarDelegate::Create(InfoBarService* infobar_service) {
21 #if defined(OS_MACOSX)
22 if (!ObsoleteSystemMac::Is32BitObsoleteNowOrSoon() ||
23 !ObsoleteSystemMac::Has32BitOnlyCPU()) {
26 infobar_service->AddInfoBar(ConfirmInfoBarDelegate::CreateInfoBar(
27 scoped_ptr<ConfirmInfoBarDelegate>(new ObsoleteSystemInfoBarDelegate())));
29 // No other platforms currently show this infobar.
34 ObsoleteSystemInfoBarDelegate::ObsoleteSystemInfoBarDelegate()
35 : ConfirmInfoBarDelegate() {
38 ObsoleteSystemInfoBarDelegate::~ObsoleteSystemInfoBarDelegate() {
41 base::string16 ObsoleteSystemInfoBarDelegate::GetMessageText() const {
42 #if defined(OS_MACOSX)
43 return ObsoleteSystemMac::LocalizedObsoleteSystemString();
45 return l10n_util::GetStringUTF16(IDS_SYSTEM_OBSOLETE_MESSAGE);
49 int ObsoleteSystemInfoBarDelegate::GetButtons() const {
53 base::string16 ObsoleteSystemInfoBarDelegate::GetLinkText() const {
54 return l10n_util::GetStringUTF16(IDS_LEARN_MORE);
57 bool ObsoleteSystemInfoBarDelegate::LinkClicked(
58 WindowOpenDisposition disposition) {
59 InfoBarService::WebContentsFromInfoBar(infobar())->OpenURL(
60 content::OpenURLParams(
61 #if defined(OS_MACOSX)
62 GURL(chrome::kMac32BitDeprecationURL),
64 GURL("http://www.google.com/support/chrome/bin/"
65 "answer.py?answer=95411"),
68 (disposition == CURRENT_TAB) ? NEW_FOREGROUND_TAB : disposition,
69 ui::PAGE_TRANSITION_LINK, false));