| 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 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 | 50 |
| 51 // Sets the intent data and return pathway handler object for which | 51 // Sets the intent data and return pathway handler object for which |
| 52 // this picker was created. The picker takes ownership of | 52 // this picker was created. The picker takes ownership of |
| 53 // |intents_dispatcher|. |intents_dispatcher| must not be NULL. | 53 // |intents_dispatcher|. |intents_dispatcher| must not be NULL. |
| 54 void SetIntentsDispatcher(content::WebIntentsDispatcher* intents_dispatcher); | 54 void SetIntentsDispatcher(content::WebIntentsDispatcher* intents_dispatcher); |
| 55 | 55 |
| 56 // 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|. |
| 57 void ShowDialog(const string16& action, | 57 void ShowDialog(const string16& action, |
| 58 const string16& type); | 58 const string16& type); |
| 59 | 59 |
| 60 // Called by the location bar to see whether the web intents picker affordance |
| 61 // should be shown. TODO(gbillock): refactor this into a |
| 62 // LocationBarPageToolModel. |
| 63 bool ShowLocationBarPickerTool(); |
| 64 |
| 60 protected: | 65 protected: |
| 61 // content::NotificationObserver implementation. | 66 // content::NotificationObserver implementation. |
| 62 virtual void Observe(int type, | 67 virtual void Observe(int type, |
| 63 const content::NotificationSource& source, | 68 const content::NotificationSource& source, |
| 64 const content::NotificationDetails& details) OVERRIDE; | 69 const content::NotificationDetails& details) OVERRIDE; |
| 65 | 70 |
| 66 // WebIntentPickerDelegate implementation. | 71 // WebIntentPickerDelegate implementation. |
| 67 virtual void OnServiceChosen(const GURL& url, | 72 virtual void OnServiceChosen(const GURL& url, |
| 68 Disposition disposition) OVERRIDE; | 73 Disposition disposition) OVERRIDE; |
| 69 virtual void OnInlineDispositionWebContentsCreated( | 74 virtual void OnInlineDispositionWebContentsCreated( |
| (...skipping 21 matching lines...) Expand all Loading... |
| 91 void OnSendReturnMessage(webkit_glue::WebIntentReplyType reply_type); | 96 void OnSendReturnMessage(webkit_glue::WebIntentReplyType reply_type); |
| 92 | 97 |
| 93 // Exposed for tests only. | 98 // Exposed for tests only. |
| 94 void set_picker(WebIntentPicker* picker) { picker_ = picker; } | 99 void set_picker(WebIntentPicker* picker) { picker_ = picker; } |
| 95 | 100 |
| 96 // Exposed for tests only. | 101 // Exposed for tests only. |
| 97 void set_model_observer(WebIntentPickerModelObserver* observer) { | 102 void set_model_observer(WebIntentPickerModelObserver* observer) { |
| 98 picker_model_->set_observer(observer); | 103 picker_model_->set_observer(observer); |
| 99 } | 104 } |
| 100 | 105 |
| 106 // Notify the controller that it's TabContents is hosting a web intents |
| 107 // service. |
| 108 void set_window_disposition_target(bool target) { |
| 109 window_disposition_target_ = target; |
| 110 } |
| 111 |
| 101 // Called by the WebIntentsRegistry, returning |services|, which is | 112 // Called by the WebIntentsRegistry, returning |services|, which is |
| 102 // a list of WebIntentServiceData matching the query. | 113 // a list of WebIntentServiceData matching the query. |
| 103 void OnWebIntentServicesAvailable( | 114 void OnWebIntentServicesAvailable( |
| 104 const std::vector<webkit_glue::WebIntentServiceData>& services); | 115 const std::vector<webkit_glue::WebIntentServiceData>& services); |
| 105 | 116 |
| 106 // Called when a default service is returned from the WebIntentsRegistry. | 117 // Called when a default service is returned from the WebIntentsRegistry. |
| 107 // (Still called with default_service.service_url empty if there are no | 118 // (Still called with default_service.service_url empty if there are no |
| 108 // defaults.) | 119 // defaults.) |
| 109 void OnWebIntentDefaultsAvailable( | 120 void OnWebIntentDefaultsAvailable( |
| 110 const DefaultWebIntentService& default_service); | 121 const DefaultWebIntentService& default_service); |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 182 int pending_async_count_; | 193 int pending_async_count_; |
| 183 | 194 |
| 184 // A count of outstanding WebIntentsRegistry calls. | 195 // A count of outstanding WebIntentsRegistry calls. |
| 185 int pending_registry_calls_count_; | 196 int pending_registry_calls_count_; |
| 186 | 197 |
| 187 // Is true if the picker is currently visible. | 198 // Is true if the picker is currently visible. |
| 188 // This bool is not equivalent to picker != NULL in a unit test. In that | 199 // This bool is not equivalent to picker != NULL in a unit test. In that |
| 189 // case, a picker may be non-NULL before it is shown. | 200 // case, a picker may be non-NULL before it is shown. |
| 190 bool picker_shown_; | 201 bool picker_shown_; |
| 191 | 202 |
| 203 // Set to true if the TabContents with which this controller is associated is |
| 204 // hosting a web intents window disposition service. |
| 205 bool window_disposition_target_; |
| 206 |
| 192 // Weak pointer to the routing object for the renderer which launched the | 207 // Weak pointer to the routing object for the renderer which launched the |
| 193 // intent. Contains the intent data and a way to signal back to the | 208 // intent. Contains the intent data and a way to signal back to the |
| 194 // client page. | 209 // client page. |
| 195 content::WebIntentsDispatcher* intents_dispatcher_; | 210 content::WebIntentsDispatcher* intents_dispatcher_; |
| 196 | 211 |
| 197 // Weak pointer to the tab servicing the intent. Remembered in order to | 212 // Weak pointer to the tab servicing the intent. Remembered in order to |
| 198 // close it when a reply is sent. | 213 // close it when a reply is sent. |
| 199 content::WebContents* service_tab_; | 214 content::WebContents* service_tab_; |
| 200 | 215 |
| 201 // Request consumer used when asynchronously loading favicons. | 216 // Request consumer used when asynchronously loading favicons. |
| 202 CancelableRequestConsumerTSimple<size_t> favicon_consumer_; | 217 CancelableRequestConsumerTSimple<size_t> favicon_consumer_; |
| 203 | 218 |
| 204 base::WeakPtrFactory<WebIntentPickerController> weak_ptr_factory_; | 219 base::WeakPtrFactory<WebIntentPickerController> weak_ptr_factory_; |
| 205 | 220 |
| 206 DISALLOW_COPY_AND_ASSIGN(WebIntentPickerController); | 221 DISALLOW_COPY_AND_ASSIGN(WebIntentPickerController); |
| 207 }; | 222 }; |
| 208 | 223 |
| 209 #endif // CHROME_BROWSER_UI_INTENTS_WEB_INTENT_PICKER_CONTROLLER_H_ | 224 #endif // CHROME_BROWSER_UI_INTENTS_WEB_INTENT_PICKER_CONTROLLER_H_ |
| OLD | NEW |