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 #ifndef CHROME_BROWSER_INTENTS_REGISTER_INTENT_HANDLER_INFOBAR_DELEGATE_H_ | 5 #ifndef CHROME_BROWSER_INTENTS_REGISTER_INTENT_HANDLER_INFOBAR_DELEGATE_H_ |
6 #define CHROME_BROWSER_INTENTS_REGISTER_INTENT_HANDLER_INFOBAR_DELEGATE_H_ | 6 #define CHROME_BROWSER_INTENTS_REGISTER_INTENT_HANDLER_INFOBAR_DELEGATE_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/string16.h" | 10 #include "base/string16.h" |
11 #include "chrome/browser/tab_contents/confirm_infobar_delegate.h" | 11 #include "chrome/browser/tab_contents/confirm_infobar_delegate.h" |
12 #include "webkit/glue/web_intent_service_data.h" | 12 #include "webkit/glue/web_intent_service_data.h" |
13 | 13 |
14 class InfoBarTabHelper; | |
14 class TabContents; | 15 class TabContents; |
15 class WebIntentsRegistry; | 16 class WebIntentsRegistry; |
16 | 17 |
17 // The InfoBar used to request permission for a site to be registered as an | 18 // The InfoBar used to request permission for a site to be registered as an |
18 // Intent handler. | 19 // Intent handler. |
19 class RegisterIntentHandlerInfoBarDelegate : public ConfirmInfoBarDelegate { | 20 class RegisterIntentHandlerInfoBarDelegate : public ConfirmInfoBarDelegate { |
20 public: | 21 public: |
21 RegisterIntentHandlerInfoBarDelegate(InfoBarTabHelper* infobar_helper, | 22 RegisterIntentHandlerInfoBarDelegate(InfoBarTabHelper* infobar_helper, |
22 WebIntentsRegistry* registry, | 23 WebIntentsRegistry* registry, |
23 const WebIntentServiceData& service); | 24 const WebIntentServiceData& service); |
24 | 25 |
25 // ConfirmInfoBarDelegate implementation. | 26 // ConfirmInfoBarDelegate implementation. |
26 virtual Type GetInfoBarType() const OVERRIDE; | 27 virtual Type GetInfoBarType() const OVERRIDE; |
27 virtual string16 GetMessageText() const OVERRIDE; | 28 virtual string16 GetMessageText() const OVERRIDE; |
28 virtual string16 GetButtonLabel(InfoBarButton button) const OVERRIDE; | 29 virtual string16 GetButtonLabel(InfoBarButton button) const OVERRIDE; |
29 virtual bool Accept() OVERRIDE; | 30 virtual bool Accept() OVERRIDE; |
30 virtual string16 GetLinkText() const OVERRIDE; | 31 virtual string16 GetLinkText() const OVERRIDE; |
31 virtual bool LinkClicked(WindowOpenDisposition disposition) OVERRIDE; | 32 virtual bool LinkClicked(WindowOpenDisposition disposition) OVERRIDE; |
32 | 33 |
34 // This helper method checks the registry to see if the indicated service has | |
35 // already been registered. If all registration details are the same, it does | |
36 // not show the infobar. | |
37 // |infobar_helper| is the infobar controller for the tab in which to maybe | |
James Hawkins
2011/10/05 22:27:17
in which the infobar may be shown.
Sounds a bit c
Greg Billock
2011/10/05 22:45:53
Done.
| |
38 // show the infobar. | |
39 // |registry| is the data source for web intents. | |
40 // |service| is the candidate service to show the infobar for. | |
41 static void MaybeShowIntentInfoBar(InfoBarTabHelper* infobar_helper, | |
42 WebIntentsRegistry* registry, | |
43 const WebIntentServiceData& service); | |
44 | |
33 private: | 45 private: |
34 // The web intents registry to use. Weak pointer. | 46 // The web intents registry to use. Weak pointer. |
35 WebIntentsRegistry* registry_; | 47 WebIntentsRegistry* registry_; |
36 | 48 |
37 // The cached intent data bundle passed up from the renderer. | 49 // The cached intent data bundle passed up from the renderer. |
38 WebIntentServiceData service_; | 50 WebIntentServiceData service_; |
39 | 51 |
40 DISALLOW_COPY_AND_ASSIGN(RegisterIntentHandlerInfoBarDelegate); | 52 DISALLOW_COPY_AND_ASSIGN(RegisterIntentHandlerInfoBarDelegate); |
41 }; | 53 }; |
42 | 54 |
43 #endif // CHROME_BROWSER_INTENTS_REGISTER_INTENT_HANDLER_INFOBAR_DELEGATE_H_ | 55 #endif // CHROME_BROWSER_INTENTS_REGISTER_INTENT_HANDLER_INFOBAR_DELEGATE_H_ |
OLD | NEW |