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

Unified Diff: components/resource_provider/public/cpp/resource_loader.h

Issue 1942473002: Eliminate mojo:resource_provider (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 4 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 side-by-side diff with in-line comments
Download patch
Index: components/resource_provider/public/cpp/resource_loader.h
diff --git a/components/resource_provider/public/cpp/resource_loader.h b/components/resource_provider/public/cpp/resource_loader.h
deleted file mode 100644
index 9153b47bc08605a05373ce60bd979adcdbb4b9d3..0000000000000000000000000000000000000000
--- a/components/resource_provider/public/cpp/resource_loader.h
+++ /dev/null
@@ -1,70 +0,0 @@
-// Copyright 2015 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 COMPONENTS_RESOURCE_PROVIDER_PUBLIC_CPP_RESOURCE_LOADER_H_
-#define COMPONENTS_RESOURCE_PROVIDER_PUBLIC_CPP_RESOURCE_LOADER_H_
-
-#include <map>
-#include <memory>
-#include <set>
-#include <string>
-#include <vector>
-
-#include "base/macros.h"
-#include "components/resource_provider/public/interfaces/resource_provider.mojom.h"
-#include "mojo/platform_handle/platform_handle.h"
-#include "mojo/public/cpp/bindings/array.h"
-#include "mojo/public/cpp/system/handle.h"
-
-namespace base {
-class File;
-}
-
-namespace shell {
-class Connector;
-}
-
-namespace resource_provider {
-
-// ResourceLoader handles making a request to ResourceProvider and blocking
-// until the resources are available. Expected use is to create a ResourceLoader
-// and shortly thereafter call BlockUntilLoaded() to wait until the resources
-// have been obtained.
-class ResourceLoader {
- public:
- ResourceLoader(shell::Connector* connector,
- const std::set<std::string>& paths);
- ~ResourceLoader();
-
- // Uses WaitForIncomingMessage() to block until the results are available, or
- // an error occurs. Returns true if the resources were obtained, false on
- // error. This immediately returns if the resources have already been
- // obtained.
- bool BlockUntilLoaded();
-
- // Releases and returns the file wrapping the handle.
- base::File ReleaseFile(const std::string& path);
-
- bool loaded() const { return loaded_; }
-
- private:
- using ResourceMap = std::map<std::string, std::unique_ptr<base::File>>;
-
- // Callback when resources have loaded.
- void OnGotResources(const std::vector<std::string>& paths,
- mojo::Array<mojo::ScopedHandle> resources);
-
- ResourceProviderPtr resource_provider_;
-
- ResourceMap resource_map_;
-
- bool loaded_;
- bool did_block_;
-
- DISALLOW_COPY_AND_ASSIGN(ResourceLoader);
-};
-
-} // namespace resource_provider
-
-#endif // COMPONENTS_RESOURCE_PROVIDER_PUBLIC_CPP_RESOURCE_LOADER_H_
« no previous file with comments | « components/resource_provider/public/cpp/BUILD.gn ('k') | components/resource_provider/public/cpp/resource_loader.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698