| 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 "chrome/browser/browser_process.h" | 7 #include "chrome/browser/browser_process.h" |
| 8 #include "chrome/browser/infobars/infobar_service.h" | 8 #include "chrome/browser/infobars/infobar_service.h" |
| 9 #include "chrome/browser/obsolete_system/obsolete_system.h" | 9 #include "chrome/browser/obsolete_system/obsolete_system.h" |
| 10 #include "chrome/common/pref_names.h" | 10 #include "chrome/common/pref_names.h" |
| 11 #include "chrome/common/url_constants.h" | 11 #include "chrome/common/url_constants.h" |
| 12 #include "chrome/grit/chromium_strings.h" | 12 #include "chrome/grit/chromium_strings.h" |
| 13 #include "components/infobars/core/infobar.h" | 13 #include "components/infobars/core/infobar.h" |
| 14 #include "components/prefs/pref_service.h" | 14 #include "components/prefs/pref_service.h" |
| 15 #include "content/public/browser/web_contents.h" | 15 #include "content/public/browser/web_contents.h" |
| 16 #include "grit/components_strings.h" | 16 #include "grit/components_strings.h" |
| 17 #include "ui/base/l10n/l10n_util.h" | 17 #include "ui/base/l10n/l10n_util.h" |
| 18 | 18 |
| 19 // static | 19 // static |
| 20 void ObsoleteSystemInfoBarDelegate::Create(InfoBarService* infobar_service) { | 20 void ObsoleteSystemInfoBarDelegate::Create(InfoBarService* infobar_service) { |
| 21 PrefService* local_state = g_browser_process->local_state(); | 21 PrefService* local_state = g_browser_process->local_state(); |
| 22 if (local_state && | 22 if (local_state && |
| 23 local_state->GetBoolean(prefs::kSuppressUnsupportedOSWarning)) { | 23 local_state->GetBoolean(prefs::kSuppressUnsupportedOSWarning)) { |
| 24 return; | 24 return; |
| 25 } | 25 } |
| 26 if (!ObsoleteSystem::IsObsoleteNowOrSoon()) | 26 if (!ObsoleteSystem::IsObsoleteNowOrSoon()) |
| 27 return; | 27 return; |
| 28 infobar_service->AddInfoBar(infobar_service->CreateConfirmInfoBar( | 28 infobar_service->AddInfoBar(infobar_service->CreateConfirmInfoBar( |
| 29 scoped_ptr<ConfirmInfoBarDelegate>(new ObsoleteSystemInfoBarDelegate()))); | 29 std::unique_ptr<ConfirmInfoBarDelegate>( |
| 30 new ObsoleteSystemInfoBarDelegate()))); |
| 30 } | 31 } |
| 31 | 32 |
| 32 ObsoleteSystemInfoBarDelegate::ObsoleteSystemInfoBarDelegate() | 33 ObsoleteSystemInfoBarDelegate::ObsoleteSystemInfoBarDelegate() |
| 33 : ConfirmInfoBarDelegate() { | 34 : ConfirmInfoBarDelegate() { |
| 34 } | 35 } |
| 35 | 36 |
| 36 ObsoleteSystemInfoBarDelegate::~ObsoleteSystemInfoBarDelegate() { | 37 ObsoleteSystemInfoBarDelegate::~ObsoleteSystemInfoBarDelegate() { |
| 37 } | 38 } |
| 38 | 39 |
| 39 infobars::InfoBarDelegate::InfoBarIdentifier | 40 infobars::InfoBarDelegate::InfoBarIdentifier |
| 40 ObsoleteSystemInfoBarDelegate::GetIdentifier() const { | 41 ObsoleteSystemInfoBarDelegate::GetIdentifier() const { |
| 41 return OBSOLETE_SYSTEM_INFOBAR_DELEGATE; | 42 return OBSOLETE_SYSTEM_INFOBAR_DELEGATE; |
| 42 } | 43 } |
| 43 | 44 |
| 44 base::string16 ObsoleteSystemInfoBarDelegate::GetMessageText() const { | 45 base::string16 ObsoleteSystemInfoBarDelegate::GetMessageText() const { |
| 45 return ObsoleteSystem::LocalizedObsoleteString(); | 46 return ObsoleteSystem::LocalizedObsoleteString(); |
| 46 } | 47 } |
| 47 | 48 |
| 48 int ObsoleteSystemInfoBarDelegate::GetButtons() const { | 49 int ObsoleteSystemInfoBarDelegate::GetButtons() const { |
| 49 return BUTTON_NONE; | 50 return BUTTON_NONE; |
| 50 } | 51 } |
| 51 | 52 |
| 52 base::string16 ObsoleteSystemInfoBarDelegate::GetLinkText() const { | 53 base::string16 ObsoleteSystemInfoBarDelegate::GetLinkText() const { |
| 53 return l10n_util::GetStringUTF16(IDS_LEARN_MORE); | 54 return l10n_util::GetStringUTF16(IDS_LEARN_MORE); |
| 54 } | 55 } |
| 55 | 56 |
| 56 GURL ObsoleteSystemInfoBarDelegate::GetLinkURL() const { | 57 GURL ObsoleteSystemInfoBarDelegate::GetLinkURL() const { |
| 57 return GURL(ObsoleteSystem::GetLinkURL()); | 58 return GURL(ObsoleteSystem::GetLinkURL()); |
| 58 } | 59 } |
| OLD | NEW |