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

Side by Side Diff: mojo/shell/loader.h

Issue 323593002: Mojo: Use network service to load non-local Mojo Apps. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 6 years, 6 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 | « mojo/shell/keep_alive.cc ('k') | mojo/shell/loader.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 2013 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 MOJO_SHELL_LOADER_H_
6 #define MOJO_SHELL_LOADER_H_
7
8 #include "base/files/file_path.h"
9 #include "base/memory/scoped_ptr.h"
10 #include "base/single_thread_task_runner.h"
11 #include "base/threading/thread.h"
12 #include "mojo/shell/url_request_context_getter.h"
13 #include "net/url_request/url_fetcher.h"
14 #include "net/url_request/url_fetcher_delegate.h"
15 #include "url/gurl.h"
16
17 namespace net {
18 class NetworkDelegate;
19 }
20
21 namespace mojo {
22 namespace shell {
23
24 class Loader {
25 public:
26 class Delegate {
27 public:
28 // |mime_type| is NULL if a mime type was not specified.
29 virtual void DidCompleteLoad(const GURL& app_url,
30 const base::FilePath& app_path,
31 const std::string* mime_type) = 0;
32
33 protected:
34 virtual ~Delegate();
35 };
36
37 class Job : public net::URLFetcherDelegate {
38 public:
39 // You can cancel a job by deleting it.
40 virtual ~Job();
41
42 private:
43 friend class Loader;
44
45 // You can create a job using Loader::Load.
46 Job(const GURL& app_url, Delegate* delegate);
47 virtual void OnURLFetchComplete(const net::URLFetcher* source) OVERRIDE;
48
49 scoped_ptr<net::URLFetcher> fetcher_;
50 Delegate* delegate_;
51
52 DISALLOW_COPY_AND_ASSIGN(Job);
53 };
54
55 Loader(base::SingleThreadTaskRunner* network_runner,
56 base::SingleThreadTaskRunner* file_runner,
57 base::MessageLoopProxy* cache_runner,
58 scoped_ptr<net::NetworkDelegate> network_delegate,
59 base::FilePath base_path);
60 ~Loader();
61
62 scoped_ptr<Job> Load(const GURL& app_url, Delegate* delegate);
63
64 private:
65 scoped_refptr<base::SingleThreadTaskRunner> file_runner_;
66 scoped_refptr<URLRequestContextGetter> url_request_context_getter_;
67
68 DISALLOW_COPY_AND_ASSIGN(Loader);
69 };
70
71 } // namespace shell
72 } // namespace mojo
73
74 #endif // MOJO_SHELL_LOADER_H_
OLDNEW
« no previous file with comments | « mojo/shell/keep_alive.cc ('k') | mojo/shell/loader.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698