blob: 45d59b73cb06c6c0a5f553c44de2960b672d3d0d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "chrome/browser/ui/startup/obsolete_os_info_bar.h"
#include "chrome/browser/infobars/infobar_tab_helper.h"
#include "chrome/browser/ui/tab_contents/tab_contents.h"
#include "content/public/browser/web_contents.h"
#include "grit/generated_resources.h"
#include "ui/base/l10n/l10n_util.h"
using content::OpenURLParams;
using content::Referrer;
namespace chrome {
ObsoleteOSInfoBar::ObsoleteOSInfoBar(InfoBarTabHelper* infobar_helper,
const string16& message,
const GURL& url)
: LinkInfoBarDelegate(infobar_helper),
message_(message),
learn_more_url_(url) {
}
ObsoleteOSInfoBar::~ObsoleteOSInfoBar() {
}
string16 ObsoleteOSInfoBar::GetMessageTextWithOffset(
size_t* link_offset) const {
string16 text = message_;
text.push_back(' '); // Add a space before the following link.
*link_offset = text.size();
return text;
}
string16 ObsoleteOSInfoBar::GetLinkText() const {
return l10n_util::GetStringUTF16(IDS_LEARN_MORE);
}
bool ObsoleteOSInfoBar::LinkClicked(WindowOpenDisposition disposition) {
OpenURLParams params(
learn_more_url_, Referrer(), disposition, content::PAGE_TRANSITION_LINK,
false);
owner()->web_contents()->OpenURL(params);
return false;
}
} // namespace chrome
|