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