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

Unified Diff: mojo/shell/loader.h

Issue 47433002: Cleanup mojo_shell and sample_app a bit (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « mojo/shell/context.h ('k') | mojo/shell/loader.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/shell/loader.h
diff --git a/mojo/shell/loader.h b/mojo/shell/loader.h
new file mode 100644
index 0000000000000000000000000000000000000000..52c5ea37c7650dd9a20c45c722e54d8f5664c775
--- /dev/null
+++ b/mojo/shell/loader.h
@@ -0,0 +1,67 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef MOJO_SHELL_LOADER_H_
+#define MOJO_SHELL_LOADER_H_
+
+#include "base/files/file_path.h"
+#include "base/memory/scoped_ptr.h"
+#include "base/single_thread_task_runner.h"
+#include "base/threading/thread.h"
+#include "mojo/shell/url_request_context_getter.h"
+#include "net/url_request/url_fetcher.h"
+#include "net/url_request/url_fetcher_delegate.h"
+#include "url/gurl.h"
+
+namespace mojo {
+namespace shell {
+
+class Loader {
+ public:
+ class Delegate {
+ public:
+ virtual void DidCompleteLoad(const GURL& app_url,
+ const base::FilePath& app_path) = 0;
+
+ protected:
+ virtual ~Delegate();
+ };
+
+ class Job : public net::URLFetcherDelegate {
+ public:
+ // You can cancel a job by deleting it.
+ virtual ~Job();
+
+ private:
+ friend class Loader;
+
+ // You can create a job using Loader::Load.
+ Job(const GURL& app_url, Delegate* delegate);
+ virtual void OnURLFetchComplete(const net::URLFetcher* source) OVERRIDE;
+
+ scoped_ptr<net::URLFetcher> fetcher_;
+ Delegate* delegate_;
+
+ DISALLOW_COPY_AND_ASSIGN(Job);
+ };
+
+ Loader(base::SingleThreadTaskRunner* network_runner,
+ base::SingleThreadTaskRunner* file_runner,
+ base::FilePath base_path);
+ ~Loader();
+
+ scoped_ptr<Job> Load(const GURL& app_url, Delegate* delegate);
+
+ private:
+ scoped_refptr<base::SingleThreadTaskRunner> file_runner_;
+ scoped_ptr<base::Thread> cache_thread_;
+ scoped_refptr<URLRequestContextGetter> url_request_context_getter_;
+
+ DISALLOW_COPY_AND_ASSIGN(Loader);
+};
+
+} // namespace shell
+} // namespace mojo
+
+#endif // MOJO_SHELL_LOADER_H_
« no previous file with comments | « mojo/shell/context.h ('k') | mojo/shell/loader.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698