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

Side by Side Diff: components/enhanced_bookmarks/image_store_util_ios.mm

Issue 1546143002: Switch to standard integer types in components/, part 1 of 4. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 12 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
OLDNEW
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/enhanced_bookmarks/image_store_util.h" 5 #include "components/enhanced_bookmarks/image_store_util.h"
6 6
7 #include <stddef.h>
7 #import <UIKit/UIKit.h> 8 #import <UIKit/UIKit.h>
8 9
9 #include "base/mac/scoped_cftyperef.h" 10 #include "base/mac/scoped_cftyperef.h"
10 #include "base/mac/scoped_nsobject.h" 11 #include "base/mac/scoped_nsobject.h"
12 #include "base/macros.h"
11 #include "third_party/skia/include/core/SkBitmap.h" 13 #include "third_party/skia/include/core/SkBitmap.h"
12 #include "ui/gfx/color_analysis.h" 14 #include "ui/gfx/color_analysis.h"
13 15
14 namespace { 16 namespace {
15 // An implementation of RefCountedMemory, where the bytes are stored in a 17 // An implementation of RefCountedMemory, where the bytes are stored in a
16 // NSData. This class assumes the NSData is non mutable to avoid a copy. 18 // NSData. This class assumes the NSData is non mutable to avoid a copy.
17 class RefCountedNSDataMemory : public base::RefCountedMemory { 19 class RefCountedNSDataMemory : public base::RefCountedMemory {
18 public: 20 public:
19 explicit RefCountedNSDataMemory(NSData* memory) : data_([memory retain]) {} 21 explicit RefCountedNSDataMemory(NSData* memory) : data_([memory retain]) {}
20 22
(...skipping 24 matching lines...) Expand all
45 gfx::Image ImageForBytes(const scoped_refptr<base::RefCountedMemory>& data) { 47 gfx::Image ImageForBytes(const scoped_refptr<base::RefCountedMemory>& data) {
46 return gfx::Image([[NSKeyedUnarchiver unarchiveObjectWithData: 48 return gfx::Image([[NSKeyedUnarchiver unarchiveObjectWithData:
47 [NSData dataWithBytes:data->front() length:data->size()]] retain]); 49 [NSData dataWithBytes:data->front() length:data->size()]] retain]);
48 } 50 }
49 51
50 SkColor DominantColorForImage(const gfx::Image& image) { 52 SkColor DominantColorForImage(const gfx::Image& image) {
51 return color_utils::CalculateKMeanColorOfBitmap(*image.ToSkBitmap()); 53 return color_utils::CalculateKMeanColorOfBitmap(*image.ToSkBitmap());
52 } 54 }
53 55
54 } // namespace enhanced_bookmarks 56 } // namespace enhanced_bookmarks
OLDNEW
« no previous file with comments | « components/enhanced_bookmarks/image_store_unittest.cc ('k') | components/enhanced_bookmarks/item_position.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698