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

Side by Side Diff: chrome/browser/chromeos/login/user_image_loader.cc

Issue 181413006: Replace misc. network stub flags with more flexible ones (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Elim. shill_stub_helper and move functions to clients. Created 6 years, 9 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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/chromeos/login/user_image_loader.h" 5 #include "chrome/browser/chromeos/login/user_image_loader.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/file_util.h" 9 #include "base/file_util.h"
10 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 ImageInfo(size, loaded_cb))); 61 ImageInfo(size, loaded_cb)));
62 } 62 }
63 63
64 void UserImageLoader::ReadAndDecodeImage(const std::string& filepath, 64 void UserImageLoader::ReadAndDecodeImage(const std::string& filepath,
65 const ImageInfo& image_info) { 65 const ImageInfo& image_info) {
66 DCHECK(background_task_runner_->RunsTasksOnCurrentThread()); 66 DCHECK(background_task_runner_->RunsTasksOnCurrentThread());
67 67
68 scoped_ptr<std::string> data(new std::string); 68 scoped_ptr<std::string> data(new std::string);
69 const bool success = 69 const bool success =
70 base::ReadFileToString(base::FilePath(filepath), data.get()); 70 base::ReadFileToString(base::FilePath(filepath), data.get());
71 DCHECK(success); 71 if (!success) return;
pneubeck (no reviews) 2014/02/28 09:37:59 please don't include this unrelated(?) functional
stevenjb 2014/02/28 17:43:06 Accidental.
72 72
73 DecodeImage(data.Pass(), image_info); 73 DecodeImage(data.Pass(), image_info);
74 } 74 }
75 75
76 void UserImageLoader::DecodeImage(const scoped_ptr<std::string> data, 76 void UserImageLoader::DecodeImage(const scoped_ptr<std::string> data,
77 const ImageInfo& image_info) { 77 const ImageInfo& image_info) {
78 DCHECK(background_task_runner_->RunsTasksOnCurrentThread()); 78 DCHECK(background_task_runner_->RunsTasksOnCurrentThread());
79 79
80 scoped_refptr<ImageDecoder> image_decoder = 80 scoped_refptr<ImageDecoder> image_decoder =
81 new ImageDecoder(this, *data, image_codec_); 81 new ImageDecoder(this, *data, image_codec_);
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 return; 138 return;
139 } 139 }
140 const LoadedCallback loaded_cb = it->second.loaded_cb; 140 const LoadedCallback loaded_cb = it->second.loaded_cb;
141 image_info_map_.erase(it); 141 image_info_map_.erase(it);
142 142
143 foreground_task_runner_->PostTask(FROM_HERE, 143 foreground_task_runner_->PostTask(FROM_HERE,
144 base::Bind(loaded_cb, UserImage())); 144 base::Bind(loaded_cb, UserImage()));
145 } 145 }
146 146
147 } // namespace chromeos 147 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698