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

Side by Side Diff: components/user_manager/user_image/user_image.h

Issue 1917673002: Convert //components/[u-z]* from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 4 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
« no previous file with comments | « components/user_manager/user.cc ('k') | components/user_manager/user_image/user_image.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #ifndef COMPONENTS_USER_MANAGER_USER_IMAGE_USER_IMAGE_H_ 5 #ifndef COMPONENTS_USER_MANAGER_USER_IMAGE_USER_IMAGE_H_
6 #define COMPONENTS_USER_MANAGER_USER_IMAGE_USER_IMAGE_H_ 6 #define COMPONENTS_USER_MANAGER_USER_IMAGE_USER_IMAGE_H_
7 7
8 #include <memory>
8 #include <string> 9 #include <string>
9 #include <vector> 10 #include <vector>
10 11
11 #include "base/files/file_path.h" 12 #include "base/files/file_path.h"
12 #include "base/memory/scoped_ptr.h"
13 #include "components/user_manager/user_manager_export.h" 13 #include "components/user_manager/user_manager_export.h"
14 #include "ui/gfx/image/image_skia.h" 14 #include "ui/gfx/image/image_skia.h"
15 #include "url/gurl.h" 15 #include "url/gurl.h"
16 16
17 namespace user_manager { 17 namespace user_manager {
18 18
19 // Wrapper class storing a still image and its bytes representation for 19 // Wrapper class storing a still image and its bytes representation for
20 // WebUI in a web-compatible format such as JPEG. Could be used for storing 20 // WebUI in a web-compatible format such as JPEG. Could be used for storing
21 // profile images and user wallpapers. 21 // profile images and user wallpapers.
22 class USER_MANAGER_EXPORT UserImage { 22 class USER_MANAGER_EXPORT UserImage {
23 public: 23 public:
24 // Used to store bytes representation for WebUI. 24 // Used to store bytes representation for WebUI.
25 // TODO(ivankr): replace with RefCountedMemory to prevent copying. 25 // TODO(ivankr): replace with RefCountedMemory to prevent copying.
26 typedef std::vector<unsigned char> Bytes; 26 typedef std::vector<unsigned char> Bytes;
27 27
28 // Encodes the given bitmap to bytes representation for WebUI. Returns null 28 // Encodes the given bitmap to bytes representation for WebUI. Returns null
29 // on failure. 29 // on failure.
30 static scoped_ptr<Bytes> Encode(const SkBitmap& bitmap); 30 static std::unique_ptr<Bytes> Encode(const SkBitmap& bitmap);
31 31
32 // Creates a new instance from a given still frame and tries to encode it 32 // Creates a new instance from a given still frame and tries to encode it
33 // to bytes representation for WebUI. Always returns a non-null result. 33 // to bytes representation for WebUI. Always returns a non-null result.
34 // TODO(ivankr): remove eventually. 34 // TODO(ivankr): remove eventually.
35 static scoped_ptr<UserImage> CreateAndEncode(const gfx::ImageSkia& image); 35 static std::unique_ptr<UserImage> CreateAndEncode(
36 const gfx::ImageSkia& image);
36 37
37 // Create instance with an empty still frame and no bytes 38 // Create instance with an empty still frame and no bytes
38 // representation for WebUI. 39 // representation for WebUI.
39 UserImage(); 40 UserImage();
40 41
41 // Creates a new instance from a given still frame without any bytes 42 // Creates a new instance from a given still frame without any bytes
42 // representation for WebUI. 43 // representation for WebUI.
43 explicit UserImage(const gfx::ImageSkia& image); 44 explicit UserImage(const gfx::ImageSkia& image);
44 45
45 // Creates a new instance from a given still frame and bytes 46 // Creates a new instance from a given still frame and bytes
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 // If image was loaded from the local file, file path is stored here. 79 // If image was loaded from the local file, file path is stored here.
79 base::FilePath file_path_; 80 base::FilePath file_path_;
80 bool is_safe_format_; 81 bool is_safe_format_;
81 82
82 DISALLOW_COPY_AND_ASSIGN(UserImage); 83 DISALLOW_COPY_AND_ASSIGN(UserImage);
83 }; 84 };
84 85
85 } // namespace user_manager 86 } // namespace user_manager
86 87
87 #endif // COMPONENTS_USER_MANAGER_USER_IMAGE_USER_IMAGE_H_ 88 #endif // COMPONENTS_USER_MANAGER_USER_IMAGE_USER_IMAGE_H_
OLDNEW
« no previous file with comments | « components/user_manager/user.cc ('k') | components/user_manager/user_image/user_image.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698