| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "components/search_provider_logos/logo_tracker.h" | 5 #include "components/search_provider_logos/logo_tracker.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/base64.h" | 9 #include "base/base64.h" |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 | 59 |
| 60 std::string EncodeBitmapAsPNGBase64(const SkBitmap& bitmap) { | 60 std::string EncodeBitmapAsPNGBase64(const SkBitmap& bitmap) { |
| 61 scoped_refptr<base::RefCountedString> png_bytes = EncodeBitmapAsPNG(bitmap); | 61 scoped_refptr<base::RefCountedString> png_bytes = EncodeBitmapAsPNG(bitmap); |
| 62 std::string encoded_image_base64; | 62 std::string encoded_image_base64; |
| 63 base::Base64Encode(png_bytes->data(), &encoded_image_base64); | 63 base::Base64Encode(png_bytes->data(), &encoded_image_base64); |
| 64 return encoded_image_base64; | 64 return encoded_image_base64; |
| 65 } | 65 } |
| 66 | 66 |
| 67 SkBitmap MakeBitmap(int width, int height) { | 67 SkBitmap MakeBitmap(int width, int height) { |
| 68 SkBitmap bitmap; | 68 SkBitmap bitmap; |
| 69 bitmap.setConfig(SkBitmap::kARGB_8888_Config, width, height); | 69 bitmap.allocN32Pixels(width, height); |
| 70 bitmap.allocPixels(); | |
| 71 bitmap.eraseColor(SK_ColorBLUE); | 70 bitmap.eraseColor(SK_ColorBLUE); |
| 72 return bitmap; | 71 return bitmap; |
| 73 } | 72 } |
| 74 | 73 |
| 75 EncodedLogo EncodeLogo(const Logo& logo) { | 74 EncodedLogo EncodeLogo(const Logo& logo) { |
| 76 EncodedLogo encoded_logo; | 75 EncodedLogo encoded_logo; |
| 77 encoded_logo.encoded_image = EncodeBitmapAsPNG(logo.image); | 76 encoded_logo.encoded_image = EncodeBitmapAsPNG(logo.image); |
| 78 encoded_logo.metadata = logo.metadata; | 77 encoded_logo.metadata = logo.metadata; |
| 79 return encoded_logo; | 78 return encoded_logo; |
| 80 } | 79 } |
| (...skipping 579 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 660 MockLogoObserver listener2; | 659 MockLogoObserver listener2; |
| 661 listener2.ExpectFreshLogo(&logo); | 660 listener2.ExpectFreshLogo(&logo); |
| 662 logo_tracker_->GetLogo(&listener2); | 661 logo_tracker_->GetLogo(&listener2); |
| 663 | 662 |
| 664 base::RunLoop().RunUntilIdle(); | 663 base::RunLoop().RunUntilIdle(); |
| 665 } | 664 } |
| 666 | 665 |
| 667 } // namespace | 666 } // namespace |
| 668 | 667 |
| 669 } // namespace search_provider_logos | 668 } // namespace search_provider_logos |
| OLD | NEW |