| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "chrome/browser/ui/startup/obsolete_os_info_bar.h" | |
| 6 | |
| 7 #include "chrome/browser/infobars/infobar_service.h" | |
| 8 #include "content/public/browser/web_contents.h" | |
| 9 #include "grit/chromium_strings.h" | |
| 10 #include "grit/generated_resources.h" | |
| 11 #include "ui/base/l10n/l10n_util.h" | |
| 12 | |
| 13 #if defined(TOOLKIT_GTK) | |
| 14 #include <gtk/gtk.h> | |
| 15 #endif | |
| 16 | |
| 17 using content::OpenURLParams; | |
| 18 using content::Referrer; | |
| 19 | |
| 20 namespace chrome { | |
| 21 | |
| 22 // static | |
| 23 void ObsoleteOSInfoBar::Create(InfoBarService* infobar_service) { | |
| 24 #if defined(TOOLKIT_GTK) | |
| 25 // We've deprecated support for Ubuntu Lucid. Rather than attempting to | |
| 26 // determine whether you're using that, we instead key off the GTK version; | |
| 27 // this will also deprecate other distributions (including variants of Ubuntu) | |
| 28 // that are of a similar age. | |
| 29 // Version key: | |
| 30 // RHEL 6: GTK 2.18 | |
| 31 // Debian 6 (Squeeze): GTK 2.20 | |
| 32 // Ubuntu Lucid: GTK 2.20 | |
| 33 // openSUSE 12.2 GTK 2.24 | |
| 34 // Ubuntu Precise: GTK 2.24 | |
| 35 if (!gtk_check_version(2, 24, 0)) | |
| 36 return; | |
| 37 #else | |
| 38 // No other platforms currently show this infobar. | |
| 39 return; | |
| 40 #endif | |
| 41 | |
| 42 string16 message = l10n_util::GetStringUTF16(IDS_SYSTEM_OBSOLETE_MESSAGE); | |
| 43 // Link to an article in the help center on minimum system requirements. | |
| 44 const char* kLearnMoreURL = | |
| 45 "http://www.google.com/support/chrome/bin/answer.py?answer=95411"; | |
| 46 infobar_service->AddInfoBar(scoped_ptr<InfoBarDelegate>( | |
| 47 new ObsoleteOSInfoBar(infobar_service, message, GURL(kLearnMoreURL)))); | |
| 48 } | |
| 49 | |
| 50 string16 ObsoleteOSInfoBar::GetMessageText() const { | |
| 51 return message_; | |
| 52 } | |
| 53 | |
| 54 int ObsoleteOSInfoBar::GetButtons() const { | |
| 55 return BUTTON_NONE; | |
| 56 } | |
| 57 | |
| 58 string16 ObsoleteOSInfoBar::GetLinkText() const { | |
| 59 return l10n_util::GetStringUTF16(IDS_LEARN_MORE); | |
| 60 } | |
| 61 | |
| 62 bool ObsoleteOSInfoBar::LinkClicked(WindowOpenDisposition disposition) { | |
| 63 OpenURLParams params(learn_more_url_, Referrer(), | |
| 64 (disposition == CURRENT_TAB) ? NEW_FOREGROUND_TAB : disposition, | |
| 65 content::PAGE_TRANSITION_LINK, false); | |
| 66 owner()->GetWebContents()->OpenURL(params); | |
| 67 return false; | |
| 68 } | |
| 69 | |
| 70 ObsoleteOSInfoBar::ObsoleteOSInfoBar(InfoBarService* infobar_service, | |
| 71 const string16& message, | |
| 72 const GURL& url) | |
| 73 : ConfirmInfoBarDelegate(infobar_service), | |
| 74 message_(message), | |
| 75 learn_more_url_(url) { | |
| 76 } | |
| 77 | |
| 78 ObsoleteOSInfoBar::~ObsoleteOSInfoBar() { | |
| 79 } | |
| 80 | |
| 81 } // namespace chrome | |
| OLD | NEW |