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