Chromium Code Reviews| 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 20 matching lines...) Expand all Loading... | |
| 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 std::unique_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. | |
| 42 if (user_image->has_image_bytes()) | 41 if (user_image->has_image_bytes()) |
| 43 got_data_callback.Run(new base::RefCountedBytes(user_image->image_bytes())); | 42 got_data_callback.Run(user_image->image_bytes()); |
| 44 else | 43 else |
| 45 got_data_callback.Run(NULL); | 44 got_data_callback.Run(NULL); |
|
achuithb
2016/11/22 21:16:54
nullptr?
satorux1
2016/11/24 02:13:40
Fixed here and elsewhere in the file
| |
| 46 } | 45 } |
| 47 | 46 |
| 48 } // namespace | 47 } // namespace |
| 49 | 48 |
| 50 ImageSource::ImageSource() : weak_factory_(this) { | 49 ImageSource::ImageSource() : weak_factory_(this) { |
| 51 base::SequencedWorkerPool* blocking_pool = | 50 base::SequencedWorkerPool* blocking_pool = |
| 52 BrowserThread::GetBlockingPool(); | 51 BrowserThread::GetBlockingPool(); |
| 53 task_runner_ = blocking_pool->GetSequencedTaskRunnerWithShutdownBehavior( | 52 task_runner_ = blocking_pool->GetSequencedTaskRunnerWithShutdownBehavior( |
| 54 blocking_pool->GetSequenceToken(), | 53 blocking_pool->GetSequenceToken(), |
| 55 base::SequencedWorkerPool::CONTINUE_ON_SHUTDOWN); | 54 base::SequencedWorkerPool::CONTINUE_ON_SHUTDOWN); |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 117 return false; | 116 return false; |
| 118 | 117 |
| 119 for (size_t i = 0; i < arraysize(kWhitelistedDirectories); i++) { | 118 for (size_t i = 0; i < arraysize(kWhitelistedDirectories); i++) { |
| 120 if (components[0] == kWhitelistedDirectories[i]) | 119 if (components[0] == kWhitelistedDirectories[i]) |
| 121 return true; | 120 return true; |
| 122 } | 121 } |
| 123 return false; | 122 return false; |
| 124 } | 123 } |
| 125 | 124 |
| 126 } // namespace chromeos | 125 } // namespace chromeos |
| OLD | NEW |