| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_UI_INTENTS_WEB_INTENT_PICKER_CONTROLLER_H_ | 5 #ifndef CHROME_BROWSER_UI_INTENTS_WEB_INTENT_PICKER_CONTROLLER_H_ |
| 6 #define CHROME_BROWSER_UI_INTENTS_WEB_INTENT_PICKER_CONTROLLER_H_ | 6 #define CHROME_BROWSER_UI_INTENTS_WEB_INTENT_PICKER_CONTROLLER_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
| 12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
| 13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
| 14 #include "base/memory/weak_ptr.h" | 14 #include "base/memory/weak_ptr.h" |
| 15 #include "base/string16.h" | 15 #include "base/string16.h" |
| 16 #include "chrome/browser/extensions/webstore_installer.h" | 16 #include "chrome/browser/extensions/webstore_installer.h" |
| 17 #include "chrome/browser/favicon/favicon_service.h" | 17 #include "chrome/browser/favicon/favicon_service.h" |
| 18 #include "chrome/browser/intents/cws_intents_registry.h" | 18 #include "chrome/browser/intents/cws_intents_registry.h" |
| 19 #include "chrome/browser/intents/web_intents_registry.h" | 19 #include "chrome/browser/intents/web_intents_registry.h" |
| 20 #include "chrome/browser/ui/intents/web_intent_picker_delegate.h" | 20 #include "chrome/browser/ui/intents/web_intent_picker_delegate.h" |
| 21 #include "content/public/browser/notification_observer.h" | 21 #include "content/public/browser/notification_observer.h" |
| 22 #include "content/public/browser/notification_registrar.h" | 22 #include "content/public/browser/notification_registrar.h" |
| 23 #include "webkit/glue/web_intent_data.h" | 23 #include "webkit/glue/web_intent_data.h" |
| 24 #include "webkit/glue/web_intent_reply_data.h" | 24 #include "webkit/glue/web_intent_reply_data.h" |
| 25 | 25 |
| 26 class Browser; | 26 class Browser; |
| 27 struct DefaultWebIntentService; | 27 struct DefaultWebIntentService; |
| 28 class GURL; | 28 class GURL; |
| 29 class TabContents; | 29 class TabContents; |
| 30 typedef TabContents TabContentsWrapper; | |
| 31 class WebIntentPicker; | 30 class WebIntentPicker; |
| 32 class WebIntentPickerModel; | 31 class WebIntentPickerModel; |
| 33 | 32 |
| 34 namespace content { | 33 namespace content { |
| 35 class WebContents; | 34 class WebContents; |
| 36 class WebIntentsDispatcher; | 35 class WebIntentsDispatcher; |
| 37 } | 36 } |
| 38 | 37 |
| 39 namespace webkit_glue { | 38 namespace webkit_glue { |
| 40 struct WebIntentServiceData; | 39 struct WebIntentServiceData; |
| 41 } | 40 } |
| 42 | 41 |
| 43 // Controls the creation of the WebIntentPicker UI and forwards the user's | 42 // Controls the creation of the WebIntentPicker UI and forwards the user's |
| 44 // intent handler choice back to the WebContents object. | 43 // intent handler choice back to the WebContents object. |
| 45 class WebIntentPickerController : public content::NotificationObserver, | 44 class WebIntentPickerController : public content::NotificationObserver, |
| 46 public WebIntentPickerDelegate, | 45 public WebIntentPickerDelegate, |
| 47 public WebstoreInstaller::Delegate { | 46 public WebstoreInstaller::Delegate { |
| 48 public: | 47 public: |
| 49 explicit WebIntentPickerController(TabContentsWrapper* wrapper); | 48 explicit WebIntentPickerController(TabContents* tab_contents); |
| 50 virtual ~WebIntentPickerController(); | 49 virtual ~WebIntentPickerController(); |
| 51 | 50 |
| 52 // Sets the intent data and return pathway handler object for which | 51 // Sets the intent data and return pathway handler object for which |
| 53 // this picker was created. The picker takes ownership of | 52 // this picker was created. The picker takes ownership of |
| 54 // |intents_dispatcher|. |intents_dispatcher| must not be NULL. | 53 // |intents_dispatcher|. |intents_dispatcher| must not be NULL. |
| 55 void SetIntentsDispatcher(content::WebIntentsDispatcher* intents_dispatcher); | 54 void SetIntentsDispatcher(content::WebIntentsDispatcher* intents_dispatcher); |
| 56 | 55 |
| 57 // Shows the web intent picker given the intent |action| and MIME-type |type|. | 56 // Shows the web intent picker given the intent |action| and MIME-type |type|. |
| 58 void ShowDialog(const string16& action, | 57 void ShowDialog(const string16& action, |
| 59 const string16& type); | 58 const string16& type); |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 159 // reaches zero. | 158 // reaches zero. |
| 160 void AsyncOperationFinished(); | 159 void AsyncOperationFinished(); |
| 161 | 160 |
| 162 // Helper to create picker dialog UI. | 161 // Helper to create picker dialog UI. |
| 163 void CreatePicker(); | 162 void CreatePicker(); |
| 164 | 163 |
| 165 // Closes the currently active picker. | 164 // Closes the currently active picker. |
| 166 void ClosePicker(); | 165 void ClosePicker(); |
| 167 | 166 |
| 168 // A weak pointer to the tab contents that the picker is displayed on. | 167 // A weak pointer to the tab contents that the picker is displayed on. |
| 169 TabContentsWrapper* wrapper_; | 168 TabContents* tab_contents_; |
| 170 | 169 |
| 171 // A notification registrar, listening for notifications when the tab closes | 170 // A notification registrar, listening for notifications when the tab closes |
| 172 // to close the picker ui. | 171 // to close the picker ui. |
| 173 content::NotificationRegistrar registrar_; | 172 content::NotificationRegistrar registrar_; |
| 174 | 173 |
| 175 // A weak pointer to the picker this controller controls. | 174 // A weak pointer to the picker this controller controls. |
| 176 WebIntentPicker* picker_; | 175 WebIntentPicker* picker_; |
| 177 | 176 |
| 178 // The model for the picker. Owned by this controller. It should not be NULL | 177 // The model for the picker. Owned by this controller. It should not be NULL |
| 179 // while this controller exists, even if the picker is not shown. | 178 // while this controller exists, even if the picker is not shown. |
| (...skipping 21 matching lines...) Expand all Loading... |
| 201 | 200 |
| 202 // Request consumer used when asynchronously loading favicons. | 201 // Request consumer used when asynchronously loading favicons. |
| 203 CancelableRequestConsumerTSimple<size_t> favicon_consumer_; | 202 CancelableRequestConsumerTSimple<size_t> favicon_consumer_; |
| 204 | 203 |
| 205 base::WeakPtrFactory<WebIntentPickerController> weak_ptr_factory_; | 204 base::WeakPtrFactory<WebIntentPickerController> weak_ptr_factory_; |
| 206 | 205 |
| 207 DISALLOW_COPY_AND_ASSIGN(WebIntentPickerController); | 206 DISALLOW_COPY_AND_ASSIGN(WebIntentPickerController); |
| 208 }; | 207 }; |
| 209 | 208 |
| 210 #endif // CHROME_BROWSER_UI_INTENTS_WEB_INTENT_PICKER_CONTROLLER_H_ | 209 #endif // CHROME_BROWSER_UI_INTENTS_WEB_INTENT_PICKER_CONTROLLER_H_ |
| OLD | NEW |