OLD | NEW |
---|---|
(Empty) | |
1 // Copyright (c) 2011 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/intents/register_intent_handler_infobar_delegate.h" | |
6 | |
7 #include "base/utf_string_conversions.h" | |
8 #include "chrome/common/url_constants.h" | |
9 #include "content/browser/tab_contents/tab_contents.h" | |
10 #include "grit/generated_resources.h" | |
11 #include "ui/base/l10n/l10n_util.h" | |
12 | |
13 RegisterIntentHandlerInfoBarDelegate::RegisterIntentHandlerInfoBarDelegate( | |
14 TabContents* tab_contents) | |
15 : ConfirmInfoBarDelegate(tab_contents), | |
16 tab_contents_(tab_contents) { | |
17 } | |
18 | |
19 InfoBarDelegate::Type | |
20 RegisterIntentHandlerInfoBarDelegate::GetInfoBarType() const { | |
21 return PAGE_ACTION_TYPE; | |
22 } | |
23 | |
24 string16 RegisterIntentHandlerInfoBarDelegate::GetMessageText() const { | |
25 return l10n_util::GetStringFUTF16(IDS_REGISTER_PROTOCOL_HANDLER_CONFIRM, | |
26 string16(), string16()); | |
27 } | |
28 | |
29 int RegisterIntentHandlerInfoBarDelegate::GetButtons() const { | |
30 return BUTTON_OK | BUTTON_CANCEL; | |
Peter Kasting
2011/07/26 22:52:12
Nit: You can eliminate this function entirely -- i
James Hawkins
2011/07/26 23:04:56
Done.
| |
31 } | |
32 | |
33 string16 RegisterIntentHandlerInfoBarDelegate::GetButtonLabel( | |
34 InfoBarButton button) const { | |
35 switch (button) { | |
36 case BUTTON_OK: | |
37 return l10n_util::GetStringUTF16(IDS_REGISTER_INTENT_HANDLER_ACCEPT); | |
38 case BUTTON_CANCEL: | |
39 return l10n_util::GetStringFUTF16(IDS_REGISTER_INTENT_HANDLER_DENY, | |
40 string16()); | |
Peter Kasting
2011/07/26 22:52:12
This extra arg shouldn't be here.
James Hawkins
2011/07/26 23:04:56
Done.
| |
41 case BUTTON_NONE: | |
Peter Kasting
2011/07/26 22:52:12
Getting BUTTON_NONE here is actually illegal.
Nit
James Hawkins
2011/07/26 23:04:56
Removed NONE handling by switching to an if/else.
| |
42 break; | |
43 } | |
44 | |
45 NOTREACHED(); | |
46 return string16(); | |
47 } | |
48 | |
49 string16 RegisterIntentHandlerInfoBarDelegate::GetLinkText() const { | |
50 return l10n_util::GetStringUTF16(IDS_LEARN_MORE); | |
51 } | |
52 | |
53 bool RegisterIntentHandlerInfoBarDelegate::LinkClicked( | |
54 WindowOpenDisposition disposition) { | |
55 // TODO(jhawkins): Open the Web Intents Help Center article once it is | |
56 // written. | |
57 // TODO(jhawkins): Add associated bug for the article here. | |
Peter Kasting
2011/07/26 22:52:12
Nit: What's this mean?
James Hawkins
2011/07/26 23:04:56
I need to file a bug to get the help center articl
| |
58 return false; | |
59 } | |
OLD | NEW |