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 "chrome/browser/ui/webui/chromeos/image_source.h" | 5 #include "chrome/browser/ui/webui/chromeos/image_source.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 17 matching lines...) Expand all Loading... |
28 namespace chromeos { | 28 namespace chromeos { |
29 namespace { | 29 namespace { |
30 | 30 |
31 const char* kWhitelistedDirectories[] = { | 31 const char* kWhitelistedDirectories[] = { |
32 "regulatory_labels" | 32 "regulatory_labels" |
33 }; | 33 }; |
34 | 34 |
35 // Callback for user_manager::UserImageLoader. | 35 // Callback for user_manager::UserImageLoader. |
36 void ImageLoaded( | 36 void ImageLoaded( |
37 const content::URLDataSource::GotDataCallback& got_data_callback, | 37 const content::URLDataSource::GotDataCallback& got_data_callback, |
38 scoped_ptr<user_manager::UserImage> user_image) { | 38 std::unique_ptr<user_manager::UserImage> user_image) { |
39 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 39 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
40 | 40 |
41 // TODO(crbug.com/593251): Remove the data copy. | 41 // TODO(crbug.com/593251): Remove the data copy. |
42 if (user_image->has_image_bytes()) | 42 if (user_image->has_image_bytes()) |
43 got_data_callback.Run(new base::RefCountedBytes(user_image->image_bytes())); | 43 got_data_callback.Run(new base::RefCountedBytes(user_image->image_bytes())); |
44 else | 44 else |
45 got_data_callback.Run(NULL); | 45 got_data_callback.Run(NULL); |
46 } | 46 } |
47 | 47 |
48 } // namespace | 48 } // namespace |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 return false; | 118 return false; |
119 | 119 |
120 for (size_t i = 0; i < arraysize(kWhitelistedDirectories); i++) { | 120 for (size_t i = 0; i < arraysize(kWhitelistedDirectories); i++) { |
121 if (components[0] == kWhitelistedDirectories[i]) | 121 if (components[0] == kWhitelistedDirectories[i]) |
122 return true; | 122 return true; |
123 } | 123 } |
124 return false; | 124 return false; |
125 } | 125 } |
126 | 126 |
127 } // namespace chromeos | 127 } // namespace chromeos |
OLD | NEW |