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

Side by Side Diff: chrome/browser/ui/webui/chromeos/image_source.cc

Issue 1794323003: Make user_manager::UserImage non-copyable (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: just rebase Created 4 years, 8 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 "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
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 const user_manager::UserImage& user_image) { 38 scoped_ptr<user_manager::UserImage> user_image) {
39 DCHECK_CURRENTLY_ON(BrowserThread::UI); 39 DCHECK_CURRENTLY_ON(BrowserThread::UI);
40 40
41 if (user_image.has_image_bytes()) 41 // TODO(crbug.com/593251): Remove the data copy.
42 got_data_callback.Run(new base::RefCountedBytes(user_image.image_bytes())); 42 if (user_image->has_image_bytes())
43 got_data_callback.Run(new base::RefCountedBytes(user_image->image_bytes()));
43 else 44 else
44 got_data_callback.Run(NULL); 45 got_data_callback.Run(NULL);
45 } 46 }
46 47
47 } // namespace 48 } // namespace
48 49
49 ImageSource::ImageSource() : weak_factory_(this) { 50 ImageSource::ImageSource() : weak_factory_(this) {
50 base::SequencedWorkerPool* blocking_pool = 51 base::SequencedWorkerPool* blocking_pool =
51 BrowserThread::GetBlockingPool(); 52 BrowserThread::GetBlockingPool();
52 task_runner_ = blocking_pool->GetSequencedTaskRunnerWithShutdownBehavior( 53 task_runner_ = blocking_pool->GetSequencedTaskRunnerWithShutdownBehavior(
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 return false; 118 return false;
118 119
119 for (size_t i = 0; i < arraysize(kWhitelistedDirectories); i++) { 120 for (size_t i = 0; i < arraysize(kWhitelistedDirectories); i++) {
120 if (components[0] == kWhitelistedDirectories[i]) 121 if (components[0] == kWhitelistedDirectories[i])
121 return true; 122 return true;
122 } 123 }
123 return false; 124 return false;
124 } 125 }
125 126
126 } // namespace chromeos 127 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager.cc ('k') | components/user_manager/user.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698