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

Side by Side Diff: components/nacl/renderer/manifest_downloader.h

Issue 276423003: Pepper: Nexe downloading out of the trusted plugin. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: windows fix and stuff for bill Created 6 years, 7 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 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 <string> 5 #include <string>
6 6
7 #include "base/callback.h" 7 #include "base/callback.h"
8 #include "base/memory/scoped_ptr.h"
8 #include "ppapi/c/private/ppb_nacl_private.h" 9 #include "ppapi/c/private/ppb_nacl_private.h"
9 #include "third_party/WebKit/public/platform/WebURLLoaderClient.h" 10 #include "third_party/WebKit/public/platform/WebURLLoaderClient.h"
10 11
11 namespace blink { 12 namespace blink {
12 struct WebURLError; 13 struct WebURLError;
13 class WebURLLoader; 14 class WebURLLoader;
14 class WebURLResponse; 15 class WebURLResponse;
15 } 16 }
16 17
17 namespace nacl { 18 namespace nacl {
18 19
19 // Downloads a NaCl manifest (.nmf) and returns the contents of the file to 20 // Downloads a NaCl manifest (.nmf) and returns the contents of the file to
20 // caller through a callback. 21 // caller through a callback.
21 class ManifestDownloader : public blink::WebURLLoaderClient { 22 class ManifestDownloader : public blink::WebURLLoaderClient {
22 public: 23 public:
23 typedef base::Callback<void(PP_NaClError, const std::string&)> 24 typedef base::Callback<void(PP_NaClError, const std::string&)> Callback;
24 ManifestDownloaderCallback;
25 25
26 ManifestDownloader(bool is_installed, ManifestDownloaderCallback cb); 26 ManifestDownloader(scoped_ptr<blink::WebURLLoader> url_loader,
27 bool is_installed,
28 Callback cb);
27 virtual ~ManifestDownloader(); 29 virtual ~ManifestDownloader();
28 30
31 void Load(const blink::WebURLRequest& request);
32
29 private: 33 private:
30 // WebURLLoaderClient implementation. 34 // WebURLLoaderClient implementation.
31 virtual void didReceiveResponse(blink::WebURLLoader* loader, 35 virtual void didReceiveResponse(blink::WebURLLoader* loader,
32 const blink::WebURLResponse& response); 36 const blink::WebURLResponse& response);
33 virtual void didReceiveData(blink::WebURLLoader* loader, 37 virtual void didReceiveData(blink::WebURLLoader* loader,
34 const char* data, 38 const char* data,
35 int data_length, 39 int data_length,
36 int encoded_data_length); 40 int encoded_data_length);
37 virtual void didFinishLoading(blink::WebURLLoader* loader, 41 virtual void didFinishLoading(blink::WebURLLoader* loader,
38 double finish_time, 42 double finish_time,
39 int64_t total_encoded_data_length); 43 int64_t total_encoded_data_length);
40 virtual void didFail(blink::WebURLLoader* loader, 44 virtual void didFail(blink::WebURLLoader* loader,
41 const blink::WebURLError& error); 45 const blink::WebURLError& error);
42 46
47 scoped_ptr<blink::WebURLLoader> url_loader_;
43 bool is_installed_; 48 bool is_installed_;
44 ManifestDownloaderCallback cb_; 49 Callback cb_;
45 std::string buffer_; 50 std::string buffer_;
46 int status_code_; 51 int status_code_;
47 PP_NaClError pp_nacl_error_; 52 PP_NaClError pp_nacl_error_;
48 }; 53 };
49 54
50 } // namespace nacl 55 } // namespace nacl
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698