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

Side by Side Diff: extensions/browser/file_reader.cc

Issue 19579005: Move ReadFileToString to the base namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 3 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
« no previous file with comments | « courgette/courgette_tool.cc ('k') | extensions/browser/file_reader_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "extensions/browser/file_reader.h" 5 #include "extensions/browser/file_reader.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/file_util.h" 8 #include "base/file_util.h"
9 #include "base/message_loop/message_loop.h" 9 #include "base/message_loop/message_loop.h"
10 #include "content/public/browser/browser_thread.h" 10 #include "content/public/browser/browser_thread.h"
11 11
12 using content::BrowserThread; 12 using content::BrowserThread;
13 13
14 FileReader::FileReader(const extensions::ExtensionResource& resource, 14 FileReader::FileReader(const extensions::ExtensionResource& resource,
15 const Callback& callback) 15 const Callback& callback)
16 : resource_(resource), 16 : resource_(resource),
17 callback_(callback), 17 callback_(callback),
18 origin_loop_(base::MessageLoop::current()) {} 18 origin_loop_(base::MessageLoop::current()) {}
19 19
20 void FileReader::Start() { 20 void FileReader::Start() {
21 BrowserThread::PostTask( 21 BrowserThread::PostTask(
22 BrowserThread::FILE, FROM_HERE, 22 BrowserThread::FILE, FROM_HERE,
23 base::Bind(&FileReader::ReadFileOnBackgroundThread, this)); 23 base::Bind(&FileReader::ReadFileOnBackgroundThread, this));
24 } 24 }
25 25
26 FileReader::~FileReader() {} 26 FileReader::~FileReader() {}
27 27
28 void FileReader::ReadFileOnBackgroundThread() { 28 void FileReader::ReadFileOnBackgroundThread() {
29 std::string data; 29 std::string data;
30 bool success = file_util::ReadFileToString(resource_.GetFilePath(), &data); 30 bool success = base::ReadFileToString(resource_.GetFilePath(), &data);
31 origin_loop_->PostTask(FROM_HERE, base::Bind(callback_, success, data)); 31 origin_loop_->PostTask(FROM_HERE, base::Bind(callback_, success, data));
32 } 32 }
OLDNEW
« no previous file with comments | « courgette/courgette_tool.cc ('k') | extensions/browser/file_reader_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698