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 InfoBarTabHelper; |
15 class WebIntentsRegistry; | 15 class WebIntentsRegistry; |
| 16 class FaviconService; |
| 17 class GURL; |
16 | 18 |
17 // The InfoBar used to request permission for a site to be registered as an | 19 // The InfoBar used to request permission for a site to be registered as an |
18 // Intent handler. | 20 // Intent handler. |
19 class RegisterIntentHandlerInfoBarDelegate : public ConfirmInfoBarDelegate { | 21 class RegisterIntentHandlerInfoBarDelegate : public ConfirmInfoBarDelegate { |
20 public: | 22 public: |
21 RegisterIntentHandlerInfoBarDelegate( | 23 RegisterIntentHandlerInfoBarDelegate( |
22 InfoBarTabHelper* infobar_helper, | 24 InfoBarTabHelper* infobar_helper, |
23 WebIntentsRegistry* registry, | 25 WebIntentsRegistry* registry, |
24 const webkit_glue::WebIntentServiceData& service); | 26 const webkit_glue::WebIntentServiceData& service, |
| 27 FaviconService* favicon_service, |
| 28 const GURL& origin_url); |
25 | 29 |
26 // ConfirmInfoBarDelegate implementation. | 30 // ConfirmInfoBarDelegate implementation. |
27 virtual Type GetInfoBarType() const OVERRIDE; | 31 virtual Type GetInfoBarType() const OVERRIDE; |
28 virtual string16 GetMessageText() const OVERRIDE; | 32 virtual string16 GetMessageText() const OVERRIDE; |
29 virtual string16 GetButtonLabel(InfoBarButton button) const OVERRIDE; | 33 virtual string16 GetButtonLabel(InfoBarButton button) const OVERRIDE; |
30 virtual bool Accept() OVERRIDE; | 34 virtual bool Accept() OVERRIDE; |
31 virtual string16 GetLinkText() const OVERRIDE; | 35 virtual string16 GetLinkText() const OVERRIDE; |
32 virtual bool LinkClicked(WindowOpenDisposition disposition) OVERRIDE; | 36 virtual bool LinkClicked(WindowOpenDisposition disposition) OVERRIDE; |
33 | 37 |
34 // Shows the intent registration infobar if |service| has not already been | 38 // Shows the intent registration infobar if |service| has not already been |
35 // registered. | 39 // registered. |
36 // |infobar_helper| is the infobar controller for the tab in which the infobar | 40 // |infobar_helper| is the infobar controller for the tab in which the infobar |
37 // may be shown. Must not be NULL. | 41 // may be shown. Must not be NULL. |
38 // |registry| is the data source for web intents. Must not be NULL. | 42 // |registry| is the data source for web intents. Must not be NULL. |
39 // |service| is the candidate service to show the infobar for. | 43 // |service| is the candidate service to show the infobar for. |
| 44 // |favicon_service| is the favicon service to use. Must not be NULL. |
| 45 // |origin_url| is the URL that the intent is registered from. |
40 static void MaybeShowIntentInfoBar( | 46 static void MaybeShowIntentInfoBar( |
41 InfoBarTabHelper* infobar_helper, | 47 InfoBarTabHelper* infobar_helper, |
42 WebIntentsRegistry* registry, | 48 WebIntentsRegistry* registry, |
43 const webkit_glue::WebIntentServiceData& service); | 49 const webkit_glue::WebIntentServiceData& service, |
| 50 FaviconService* favicon_service, |
| 51 const GURL& origin_url); |
44 | 52 |
45 private: | 53 private: |
46 // The web intents registry to use. Weak pointer. | 54 // The web intents registry to use. Weak pointer. |
47 WebIntentsRegistry* registry_; | 55 WebIntentsRegistry* registry_; |
48 | 56 |
49 // The cached intent service data bundle passed up from the renderer. | 57 // The cached intent service data bundle passed up from the renderer. |
50 webkit_glue::WebIntentServiceData service_; | 58 webkit_glue::WebIntentServiceData service_; |
51 | 59 |
| 60 // The favicon service to use. Weak pointer. |
| 61 FaviconService* favicon_service_; |
| 62 |
| 63 // The URL of the page the service was originally registered from. |
| 64 GURL origin_url_; |
| 65 |
52 DISALLOW_COPY_AND_ASSIGN(RegisterIntentHandlerInfoBarDelegate); | 66 DISALLOW_COPY_AND_ASSIGN(RegisterIntentHandlerInfoBarDelegate); |
53 }; | 67 }; |
54 | 68 |
55 #endif // CHROME_BROWSER_INTENTS_REGISTER_INTENT_HANDLER_INFOBAR_DELEGATE_H_ | 69 #endif // CHROME_BROWSER_INTENTS_REGISTER_INTENT_HANDLER_INFOBAR_DELEGATE_H_ |
OLD | NEW |