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