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

Side by Side Diff: components/resource_provider/public/cpp/resource_loader.h

Issue 1674903003: Extract shell methods from ApplicationImpl into a base class, and pass this to Initialize() instead. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@mojom
Patch Set: . Created 4 years, 10 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 #ifndef COMPONENTS_RESOURCE_PROVIDER_PUBLIC_CPP_RESOURCE_LOADER_H_ 5 #ifndef COMPONENTS_RESOURCE_PROVIDER_PUBLIC_CPP_RESOURCE_LOADER_H_
6 #define COMPONENTS_RESOURCE_PROVIDER_PUBLIC_CPP_RESOURCE_LOADER_H_ 6 #define COMPONENTS_RESOURCE_PROVIDER_PUBLIC_CPP_RESOURCE_LOADER_H_
7 7
8 #include <map> 8 #include <map>
9 #include <set> 9 #include <set>
10 #include <string> 10 #include <string>
11 #include <vector> 11 #include <vector>
12 12
13 #include "base/macros.h" 13 #include "base/macros.h"
14 #include "base/memory/scoped_ptr.h" 14 #include "base/memory/scoped_ptr.h"
15 #include "components/resource_provider/public/interfaces/resource_provider.mojom .h" 15 #include "components/resource_provider/public/interfaces/resource_provider.mojom .h"
16 #include "mojo/platform_handle/platform_handle.h" 16 #include "mojo/platform_handle/platform_handle.h"
17 #include "mojo/public/cpp/bindings/array.h" 17 #include "mojo/public/cpp/bindings/array.h"
18 #include "mojo/public/cpp/system/handle.h" 18 #include "mojo/public/cpp/system/handle.h"
19 19
20 namespace base { 20 namespace base {
21 class File; 21 class File;
22 } 22 }
23 23
24 namespace mojo { 24 namespace mojo {
25 class ApplicationImpl; 25 class Shell;
26 } 26 }
27 27
28 namespace resource_provider { 28 namespace resource_provider {
29 29
30 // ResourceLoader handles making a request to ResourceProvider and blocking 30 // ResourceLoader handles making a request to ResourceProvider and blocking
31 // until the resources are available. Expected use is to create a ResourceLoader 31 // until the resources are available. Expected use is to create a ResourceLoader
32 // and shortly thereafter call BlockUntilLoaded() to wait until the resources 32 // and shortly thereafter call BlockUntilLoaded() to wait until the resources
33 // have been obtained. 33 // have been obtained.
34 class ResourceLoader { 34 class ResourceLoader {
35 public: 35 public:
36 ResourceLoader(mojo::ApplicationImpl* app, 36 ResourceLoader(mojo::Shell* shell, const std::set<std::string>& paths);
37 const std::set<std::string>& paths);
38 ~ResourceLoader(); 37 ~ResourceLoader();
39 38
40 // Uses WaitForIncomingMessage() to block until the results are available, or 39 // Uses WaitForIncomingMessage() to block until the results are available, or
41 // an error occurs. Returns true if the resources were obtained, false on 40 // an error occurs. Returns true if the resources were obtained, false on
42 // error. This immediately returns if the resources have already been 41 // error. This immediately returns if the resources have already been
43 // obtained. 42 // obtained.
44 bool BlockUntilLoaded(); 43 bool BlockUntilLoaded();
45 44
46 // Releases and returns the file wrapping the handle. 45 // Releases and returns the file wrapping the handle.
47 base::File ReleaseFile(const std::string& path); 46 base::File ReleaseFile(const std::string& path);
(...skipping 13 matching lines...) Expand all
61 60
62 bool loaded_; 61 bool loaded_;
63 bool did_block_; 62 bool did_block_;
64 63
65 DISALLOW_COPY_AND_ASSIGN(ResourceLoader); 64 DISALLOW_COPY_AND_ASSIGN(ResourceLoader);
66 }; 65 };
67 66
68 } // namespace resource_provider 67 } // namespace resource_provider
69 68
70 #endif // COMPONENTS_RESOURCE_PROVIDER_PUBLIC_CPP_RESOURCE_LOADER_H_ 69 #endif // COMPONENTS_RESOURCE_PROVIDER_PUBLIC_CPP_RESOURCE_LOADER_H_
OLDNEW
« no previous file with comments | « components/pdf_viewer/pdf_viewer.cc ('k') | components/resource_provider/public/cpp/resource_loader.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698