OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2017 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/chromedriver_infobar_delegate.h" | |
6 | |
7 #include "chrome/browser/infobars/infobar_service.h" | |
8 #include "chrome/browser/ui/browser.h" | |
9 #include "chrome/browser/ui/tabs/tab_strip_model.h" | |
10 #include "chrome/grit/generated_resources.h" | |
11 #include "components/infobars/core/infobar.h" | |
12 #include "components/strings/grit/components_strings.h" | |
13 #include "content/public/browser/web_contents.h" | |
14 #include "ui/base/l10n/l10n_util.h" | |
15 | |
16 // static | |
17 void ChromeDriverInfoBarDelegate::Create(Browser* browser) { | |
18 content::WebContents* web_contents = | |
19 browser->tab_strip_model()->GetActiveWebContents(); | |
20 InfoBarService* infobar_service = | |
21 InfoBarService::FromWebContents(web_contents); | |
22 infobar_service->AddInfoBar(infobar_service->CreateConfirmInfoBar( | |
23 std::unique_ptr<ConfirmInfoBarDelegate>( | |
24 new ChromeDriverInfoBarDelegate()))); | |
25 } | |
26 | |
27 ChromeDriverInfoBarDelegate::ChromeDriverInfoBarDelegate() | |
28 : ConfirmInfoBarDelegate() { | |
Devlin
2017/02/06 16:20:21
nit: this should be automatically called (so you c
samuong
2017/02/07 19:11:09
Done.
| |
29 } | |
30 | |
31 ChromeDriverInfoBarDelegate::~ChromeDriverInfoBarDelegate() { | |
32 } | |
33 | |
34 infobars::InfoBarDelegate::InfoBarIdentifier | |
35 ChromeDriverInfoBarDelegate::GetIdentifier() const { | |
36 return CHROMEDRIVER_INFOBAR_DELEGATE; | |
37 } | |
38 | |
39 base::string16 ChromeDriverInfoBarDelegate::GetMessageText() const { | |
40 return l10n_util::GetStringUTF16(IDS_CONTROLLED_BY_CHROMEDRIVER); | |
41 } | |
42 | |
43 int ChromeDriverInfoBarDelegate::GetButtons() const { | |
44 return BUTTON_NONE; | |
45 } | |
46 | |
47 base::string16 ChromeDriverInfoBarDelegate::GetLinkText() const { | |
48 return l10n_util::GetStringUTF16(IDS_LEARN_MORE); | |
49 } | |
50 | |
51 GURL ChromeDriverInfoBarDelegate::GetLinkURL() const { | |
52 return GURL("http://chromedriver.chromium.org/"); | |
53 } | |
54 | |
55 bool ChromeDriverInfoBarDelegate::ShouldExpire( | |
56 const NavigationDetails& details) const { | |
57 return false; | |
58 } | |
OLD | NEW |