Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(512)

Side by Side Diff: chrome/browser/ui/startup/obsolete_os_infobar_delegate.cc

Issue 11773036: ObsoleteOSInfoBar -> ObsoleteOSInfoBarDelegate, for consistency with other infobar delegates. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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_os_info_bar.h" 5 #include "chrome/browser/ui/startup/obsolete_os_infobar_delegate.h"
6 6
7 #include "chrome/browser/infobars/infobar_service.h" 7 #include "chrome/browser/infobars/infobar_service.h"
8 #include "content/public/browser/web_contents.h" 8 #include "content/public/browser/web_contents.h"
9 #include "grit/chromium_strings.h" 9 #include "grit/chromium_strings.h"
10 #include "grit/generated_resources.h" 10 #include "grit/generated_resources.h"
11 #include "ui/base/l10n/l10n_util.h" 11 #include "ui/base/l10n/l10n_util.h"
12 12
13 #if defined(TOOLKIT_GTK) 13 #if defined(TOOLKIT_GTK)
14 #include <gtk/gtk.h> 14 #include <gtk/gtk.h>
15 #endif 15 #endif
16 16
17 using content::OpenURLParams; 17 using content::OpenURLParams;
18 using content::Referrer; 18 using content::Referrer;
19 19
20 namespace chrome { 20 namespace chrome {
21 21
22 // static 22 // static
23 void ObsoleteOSInfoBar::Create(InfoBarService* infobar_service) { 23 void ObsoleteOSInfoBarDelegate::Create(InfoBarService* infobar_service) {
24 #if defined(TOOLKIT_GTK) 24 #if defined(TOOLKIT_GTK)
25 // We've deprecated support for Ubuntu Lucid. Rather than attempting to 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; 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) 27 // this will also deprecate other distributions (including variants of Ubuntu)
28 // that are of a similar age. 28 // that are of a similar age.
29 // Version key: 29 // Version key:
30 // RHEL 6: GTK 2.18 30 // RHEL 6: GTK 2.18
31 // Debian 6 (Squeeze): GTK 2.20 31 // Debian 6 (Squeeze): GTK 2.20
32 // Ubuntu Lucid: GTK 2.20 32 // Ubuntu Lucid: GTK 2.20
33 // openSUSE 12.2 GTK 2.24 33 // openSUSE 12.2 GTK 2.24
34 // Ubuntu Precise: GTK 2.24 34 // Ubuntu Precise: GTK 2.24
35 if (!gtk_check_version(2, 24, 0)) 35 if (!gtk_check_version(2, 24, 0))
36 return; 36 return;
37 #else 37 #else
38 // No other platforms currently show this infobar. 38 // No other platforms currently show this infobar.
39 return; 39 return;
40 #endif 40 #endif
41 41
42 string16 message = l10n_util::GetStringUTF16(IDS_SYSTEM_OBSOLETE_MESSAGE); 42 string16 message = l10n_util::GetStringUTF16(IDS_SYSTEM_OBSOLETE_MESSAGE);
43 // Link to an article in the help center on minimum system requirements. 43 // Link to an article in the help center on minimum system requirements.
44 const char* kLearnMoreURL = 44 const char* kLearnMoreURL =
45 "http://www.google.com/support/chrome/bin/answer.py?answer=95411"; 45 "http://www.google.com/support/chrome/bin/answer.py?answer=95411";
46 infobar_service->AddInfoBar(scoped_ptr<InfoBarDelegate>( 46 infobar_service->AddInfoBar(scoped_ptr<InfoBarDelegate>(
47 new ObsoleteOSInfoBar(infobar_service, message, GURL(kLearnMoreURL)))); 47 new ObsoleteOSInfoBarDelegate(infobar_service, message,
48 GURL(kLearnMoreURL))));
48 } 49 }
49 50
50 string16 ObsoleteOSInfoBar::GetMessageText() const { 51 string16 ObsoleteOSInfoBarDelegate::GetMessageText() const {
51 return message_; 52 return message_;
52 } 53 }
53 54
54 int ObsoleteOSInfoBar::GetButtons() const { 55 int ObsoleteOSInfoBarDelegate::GetButtons() const {
55 return BUTTON_NONE; 56 return BUTTON_NONE;
56 } 57 }
57 58
58 string16 ObsoleteOSInfoBar::GetLinkText() const { 59 string16 ObsoleteOSInfoBarDelegate::GetLinkText() const {
59 return l10n_util::GetStringUTF16(IDS_LEARN_MORE); 60 return l10n_util::GetStringUTF16(IDS_LEARN_MORE);
60 } 61 }
61 62
62 bool ObsoleteOSInfoBar::LinkClicked(WindowOpenDisposition disposition) { 63 bool ObsoleteOSInfoBarDelegate::LinkClicked(WindowOpenDisposition disposition) {
63 OpenURLParams params(learn_more_url_, Referrer(), 64 OpenURLParams params(learn_more_url_, Referrer(),
64 (disposition == CURRENT_TAB) ? NEW_FOREGROUND_TAB : disposition, 65 (disposition == CURRENT_TAB) ? NEW_FOREGROUND_TAB : disposition,
65 content::PAGE_TRANSITION_LINK, false); 66 content::PAGE_TRANSITION_LINK, false);
66 owner()->GetWebContents()->OpenURL(params); 67 owner()->GetWebContents()->OpenURL(params);
67 return false; 68 return false;
68 } 69 }
69 70
70 ObsoleteOSInfoBar::ObsoleteOSInfoBar(InfoBarService* infobar_service, 71 ObsoleteOSInfoBarDelegate::ObsoleteOSInfoBarDelegate(
71 const string16& message, 72 InfoBarService* infobar_service,
72 const GURL& url) 73 const string16& message,
74 const GURL& url)
73 : ConfirmInfoBarDelegate(infobar_service), 75 : ConfirmInfoBarDelegate(infobar_service),
74 message_(message), 76 message_(message),
75 learn_more_url_(url) { 77 learn_more_url_(url) {
76 } 78 }
77 79
78 ObsoleteOSInfoBar::~ObsoleteOSInfoBar() { 80 ObsoleteOSInfoBarDelegate::~ObsoleteOSInfoBarDelegate() {
79 } 81 }
80 82
81 } // namespace chrome 83 } // namespace chrome
OLDNEW
« no previous file with comments | « chrome/browser/ui/startup/obsolete_os_infobar_delegate.h ('k') | chrome/browser/ui/startup/startup_browser_creator_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698