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

Side by Side Diff: chrome/browser/extensions/file_reader.h

Issue 12578008: Move CrxFile, FileReader, ExtensionResource to src/extensions. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 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
« no previous file with comments | « chrome/browser/extensions/extension_web_ui.cc ('k') | chrome/browser/extensions/file_reader.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_EXTENSIONS_FILE_READER_H_
6 #define CHROME_BROWSER_EXTENSIONS_FILE_READER_H_
7
8 #include <string>
9
10 #include "base/callback.h"
11 #include "base/memory/ref_counted.h"
12 #include "chrome/common/extensions/extension_resource.h"
13
14 class MessageLoop;
15
16 // This file defines an interface for reading a file asynchronously on a
17 // background thread.
18 // Consider abstracting out a FilePathProvider (ExtensionResource) and moving
19 // back to chrome/browser/net if other subsystems want to use it.
20 class FileReader : public base::RefCountedThreadSafe<FileReader> {
21 public:
22 // Reports success or failure and the data of the file upon success.
23 typedef base::Callback<void(bool, const std::string&)> Callback;
24
25 FileReader(const ExtensionResource& resource, const Callback& callback);
26
27 // Called to start reading the file on a background thread. Upon completion,
28 // the callback will be notified of the results.
29 void Start();
30
31 private:
32 friend class base::RefCountedThreadSafe<FileReader>;
33
34 virtual ~FileReader();
35
36 void ReadFileOnBackgroundThread();
37
38 ExtensionResource resource_;
39 Callback callback_;
40 MessageLoop* origin_loop_;
41 };
42
43 #endif // CHROME_BROWSER_EXTENSIONS_FILE_READER_H_
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_web_ui.cc ('k') | chrome/browser/extensions/file_reader.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698