Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(130)

Side by Side Diff: chrome/browser/ui/intents/web_intent_picker_controller.h

Issue 10204010: Handling default service in the web intents picker controller. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 97
98 // Exposed for tests only. 98 // Exposed for tests only.
99 void set_model_observer(WebIntentPickerModelObserver* observer) { 99 void set_model_observer(WebIntentPickerModelObserver* observer) {
100 picker_model_->set_observer(observer); 100 picker_model_->set_observer(observer);
101 } 101 }
102 102
103 // Called when WebIntentServiceData is returned from the WebIntentsRegistry. 103 // Called when WebIntentServiceData is returned from the WebIntentsRegistry.
104 void OnWebIntentServicesAvailable( 104 void OnWebIntentServicesAvailable(
105 const std::vector<webkit_glue::WebIntentServiceData>& services); 105 const std::vector<webkit_glue::WebIntentServiceData>& services);
106 106
107 // Called when a default service is returned from the WebIntentsRegistry.
108 // (Still called with default_service.service_url empty if there are no
109 // defaults.)
110 void OnWebIntentDefaultsAvailable(
111 const DefaultWebIntentService& default_service);
112
113 // Coordination method which is delegated to by the registry calls to get
114 // services and defaults.
115 void RegistryCallsCompleted();
groby-ooo-7-16 2012/04/24 21:36:51 That's a rather vague description :)
Greg Billock 2012/04/25 16:04:32 improved. On 2012/04/24 21:36:51, groby wrote:
116
117 // Bottom half for dispatching explicit intents. Receives WebIntentServiceData
118 // from the WebIntentsRegistry to check for known urls/extensions and find
119 // disposition data.
120 void WebIntentServicesForExplicitIntent(
121 const std::vector<webkit_glue::WebIntentServiceData>& services);
122
107 // Called when FaviconData is returned from the FaviconService. 123 // Called when FaviconData is returned from the FaviconService.
108 void OnFaviconDataAvailable(FaviconService::Handle handle, 124 void OnFaviconDataAvailable(FaviconService::Handle handle,
109 history::FaviconData favicon_data); 125 history::FaviconData favicon_data);
110 126
111 // Called when IntentExtensionInfo is returned from the CWSIntentsRegistry. 127 // Called when IntentExtensionInfo is returned from the CWSIntentsRegistry.
112 void OnCWSIntentServicesAvailable( 128 void OnCWSIntentServicesAvailable(
113 const CWSIntentsRegistry::IntentExtensionList& extensions); 129 const CWSIntentsRegistry::IntentExtensionList& extensions);
114 130
115 // Called when a suggested extension's icon is fetched. 131 // Called when a suggested extension's icon is fetched.
116 void OnExtensionIconURLFetchComplete(const string16& extension_id, 132 void OnExtensionIconURLFetchComplete(const string16& extension_id,
(...skipping 17 matching lines...) Expand all
134 // When an extension is installed, all that is known is the extension id. 150 // When an extension is installed, all that is known is the extension id.
135 // This callback receives the intent service data for that extension. 151 // This callback receives the intent service data for that extension.
136 // |services| must be a non-empty list. 152 // |services| must be a non-empty list.
137 void OnExtensionInstallServiceAvailable( 153 void OnExtensionInstallServiceAvailable(
138 const std::vector<webkit_glue::WebIntentServiceData>& services); 154 const std::vector<webkit_glue::WebIntentServiceData>& services);
139 155
140 // Decrements the |pending_async_count_| and notifies the picker if it 156 // Decrements the |pending_async_count_| and notifies the picker if it
141 // reaches zero. 157 // reaches zero.
142 void AsyncOperationFinished(); 158 void AsyncOperationFinished();
143 159
160 // If the picker dialog UI surface needs to be created, this creates it.
161 void CreatePicker();
groby-ooo-7-16 2012/04/24 21:36:51 "Helper to create picker dialog UI" is probably en
Greg Billock 2012/04/25 16:04:32 Done.
162
144 // Closes the currently active picker. 163 // Closes the currently active picker.
145 void ClosePicker(); 164 void ClosePicker();
146 165
147 // A weak pointer to the tab contents that the picker is displayed on. 166 // A weak pointer to the tab contents that the picker is displayed on.
148 TabContentsWrapper* wrapper_; 167 TabContentsWrapper* wrapper_;
149 168
150 // A notification registrar, listening for notifications when the tab closes 169 // A notification registrar, listening for notifications when the tab closes
151 // to close the picker ui. 170 // to close the picker ui.
152 content::NotificationRegistrar registrar_; 171 content::NotificationRegistrar registrar_;
153 172
154 // A weak pointer to the picker this controller controls. 173 // A weak pointer to the picker this controller controls.
155 WebIntentPicker* picker_; 174 WebIntentPicker* picker_;
156 175
157 // The model for the picker. Owned by this controller. It should not be NULL 176 // The model for the picker. Owned by this controller. It should not be NULL
158 // while this controller exists, even if the picker is not shown. 177 // while this controller exists, even if the picker is not shown.
159 scoped_ptr<WebIntentPickerModel> picker_model_; 178 scoped_ptr<WebIntentPickerModel> picker_model_;
160 179
161 // A count of the outstanding asynchronous calls. 180 // A count of the outstanding asynchronous calls.
162 int pending_async_count_; 181 int pending_async_count_;
163 182
183 // A count of outstanding WebIntentsRegistry calls.
184 int pending_registry_calls_count_;
185
164 // Is true if the picker is currently visible. 186 // Is true if the picker is currently visible.
165 // This bool is not equivalent to picker != NULL in a unit test. In that 187 // This bool is not equivalent to picker != NULL in a unit test. In that
166 // case, a picker may be non-NULL before it is shown. 188 // case, a picker may be non-NULL before it is shown.
167 bool picker_shown_; 189 bool picker_shown_;
168 190
191 // Will be set to the non-empty url of the default service if the
192 // WebIntentsRegistry finds a default service matching the intent being
193 // dispatched.
194 std::string default_service_url_;
groby-ooo-7-16 2012/04/24 21:36:51 Doesn't that belong on the model?
Greg Billock 2012/04/25 16:04:32 Yeah, you're right. It has "action" too. Rejiggeri
195
169 // Weak pointer to the routing object for the renderer which launched the 196 // Weak pointer to the routing object for the renderer which launched the
170 // intent. Contains the intent data and a way to signal back to the 197 // intent. Contains the intent data and a way to signal back to the
171 // client page. 198 // client page.
172 content::WebIntentsDispatcher* intents_dispatcher_; 199 content::WebIntentsDispatcher* intents_dispatcher_;
173 200
174 // Weak pointer to the tab servicing the intent. Remembered in order to 201 // Weak pointer to the tab servicing the intent. Remembered in order to
175 // close it when a reply is sent. 202 // close it when a reply is sent.
176 content::WebContents* service_tab_; 203 content::WebContents* service_tab_;
177 204
205 // The browser in which the intent was invoked.
206 Browser* browser_;
groby-ooo-7-16 2012/04/24 21:36:51 That's available from the TabContentsWrapper, IIRC
Greg Billock 2012/04/25 16:04:32 Yes, we're currently using static methods to look
207
208 // The intent action the picker is handling.
209 string16 action_;
groby-ooo-7-16 2012/04/24 21:36:51 Do we have to store that here? Can't we query the
Greg Billock 2012/04/25 16:04:32 This is stored from ShowDialog, where now we don't
210
178 // Request consumer used when asynchronously loading favicons. 211 // Request consumer used when asynchronously loading favicons.
179 CancelableRequestConsumerTSimple<size_t> favicon_consumer_; 212 CancelableRequestConsumerTSimple<size_t> favicon_consumer_;
180 213
181 base::WeakPtrFactory<WebIntentPickerController> weak_ptr_factory_; 214 base::WeakPtrFactory<WebIntentPickerController> weak_ptr_factory_;
182 215
183 DISALLOW_COPY_AND_ASSIGN(WebIntentPickerController); 216 DISALLOW_COPY_AND_ASSIGN(WebIntentPickerController);
184 }; 217 };
185 218
186 #endif // CHROME_BROWSER_UI_INTENTS_WEB_INTENT_PICKER_CONTROLLER_H_ 219 #endif // CHROME_BROWSER_UI_INTENTS_WEB_INTENT_PICKER_CONTROLLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698