OLD | NEW |
---|---|
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 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 | 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/intents/register_intent_handler_infobar_delegate.h" | 5 #include "chrome/browser/intents/register_intent_handler_infobar_delegate.h" |
6 | 6 |
7 #include "base/bind.h" | |
8 #include "base/bind_helpers.h" | |
7 #include "base/logging.h" | 9 #include "base/logging.h" |
8 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
11 #include "chrome/browser/infobars/infobar_tab_helper.h" | |
9 #include "chrome/browser/intents/web_intents_registry.h" | 12 #include "chrome/browser/intents/web_intents_registry.h" |
10 #include "chrome/browser/intents/web_intents_registry_factory.h" | 13 #include "chrome/browser/intents/web_intents_registry_factory.h" |
11 #include "chrome/browser/profiles/profile.h" | 14 #include "chrome/browser/profiles/profile.h" |
12 #include "grit/generated_resources.h" | 15 #include "grit/generated_resources.h" |
13 #include "ui/base/l10n/l10n_util.h" | 16 #include "ui/base/l10n/l10n_util.h" |
14 | 17 |
15 RegisterIntentHandlerInfoBarDelegate::RegisterIntentHandlerInfoBarDelegate( | 18 RegisterIntentHandlerInfoBarDelegate::RegisterIntentHandlerInfoBarDelegate( |
16 InfoBarTabHelper* infobar_helper, | 19 InfoBarTabHelper* infobar_helper, |
17 WebIntentsRegistry* registry, | 20 WebIntentsRegistry* registry, |
18 const WebIntentServiceData& service) | 21 const WebIntentServiceData& service) |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
53 return l10n_util::GetStringUTF16(IDS_LEARN_MORE); | 56 return l10n_util::GetStringUTF16(IDS_LEARN_MORE); |
54 } | 57 } |
55 | 58 |
56 bool RegisterIntentHandlerInfoBarDelegate::LinkClicked( | 59 bool RegisterIntentHandlerInfoBarDelegate::LinkClicked( |
57 WindowOpenDisposition disposition) { | 60 WindowOpenDisposition disposition) { |
58 // TODO(jhawkins): Open the Web Intents Help Center article once it is | 61 // TODO(jhawkins): Open the Web Intents Help Center article once it is |
59 // written. | 62 // written. |
60 // TODO(jhawkins): Add associated bug for the article here. | 63 // TODO(jhawkins): Add associated bug for the article here. |
61 return false; | 64 return false; |
62 } | 65 } |
66 | |
67 // Helper continuation for MaybeShowIntentInfoBar. | |
68 void CheckProvider( | |
James Hawkins
2011/10/26 23:50:06
Move to an unnamed namespace.
Greg Billock
2011/10/29 00:03:19
Done.
| |
69 InfoBarTabHelper* infobar_helper, | |
70 WebIntentsRegistry* registry, | |
James Hawkins
2011/10/26 23:50:06
Just an FYI: for implementation, parameters may be
Greg Billock
2011/10/29 00:03:19
Moved these up and indented.
On 2011/10/26 23:50:
| |
71 const WebIntentServiceData& service, | |
72 bool provider_exists) { | |
73 if (!provider_exists) { | |
James Hawkins
2011/10/26 23:50:06
Perhaps this parameter could be removed and the co
Greg Billock
2011/10/29 00:03:19
Hmmm. So the signature is something like NotifyIfI
| |
74 infobar_helper->AddInfoBar(new RegisterIntentHandlerInfoBarDelegate( | |
75 infobar_helper, registry, service)); | |
76 } | |
77 } | |
78 | |
79 // static | |
80 void RegisterIntentHandlerInfoBarDelegate::MaybeShowIntentInfoBar( | |
81 InfoBarTabHelper* infobar_helper, | |
82 WebIntentsRegistry* registry, | |
83 const WebIntentServiceData& service) { | |
84 DCHECK(infobar_helper); | |
85 DCHECK(registry); | |
86 registry->IntentProviderExists(service, | |
87 base::Bind(&CheckProvider, | |
88 base::Unretained(infobar_helper), | |
89 base::Unretained(registry), | |
90 service)); | |
91 } | |
OLD | NEW |