| 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" |
| (...skipping 527 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 538 } | 538 } |
| 539 | 539 |
| 540 CreatePicker(); | 540 CreatePicker(); |
| 541 picker_->SetActionString(GetIntentActionString( | 541 picker_->SetActionString(GetIntentActionString( |
| 542 UTF16ToUTF8(picker_model_->action()))); | 542 UTF16ToUTF8(picker_model_->action()))); |
| 543 } | 543 } |
| 544 | 544 |
| 545 void WebIntentPickerController::OnFaviconDataAvailable( | 545 void WebIntentPickerController::OnFaviconDataAvailable( |
| 546 FaviconService::Handle handle, history::FaviconData favicon_data) { | 546 FaviconService::Handle handle, history::FaviconData favicon_data) { |
| 547 size_t index = favicon_consumer_.GetClientDataForCurrentRequest(); | 547 size_t index = favicon_consumer_.GetClientDataForCurrentRequest(); |
| 548 if (favicon_data.is_valid()) { | 548 if (favicon_data.is_valid() && favicon_data.variants.size() > 0) { |
| 549 SkBitmap icon_bitmap; | 549 SkBitmap icon_bitmap; |
| 550 | 550 |
| 551 if (gfx::PNGCodec::Decode(favicon_data.bitmap_data->front(), | 551 if (gfx::PNGCodec::Decode(favicon_data.variants[0].bitmap_data->front(), |
| 552 favicon_data.bitmap_data->size(), | 552 favicon_data.variants[0].bitmap_data->size(), |
| 553 &icon_bitmap)) { | 553 &icon_bitmap)) { |
| 554 gfx::Image icon_image(icon_bitmap); | 554 gfx::Image icon_image(icon_bitmap); |
| 555 picker_model_->UpdateFaviconAt(index, icon_image); | 555 picker_model_->UpdateFaviconAt(index, icon_image); |
| 556 return; | 556 return; |
| 557 } | 557 } |
| 558 } | 558 } |
| 559 | 559 |
| 560 AsyncOperationFinished(); | 560 AsyncOperationFinished(); |
| 561 } | 561 } |
| 562 | 562 |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 709 // If picker is non-NULL, it was set by a test. | 709 // If picker is non-NULL, it was set by a test. |
| 710 if (picker_ == NULL) | 710 if (picker_ == NULL) |
| 711 picker_ = WebIntentPicker::Create(tab_contents_, this, picker_model_.get()); | 711 picker_ = WebIntentPicker::Create(tab_contents_, this, picker_model_.get()); |
| 712 picker_shown_ = true; | 712 picker_shown_ = true; |
| 713 } | 713 } |
| 714 | 714 |
| 715 void WebIntentPickerController::ClosePicker() { | 715 void WebIntentPickerController::ClosePicker() { |
| 716 if (picker_) | 716 if (picker_) |
| 717 picker_->Close(); | 717 picker_->Close(); |
| 718 } | 718 } |
| OLD | NEW |