| 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 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 254 &favicon_consumer_, | 255 &favicon_consumer_, |
| 255 base::Bind( | 256 base::Bind( |
| 256 &WebIntentPickerController::OnFaviconDataAvailable, | 257 &WebIntentPickerController::OnFaviconDataAvailable, |
| 257 weak_ptr_factory_.GetWeakPtr())); | 258 weak_ptr_factory_.GetWeakPtr())); |
| 258 favicon_consumer_.SetClientData(favicon_service, handle, i); | 259 favicon_consumer_.SetClientData(favicon_service, handle, i); |
| 259 } | 260 } |
| 260 | 261 |
| 261 AsyncOperationFinished(); | 262 AsyncOperationFinished(); |
| 262 } | 263 } |
| 263 | 264 |
| 265 void WebIntentPickerController::OnIntentsDefaultsQueryDone( |
| 266 WebIntentsRegistry::QueryID, |
| 267 const DefaultWebIntentService& default_service) { |
| 268 } |
| 269 |
| 264 void WebIntentPickerController::OnFaviconDataAvailable( | 270 void WebIntentPickerController::OnFaviconDataAvailable( |
| 265 FaviconService::Handle handle, history::FaviconData favicon_data) { | 271 FaviconService::Handle handle, history::FaviconData favicon_data) { |
| 266 size_t index = favicon_consumer_.GetClientDataForCurrentRequest(); | 272 size_t index = favicon_consumer_.GetClientDataForCurrentRequest(); |
| 267 if (favicon_data.is_valid()) { | 273 if (favicon_data.is_valid()) { |
| 268 SkBitmap icon_bitmap; | 274 SkBitmap icon_bitmap; |
| 269 | 275 |
| 270 if (gfx::PNGCodec::Decode(favicon_data.image_data->front(), | 276 if (gfx::PNGCodec::Decode(favicon_data.image_data->front(), |
| 271 favicon_data.image_data->size(), | 277 favicon_data.image_data->size(), |
| 272 &icon_bitmap)) { | 278 &icon_bitmap)) { |
| 273 gfx::Image icon_image(new SkBitmap(icon_bitmap)); | 279 gfx::Image icon_image(new SkBitmap(icon_bitmap)); |
| (...skipping 24 matching lines...) Expand all Loading... |
| 298 if (--pending_async_count_ == 0) { | 304 if (--pending_async_count_ == 0) { |
| 299 picker_->OnPendingAsyncCompleted(); | 305 picker_->OnPendingAsyncCompleted(); |
| 300 } | 306 } |
| 301 } | 307 } |
| 302 | 308 |
| 303 void WebIntentPickerController::ClosePicker() { | 309 void WebIntentPickerController::ClosePicker() { |
| 304 if (picker_) { | 310 if (picker_) { |
| 305 picker_->Close(); | 311 picker_->Close(); |
| 306 } | 312 } |
| 307 } | 313 } |
| OLD | NEW |