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_system_infobar_delegate.h" | 5 #include "chrome/browser/ui/startup/obsolete_system_infobar_delegate.h" |
6 | 6 |
| 7 #include "base/cpu.h" |
7 #include "chrome/browser/infobars/infobar_service.h" | 8 #include "chrome/browser/infobars/infobar_service.h" |
8 #include "chrome/common/url_constants.h" | 9 #include "chrome/common/url_constants.h" |
9 #include "chrome/grit/chromium_strings.h" | 10 #include "chrome/grit/chromium_strings.h" |
10 #include "chrome/grit/generated_resources.h" | 11 #include "chrome/grit/generated_resources.h" |
11 #include "components/infobars/core/infobar.h" | 12 #include "components/infobars/core/infobar.h" |
12 #include "content/public/browser/web_contents.h" | 13 #include "content/public/browser/web_contents.h" |
13 #include "ui/base/l10n/l10n_util.h" | 14 #include "ui/base/l10n/l10n_util.h" |
14 | 15 |
15 #if defined(OS_MACOSX) | 16 #if defined(OS_MACOSX) |
16 #include "chrome/browser/mac/obsolete_system.h" | 17 #include "chrome/browser/mac/obsolete_system.h" |
17 #endif | 18 #endif |
18 | 19 |
19 // static | 20 // static |
20 void ObsoleteSystemInfoBarDelegate::Create(InfoBarService* infobar_service) { | 21 void ObsoleteSystemInfoBarDelegate::Create(InfoBarService* infobar_service) { |
21 #if defined(OS_MACOSX) | 22 #if defined(OS_MACOSX) |
22 if (!ObsoleteSystemMac::Is32BitObsoleteNowOrSoon() || | 23 if (!ObsoleteSystemMac::Is32BitObsoleteNowOrSoon() || |
23 !ObsoleteSystemMac::Has32BitOnlyCPU()) { | 24 !ObsoleteSystemMac::Has32BitOnlyCPU()) { |
24 return; | 25 return; |
25 } | 26 } |
26 infobar_service->AddInfoBar(ConfirmInfoBarDelegate::CreateInfoBar( | 27 #elif defined(OS_WIN) |
27 scoped_ptr<ConfirmInfoBarDelegate>(new ObsoleteSystemInfoBarDelegate()))); | 28 // On Windows we no longer support non-SSE2 machines since Chrome 35. |
| 29 if (base::CPU().has_sse2()) |
| 30 return; |
28 #else | 31 #else |
29 // No other platforms currently show this infobar. | 32 // No other platforms currently show this infobar. |
30 return; | 33 return; |
31 #endif | 34 #endif |
| 35 |
| 36 infobar_service->AddInfoBar(ConfirmInfoBarDelegate::CreateInfoBar( |
| 37 scoped_ptr<ConfirmInfoBarDelegate>(new ObsoleteSystemInfoBarDelegate()))); |
32 } | 38 } |
33 | 39 |
34 ObsoleteSystemInfoBarDelegate::ObsoleteSystemInfoBarDelegate() | 40 ObsoleteSystemInfoBarDelegate::ObsoleteSystemInfoBarDelegate() |
35 : ConfirmInfoBarDelegate() { | 41 : ConfirmInfoBarDelegate() { |
36 } | 42 } |
37 | 43 |
38 ObsoleteSystemInfoBarDelegate::~ObsoleteSystemInfoBarDelegate() { | 44 ObsoleteSystemInfoBarDelegate::~ObsoleteSystemInfoBarDelegate() { |
39 } | 45 } |
40 | 46 |
41 base::string16 ObsoleteSystemInfoBarDelegate::GetMessageText() const { | 47 base::string16 ObsoleteSystemInfoBarDelegate::GetMessageText() const { |
42 #if defined(OS_MACOSX) | 48 #if defined(OS_MACOSX) |
43 return ObsoleteSystemMac::LocalizedObsoleteSystemString(); | 49 return ObsoleteSystemMac::LocalizedObsoleteSystemString(); |
| 50 #elif defined(OS_WIN) |
| 51 return l10n_util::GetStringUTF16(IDS_WIN_SSE_OBSOLETE_NOW); |
44 #else | 52 #else |
45 return l10n_util::GetStringUTF16(IDS_SYSTEM_OBSOLETE_MESSAGE); | 53 return l10n_util::GetStringUTF16(IDS_SYSTEM_OBSOLETE_MESSAGE); |
46 #endif | 54 #endif |
47 } | 55 } |
48 | 56 |
49 int ObsoleteSystemInfoBarDelegate::GetButtons() const { | 57 int ObsoleteSystemInfoBarDelegate::GetButtons() const { |
50 return BUTTON_NONE; | 58 return BUTTON_NONE; |
51 } | 59 } |
52 | 60 |
53 base::string16 ObsoleteSystemInfoBarDelegate::GetLinkText() const { | 61 base::string16 ObsoleteSystemInfoBarDelegate::GetLinkText() const { |
54 return l10n_util::GetStringUTF16(IDS_LEARN_MORE); | 62 return l10n_util::GetStringUTF16(IDS_LEARN_MORE); |
55 } | 63 } |
56 | 64 |
57 bool ObsoleteSystemInfoBarDelegate::LinkClicked( | 65 bool ObsoleteSystemInfoBarDelegate::LinkClicked( |
58 WindowOpenDisposition disposition) { | 66 WindowOpenDisposition disposition) { |
59 InfoBarService::WebContentsFromInfoBar(infobar())->OpenURL( | 67 InfoBarService::WebContentsFromInfoBar(infobar())->OpenURL( |
60 content::OpenURLParams( | 68 content::OpenURLParams( |
61 #if defined(OS_MACOSX) | 69 #if defined(OS_MACOSX) |
62 GURL(chrome::kMac32BitDeprecationURL), | 70 GURL(chrome::kMac32BitDeprecationURL), |
63 #else | 71 #else |
64 GURL("http://www.google.com/support/chrome/bin/" | 72 GURL("http://www.google.com/support/chrome/bin/" |
65 "answer.py?answer=95411"), | 73 "answer.py?answer=95411"), |
66 #endif | 74 #endif |
67 content::Referrer(), | 75 content::Referrer(), |
68 (disposition == CURRENT_TAB) ? NEW_FOREGROUND_TAB : disposition, | 76 (disposition == CURRENT_TAB) ? NEW_FOREGROUND_TAB : disposition, |
69 content::PAGE_TRANSITION_LINK, false)); | 77 content::PAGE_TRANSITION_LINK, false)); |
70 return false; | 78 return false; |
71 } | 79 } |
OLD | NEW |