| 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 #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" |
| 11 #include "chrome/browser/ui/browser.h" | 11 #include "chrome/browser/ui/browser.h" |
| 12 #include "chrome/browser/favicon/favicon_service.h" | 12 #include "chrome/browser/favicon/favicon_service.h" |
| 13 #include "chrome/browser/intents/default_web_intent_service.h" |
| 13 #include "chrome/browser/intents/web_intents_registry_factory.h" | 14 #include "chrome/browser/intents/web_intents_registry_factory.h" |
| 14 #include "chrome/browser/intents/cws_intents_registry_factory.h" | 15 #include "chrome/browser/intents/cws_intents_registry_factory.h" |
| 15 #include "chrome/browser/profiles/profile.h" | 16 #include "chrome/browser/profiles/profile.h" |
| 16 #include "chrome/browser/tab_contents/tab_util.h" | 17 #include "chrome/browser/tab_contents/tab_util.h" |
| 17 #include "chrome/browser/tabs/tab_strip_model.h" | 18 #include "chrome/browser/tabs/tab_strip_model.h" |
| 18 #include "chrome/browser/ui/browser_list.h" | 19 #include "chrome/browser/ui/browser_list.h" |
| 19 #include "chrome/browser/ui/browser_navigator.h" | 20 #include "chrome/browser/ui/browser_navigator.h" |
| 20 #include "chrome/browser/ui/intents/web_intent_picker.h" | 21 #include "chrome/browser/ui/intents/web_intent_picker.h" |
| 21 #include "chrome/browser/ui/intents/web_intent_picker_model.h" | 22 #include "chrome/browser/ui/intents/web_intent_picker_model.h" |
| 22 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 23 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
| (...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 258 &favicon_consumer_, | 259 &favicon_consumer_, |
| 259 base::Bind( | 260 base::Bind( |
| 260 &WebIntentPickerController::OnFaviconDataAvailable, | 261 &WebIntentPickerController::OnFaviconDataAvailable, |
| 261 weak_ptr_factory_.GetWeakPtr())); | 262 weak_ptr_factory_.GetWeakPtr())); |
| 262 favicon_consumer_.SetClientData(favicon_service, handle, i); | 263 favicon_consumer_.SetClientData(favicon_service, handle, i); |
| 263 } | 264 } |
| 264 | 265 |
| 265 AsyncOperationFinished(); | 266 AsyncOperationFinished(); |
| 266 } | 267 } |
| 267 | 268 |
| 269 void WebIntentPickerController::OnIntentsDefaultsQueryDone( |
| 270 WebIntentsRegistry::QueryID, |
| 271 const DefaultWebIntentService& default_service) { |
| 272 } |
| 273 |
| 268 void WebIntentPickerController::OnFaviconDataAvailable( | 274 void WebIntentPickerController::OnFaviconDataAvailable( |
| 269 FaviconService::Handle handle, history::FaviconData favicon_data) { | 275 FaviconService::Handle handle, history::FaviconData favicon_data) { |
| 270 size_t index = favicon_consumer_.GetClientDataForCurrentRequest(); | 276 size_t index = favicon_consumer_.GetClientDataForCurrentRequest(); |
| 271 if (favicon_data.is_valid()) { | 277 if (favicon_data.is_valid()) { |
| 272 SkBitmap icon_bitmap; | 278 SkBitmap icon_bitmap; |
| 273 | 279 |
| 274 if (gfx::PNGCodec::Decode(favicon_data.image_data->front(), | 280 if (gfx::PNGCodec::Decode(favicon_data.image_data->front(), |
| 275 favicon_data.image_data->size(), | 281 favicon_data.image_data->size(), |
| 276 &icon_bitmap)) { | 282 &icon_bitmap)) { |
| 277 gfx::Image icon_image(new SkBitmap(icon_bitmap)); | 283 gfx::Image icon_image(new SkBitmap(icon_bitmap)); |
| (...skipping 24 matching lines...) Expand all Loading... |
| 302 if (--pending_async_count_ == 0) { | 308 if (--pending_async_count_ == 0) { |
| 303 picker_->OnPendingAsyncCompleted(); | 309 picker_->OnPendingAsyncCompleted(); |
| 304 } | 310 } |
| 305 } | 311 } |
| 306 | 312 |
| 307 void WebIntentPickerController::ClosePicker() { | 313 void WebIntentPickerController::ClosePicker() { |
| 308 if (picker_) { | 314 if (picker_) { |
| 309 picker_->Close(); | 315 picker_->Close(); |
| 310 } | 316 } |
| 311 } | 317 } |
| OLD | NEW |