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

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

Issue 8417043: Add webkit_glue namespace. Improve some variable and test names. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix merge error Created 9 years, 1 month 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) 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 #include "chrome/browser/ui/intents/web_intent_picker_controller.h" 5 #include "chrome/browser/ui/intents/web_intent_picker_controller.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 // |action|, |type| pair. 51 // |action|, |type| pair.
52 void Fetch(const string16& action, const string16& type); 52 void Fetch(const string16& action, const string16& type);
53 53
54 // Cancels the WebDataService request. 54 // Cancels the WebDataService request.
55 void Cancel(); 55 void Cancel();
56 56
57 private: 57 private:
58 // WebIntentsRegistry::Consumer implementation. 58 // WebIntentsRegistry::Consumer implementation.
59 virtual void OnIntentsQueryDone( 59 virtual void OnIntentsQueryDone(
60 WebIntentsRegistry::QueryID, 60 WebIntentsRegistry::QueryID,
61 const std::vector<WebIntentServiceData>& intents) OVERRIDE; 61 const std::vector<webkit_glue::WebIntentServiceData>& services) OVERRIDE;
62 62
63 // A weak pointer to the picker controller. 63 // A weak pointer to the picker controller.
64 WebIntentPickerController* controller_; 64 WebIntentPickerController* controller_;
65 65
66 // A weak pointer to the web intents registry. 66 // A weak pointer to the web intents registry.
67 WebIntentsRegistry* web_intents_registry_; 67 WebIntentsRegistry* web_intents_registry_;
68 68
69 // The ID of the current web intents request. The value will be -1 if 69 // The ID of the current web intents request. The value will be -1 if
70 // there is no request in flight. 70 // there is no request in flight.
71 WebIntentsRegistry::QueryID query_id_; 71 WebIntentsRegistry::QueryID query_id_;
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 } 222 }
223 223
224 void WebIntentPickerController::OnCancelled() { 224 void WebIntentPickerController::OnCancelled() {
225 InvokingTabObserver forwarder(wrapper_, NULL, routing_id_); 225 InvokingTabObserver forwarder(wrapper_, NULL, routing_id_);
226 forwarder.Send(new IntentsMsg_WebIntentReply( 226 forwarder.Send(new IntentsMsg_WebIntentReply(
227 0, webkit_glue::WEB_INTENT_PICKER_CANCELLED, string16(), intent_id_)); 227 0, webkit_glue::WEB_INTENT_PICKER_CANCELLED, string16(), intent_id_));
228 ClosePicker(); 228 ClosePicker();
229 } 229 }
230 230
231 void WebIntentPickerController::OnWebIntentDataAvailable( 231 void WebIntentPickerController::OnWebIntentDataAvailable(
232 const std::vector<WebIntentServiceData>& intent_data) { 232 const std::vector<webkit_glue::WebIntentServiceData>& services) {
233 urls_.clear(); 233 urls_.clear();
234 for (size_t i = 0; i < intent_data.size(); ++i) { 234 for (size_t i = 0; i < services.size(); ++i) {
235 urls_.push_back(intent_data[i].service_url); 235 urls_.push_back(services[i].service_url);
236 } 236 }
237 237
238 // Tell the picker to initialize N urls to the default favicon 238 // Tell the picker to initialize N urls to the default favicon
239 picker_->SetServiceURLs(urls_); 239 picker_->SetServiceURLs(urls_);
240 favicon_fetcher_->Fetch(urls_); 240 favicon_fetcher_->Fetch(urls_);
241 pending_async_count_--; 241 pending_async_count_--;
242 } 242 }
243 243
244 void WebIntentPickerController::OnFaviconDataAvailable( 244 void WebIntentPickerController::OnFaviconDataAvailable(
245 size_t index, 245 size_t index,
(...skipping 28 matching lines...) Expand all
274 void WebIntentPickerController::WebIntentDataFetcher::Fetch( 274 void WebIntentPickerController::WebIntentDataFetcher::Fetch(
275 const string16& action, 275 const string16& action,
276 const string16& type) { 276 const string16& type) {
277 DCHECK(query_id_ == -1) << "Fetch already in process."; 277 DCHECK(query_id_ == -1) << "Fetch already in process.";
278 controller_->pending_async_count_++; 278 controller_->pending_async_count_++;
279 query_id_ = web_intents_registry_->GetIntentProviders(action, type, this); 279 query_id_ = web_intents_registry_->GetIntentProviders(action, type, this);
280 } 280 }
281 281
282 void WebIntentPickerController::WebIntentDataFetcher::OnIntentsQueryDone( 282 void WebIntentPickerController::WebIntentDataFetcher::OnIntentsQueryDone(
283 WebIntentsRegistry::QueryID, 283 WebIntentsRegistry::QueryID,
284 const std::vector<WebIntentServiceData>& intents) { 284 const std::vector<webkit_glue::WebIntentServiceData>& services) {
285 controller_->OnWebIntentDataAvailable(intents); 285 controller_->OnWebIntentDataAvailable(services);
286 query_id_ = -1; 286 query_id_ = -1;
287 } 287 }
288 288
289 WebIntentPickerController::FaviconFetcher::FaviconFetcher( 289 WebIntentPickerController::FaviconFetcher::FaviconFetcher(
290 WebIntentPickerController* controller, 290 WebIntentPickerController* controller,
291 FaviconService* favicon_service) 291 FaviconService* favicon_service)
292 : controller_(controller), 292 : controller_(controller),
293 favicon_service_(favicon_service) { 293 favicon_service_(favicon_service) {
294 } 294 }
295 295
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
328 if (gfx::PNGCodec::Decode(favicon_data.image_data->front(), 328 if (gfx::PNGCodec::Decode(favicon_data.image_data->front(),
329 favicon_data.image_data->size(), 329 favicon_data.image_data->size(),
330 &icon_bitmap)) { 330 &icon_bitmap)) {
331 controller_->OnFaviconDataAvailable(index, icon_bitmap); 331 controller_->OnFaviconDataAvailable(index, icon_bitmap);
332 return; 332 return;
333 } 333 }
334 } 334 }
335 335
336 controller_->OnFaviconDataUnavailable(index); 336 controller_->OnFaviconDataUnavailable(index);
337 } 337 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698