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

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

Issue 10378009: Get rid of Image::Image(SkBitmap*) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 7 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 #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 436 matching lines...) Expand 10 before | Expand all | Expand 10 after
447 447
448 void WebIntentPickerController::OnFaviconDataAvailable( 448 void WebIntentPickerController::OnFaviconDataAvailable(
449 FaviconService::Handle handle, history::FaviconData favicon_data) { 449 FaviconService::Handle handle, history::FaviconData favicon_data) {
450 size_t index = favicon_consumer_.GetClientDataForCurrentRequest(); 450 size_t index = favicon_consumer_.GetClientDataForCurrentRequest();
451 if (favicon_data.is_valid()) { 451 if (favicon_data.is_valid()) {
452 SkBitmap icon_bitmap; 452 SkBitmap icon_bitmap;
453 453
454 if (gfx::PNGCodec::Decode(favicon_data.image_data->front(), 454 if (gfx::PNGCodec::Decode(favicon_data.image_data->front(),
455 favicon_data.image_data->size(), 455 favicon_data.image_data->size(),
456 &icon_bitmap)) { 456 &icon_bitmap)) {
457 gfx::Image icon_image(new SkBitmap(icon_bitmap)); 457 gfx::Image icon_image(icon_bitmap);
458 picker_model_->UpdateFaviconAt(index, icon_image); 458 picker_model_->UpdateFaviconAt(index, icon_image);
459 return; 459 return;
460 } 460 }
461 } 461 }
462 462
463 AsyncOperationFinished(); 463 AsyncOperationFinished();
464 } 464 }
465 465
466 void WebIntentPickerController::OnCWSIntentServicesAvailable( 466 void WebIntentPickerController::OnCWSIntentServicesAvailable(
467 const CWSIntentsRegistry::IntentExtensionList& extensions) { 467 const CWSIntentsRegistry::IntentExtensionList& extensions) {
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
551 const base::Closure& unavailable_callback) { 551 const base::Closure& unavailable_callback) {
552 SkBitmap icon_bitmap; 552 SkBitmap icon_bitmap;
553 if (gfx::PNGCodec::Decode( 553 if (gfx::PNGCodec::Decode(
554 reinterpret_cast<const unsigned char*>(icon_response->data()), 554 reinterpret_cast<const unsigned char*>(icon_response->data()),
555 icon_response->length(), 555 icon_response->length(),
556 &icon_bitmap)) { 556 &icon_bitmap)) {
557 SkBitmap resized_icon = skia::ImageOperations::Resize( 557 SkBitmap resized_icon = skia::ImageOperations::Resize(
558 icon_bitmap, 558 icon_bitmap,
559 skia::ImageOperations::RESIZE_BEST, 559 skia::ImageOperations::RESIZE_BEST,
560 gfx::kFaviconSize, gfx::kFaviconSize); 560 gfx::kFaviconSize, gfx::kFaviconSize);
561 gfx::Image icon_image(new SkBitmap(resized_icon)); 561 gfx::Image icon_image(resized_icon);
562 562
563 content::BrowserThread::PostTask( 563 content::BrowserThread::PostTask(
564 content::BrowserThread::UI, 564 content::BrowserThread::UI,
565 FROM_HERE, 565 FROM_HERE,
566 base::Bind(callback, icon_image)); 566 base::Bind(callback, icon_image));
567 } else { 567 } else {
568 content::BrowserThread::PostTask( 568 content::BrowserThread::PostTask(
569 content::BrowserThread::UI, 569 content::BrowserThread::UI,
570 FROM_HERE, 570 FROM_HERE,
571 unavailable_callback); 571 unavailable_callback);
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
609 // If picker is non-NULL, it was set by a test. 609 // If picker is non-NULL, it was set by a test.
610 if (picker_ == NULL) 610 if (picker_ == NULL)
611 picker_ = WebIntentPicker::Create(wrapper_, this, picker_model_.get()); 611 picker_ = WebIntentPicker::Create(wrapper_, this, picker_model_.get());
612 picker_shown_ = true; 612 picker_shown_ = true;
613 } 613 }
614 614
615 void WebIntentPickerController::ClosePicker() { 615 void WebIntentPickerController::ClosePicker() {
616 if (picker_) 616 if (picker_)
617 picker_->Close(); 617 picker_->Close();
618 } 618 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698