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_os_infobar_delegate.h" | 5 #include "chrome/browser/ui/startup/obsolete_os_infobar_delegate.h" |
6 | 6 |
| 7 #include "chrome/browser/infobars/infobar.h" |
7 #include "chrome/browser/infobars/infobar_service.h" | 8 #include "chrome/browser/infobars/infobar_service.h" |
8 #include "content/public/browser/web_contents.h" | 9 #include "content/public/browser/web_contents.h" |
9 #include "grit/chromium_strings.h" | 10 #include "grit/chromium_strings.h" |
10 #include "grit/generated_resources.h" | 11 #include "grit/generated_resources.h" |
11 #include "ui/base/l10n/l10n_util.h" | 12 #include "ui/base/l10n/l10n_util.h" |
12 | 13 |
13 #if defined(TOOLKIT_GTK) | 14 #if defined(TOOLKIT_GTK) |
14 #include <gtk/gtk.h> | 15 #include <gtk/gtk.h> |
15 #endif | 16 #endif |
16 | 17 |
(...skipping 11 matching lines...) Expand all Loading... |
28 // Ubuntu Lucid: GTK 2.20 | 29 // Ubuntu Lucid: GTK 2.20 |
29 // openSUSE 12.2 GTK 2.24 | 30 // openSUSE 12.2 GTK 2.24 |
30 // Ubuntu Precise: GTK 2.24 | 31 // Ubuntu Precise: GTK 2.24 |
31 if (!gtk_check_version(2, 24, 0)) | 32 if (!gtk_check_version(2, 24, 0)) |
32 return; | 33 return; |
33 #else | 34 #else |
34 // No other platforms currently show this infobar. | 35 // No other platforms currently show this infobar. |
35 return; | 36 return; |
36 #endif | 37 #endif |
37 | 38 |
38 infobar_service->AddInfoBar(scoped_ptr<InfoBarDelegate>( | 39 infobar_service->AddInfoBar(ConfirmInfoBarDelegate::CreateInfoBar( |
39 new ObsoleteOSInfoBarDelegate(infobar_service))); | 40 scoped_ptr<ConfirmInfoBarDelegate>(new ObsoleteOSInfoBarDelegate()))); |
40 } | 41 } |
41 | 42 |
42 ObsoleteOSInfoBarDelegate::ObsoleteOSInfoBarDelegate( | 43 ObsoleteOSInfoBarDelegate::ObsoleteOSInfoBarDelegate() |
43 InfoBarService* infobar_service) | 44 : ConfirmInfoBarDelegate() { |
44 : ConfirmInfoBarDelegate(infobar_service) { | |
45 } | 45 } |
46 | 46 |
47 ObsoleteOSInfoBarDelegate::~ObsoleteOSInfoBarDelegate() { | 47 ObsoleteOSInfoBarDelegate::~ObsoleteOSInfoBarDelegate() { |
48 } | 48 } |
49 | 49 |
50 string16 ObsoleteOSInfoBarDelegate::GetMessageText() const { | 50 string16 ObsoleteOSInfoBarDelegate::GetMessageText() const { |
51 return l10n_util::GetStringUTF16(IDS_SYSTEM_OBSOLETE_MESSAGE); | 51 return l10n_util::GetStringUTF16(IDS_SYSTEM_OBSOLETE_MESSAGE); |
52 } | 52 } |
53 | 53 |
54 int ObsoleteOSInfoBarDelegate::GetButtons() const { | 54 int ObsoleteOSInfoBarDelegate::GetButtons() const { |
55 return BUTTON_NONE; | 55 return BUTTON_NONE; |
56 } | 56 } |
57 | 57 |
58 string16 ObsoleteOSInfoBarDelegate::GetLinkText() const { | 58 string16 ObsoleteOSInfoBarDelegate::GetLinkText() const { |
59 return l10n_util::GetStringUTF16(IDS_LEARN_MORE); | 59 return l10n_util::GetStringUTF16(IDS_LEARN_MORE); |
60 } | 60 } |
61 | 61 |
62 bool ObsoleteOSInfoBarDelegate::LinkClicked(WindowOpenDisposition disposition) { | 62 bool ObsoleteOSInfoBarDelegate::LinkClicked(WindowOpenDisposition disposition) { |
63 web_contents()->OpenURL(content::OpenURLParams( | 63 web_contents()->OpenURL(content::OpenURLParams( |
64 GURL("http://www.google.com/support/chrome/bin/answer.py?answer=95411"), | 64 GURL("http://www.google.com/support/chrome/bin/answer.py?answer=95411"), |
65 content::Referrer(), | 65 content::Referrer(), |
66 (disposition == CURRENT_TAB) ? NEW_FOREGROUND_TAB : disposition, | 66 (disposition == CURRENT_TAB) ? NEW_FOREGROUND_TAB : disposition, |
67 content::PAGE_TRANSITION_LINK, false)); | 67 content::PAGE_TRANSITION_LINK, false)); |
68 return false; | 68 return false; |
69 } | 69 } |
OLD | NEW |