| 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 const user_manager::UserImage& user_image) { | 38 const user_manager::UserImage& user_image) { |
| 39 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 39 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 40 | 40 |
| 41 if (user_image.has_raw_image()) | 41 if (user_image.has_image_bytes()) |
| 42 got_data_callback.Run(new base::RefCountedBytes(user_image.raw_image())); | 42 got_data_callback.Run(new base::RefCountedBytes(user_image.image_bytes())); |
| 43 else | 43 else |
| 44 got_data_callback.Run(NULL); | 44 got_data_callback.Run(NULL); |
| 45 } | 45 } |
| 46 | 46 |
| 47 } // namespace | 47 } // namespace |
| 48 | 48 |
| 49 ImageSource::ImageSource() : weak_factory_(this) { | 49 ImageSource::ImageSource() : weak_factory_(this) { |
| 50 base::SequencedWorkerPool* blocking_pool = | 50 base::SequencedWorkerPool* blocking_pool = |
| 51 BrowserThread::GetBlockingPool(); | 51 BrowserThread::GetBlockingPool(); |
| 52 task_runner_ = blocking_pool->GetSequencedTaskRunnerWithShutdownBehavior( | 52 task_runner_ = blocking_pool->GetSequencedTaskRunnerWithShutdownBehavior( |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 return false; | 117 return false; |
| 118 | 118 |
| 119 for (size_t i = 0; i < arraysize(kWhitelistedDirectories); i++) { | 119 for (size_t i = 0; i < arraysize(kWhitelistedDirectories); i++) { |
| 120 if (components[0] == kWhitelistedDirectories[i]) | 120 if (components[0] == kWhitelistedDirectories[i]) |
| 121 return true; | 121 return true; |
| 122 } | 122 } |
| 123 return false; | 123 return false; |
| 124 } | 124 } |
| 125 | 125 |
| 126 } // namespace chromeos | 126 } // namespace chromeos |
| OLD | NEW |