OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/ui/startup/obsolete_os_infobar_delegate.h" | 5 #include "chrome/browser/ui/startup/obsolete_system_infobar_delegate.h" |
6 | 6 |
7 #include "chrome/browser/infobars/infobar.h" | 7 #include "chrome/browser/infobars/infobar.h" |
8 #include "chrome/browser/infobars/infobar_service.h" | 8 #include "chrome/browser/infobars/infobar_service.h" |
| 9 #include "chrome/common/url_constants.h" |
9 #include "content/public/browser/web_contents.h" | 10 #include "content/public/browser/web_contents.h" |
10 #include "grit/chromium_strings.h" | 11 #include "grit/chromium_strings.h" |
11 #include "grit/generated_resources.h" | 12 #include "grit/generated_resources.h" |
12 #include "ui/base/l10n/l10n_util.h" | 13 #include "ui/base/l10n/l10n_util.h" |
13 | 14 |
| 15 #if defined(OS_MACOSX) |
| 16 #include "chrome/browser/mac/system_bitness.h" |
| 17 #endif |
| 18 |
14 #if defined(TOOLKIT_GTK) | 19 #if defined(TOOLKIT_GTK) |
15 #include <gtk/gtk.h> | 20 #include <gtk/gtk.h> |
16 #endif | 21 #endif |
17 | 22 |
18 | |
19 // static | 23 // static |
20 void ObsoleteOSInfoBarDelegate::Create(InfoBarService* infobar_service) { | 24 void ObsoleteSystemInfoBarDelegate::Create(InfoBarService* infobar_service) { |
21 #if defined(TOOLKIT_GTK) | 25 #if defined(OS_MACOSX) |
| 26 if (!chrome::Is32BitObsoleteNowOrSoon() || !chrome::Has32BitOnlyCPU()) { |
| 27 return; |
| 28 } |
| 29 #elif defined(TOOLKIT_GTK) |
22 // We've deprecated support for Ubuntu Lucid. Rather than attempting to | 30 // We've deprecated support for Ubuntu Lucid. Rather than attempting to |
23 // determine whether you're using that, we instead key off the GTK version; | 31 // determine whether you're using that, we instead key off the GTK version; |
24 // this will also deprecate other distributions (including variants of Ubuntu) | 32 // this will also deprecate other distributions (including variants of Ubuntu) |
25 // that are of a similar age. | 33 // that are of a similar age. |
26 // Version key: | 34 // Version key: |
27 // RHEL 6: GTK 2.18 | 35 // RHEL 6: GTK 2.18 |
28 // Debian 6 (Squeeze): GTK 2.20 | 36 // Debian 6 (Squeeze): GTK 2.20 |
29 // Ubuntu Lucid: GTK 2.20 | 37 // Ubuntu Lucid: GTK 2.20 |
30 // openSUSE 12.2 GTK 2.24 | 38 // openSUSE 12.2 GTK 2.24 |
31 // Ubuntu Precise: GTK 2.24 | 39 // Ubuntu Precise: GTK 2.24 |
32 if (!gtk_check_version(2, 24, 0)) | 40 if (!gtk_check_version(2, 24, 0)) |
33 return; | 41 return; |
34 #else | 42 #else |
35 // No other platforms currently show this infobar. | 43 // No other platforms currently show this infobar. |
36 return; | 44 return; |
37 #endif | 45 #endif |
38 | 46 |
39 infobar_service->AddInfoBar(ConfirmInfoBarDelegate::CreateInfoBar( | 47 infobar_service->AddInfoBar(ConfirmInfoBarDelegate::CreateInfoBar( |
40 scoped_ptr<ConfirmInfoBarDelegate>(new ObsoleteOSInfoBarDelegate()))); | 48 scoped_ptr<ConfirmInfoBarDelegate>(new ObsoleteSystemInfoBarDelegate()))); |
41 } | 49 } |
42 | 50 |
43 ObsoleteOSInfoBarDelegate::ObsoleteOSInfoBarDelegate() | 51 ObsoleteSystemInfoBarDelegate::ObsoleteSystemInfoBarDelegate() |
44 : ConfirmInfoBarDelegate() { | 52 : ConfirmInfoBarDelegate() { |
45 } | 53 } |
46 | 54 |
47 ObsoleteOSInfoBarDelegate::~ObsoleteOSInfoBarDelegate() { | 55 ObsoleteSystemInfoBarDelegate::~ObsoleteSystemInfoBarDelegate() { |
48 } | 56 } |
49 | 57 |
50 base::string16 ObsoleteOSInfoBarDelegate::GetMessageText() const { | 58 base::string16 ObsoleteSystemInfoBarDelegate::GetMessageText() const { |
| 59 #if defined(OS_MACOSX) |
| 60 return chrome::LocalizedObsoleteSystemString(); |
| 61 #else |
51 return l10n_util::GetStringUTF16(IDS_SYSTEM_OBSOLETE_MESSAGE); | 62 return l10n_util::GetStringUTF16(IDS_SYSTEM_OBSOLETE_MESSAGE); |
| 63 #endif |
52 } | 64 } |
53 | 65 |
54 int ObsoleteOSInfoBarDelegate::GetButtons() const { | 66 int ObsoleteSystemInfoBarDelegate::GetButtons() const { |
55 return BUTTON_NONE; | 67 return BUTTON_NONE; |
56 } | 68 } |
57 | 69 |
58 base::string16 ObsoleteOSInfoBarDelegate::GetLinkText() const { | 70 base::string16 ObsoleteSystemInfoBarDelegate::GetLinkText() const { |
59 return l10n_util::GetStringUTF16(IDS_LEARN_MORE); | 71 return l10n_util::GetStringUTF16(IDS_LEARN_MORE); |
60 } | 72 } |
61 | 73 |
62 bool ObsoleteOSInfoBarDelegate::LinkClicked(WindowOpenDisposition disposition) { | 74 bool ObsoleteSystemInfoBarDelegate::LinkClicked( |
| 75 WindowOpenDisposition disposition) { |
63 web_contents()->OpenURL(content::OpenURLParams( | 76 web_contents()->OpenURL(content::OpenURLParams( |
| 77 #if defined(OS_MACOSX) |
| 78 GURL(chrome::kMac32BitDeprecationURL), |
| 79 #else |
64 GURL("http://www.google.com/support/chrome/bin/answer.py?answer=95411"), | 80 GURL("http://www.google.com/support/chrome/bin/answer.py?answer=95411"), |
| 81 #endif |
65 content::Referrer(), | 82 content::Referrer(), |
66 (disposition == CURRENT_TAB) ? NEW_FOREGROUND_TAB : disposition, | 83 (disposition == CURRENT_TAB) ? NEW_FOREGROUND_TAB : disposition, |
67 content::PAGE_TRANSITION_LINK, false)); | 84 content::PAGE_TRANSITION_LINK, false)); |
68 return false; | 85 return false; |
69 } | 86 } |
OLD | NEW |