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

Unified Diff: components/resource_provider/resource_provider_impl.cc

Issue 1113223003: Revert of Adds resource_provider::ResourceProvider (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 8 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/resource_provider_impl.cc
diff --git a/components/resource_provider/resource_provider_impl.cc b/components/resource_provider/resource_provider_impl.cc
deleted file mode 100644
index 2c85b6de7877e419916fc7f04906fdd5a37dccef..0000000000000000000000000000000000000000
--- a/components/resource_provider/resource_provider_impl.cc
+++ /dev/null
@@ -1,60 +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.
-
-#include "components/resource_provider/resource_provider_impl.h"
-
-#include "base/bind.h"
-#include "base/files/file_util.h"
-#include "base/location.h"
-#include "base/logging.h"
-#include "components/resource_provider/file_utils.h"
-#include "mojo/platform_handle/platform_handle_functions.h"
-
-using mojo::ScopedHandle;
-
-namespace resource_provider {
-namespace {
-
-ScopedHandle GetHandleForPath(const base::FilePath& path) {
- if (path.empty())
- return ScopedHandle();
-
- ScopedHandle to_pass;
- base::File file(path, base::File::FLAG_OPEN | base::File::FLAG_READ);
- if (!file.IsValid())
- return ScopedHandle();
-
- MojoHandle mojo_handle;
- if (MojoCreatePlatformHandleWrapper(file.TakePlatformFile(), &mojo_handle) !=
- MOJO_RESULT_OK)
- return ScopedHandle();
-
- return ScopedHandle(mojo::Handle(mojo_handle)).Pass();
-}
-
-} // namespace
-
-ResourceProviderImpl::ResourceProviderImpl(
- const base::FilePath& application_path)
- : application_path_(application_path) {
- CHECK(!application_path_.empty());
-}
-
-ResourceProviderImpl::~ResourceProviderImpl() {
-}
-
-void ResourceProviderImpl::GetResources(mojo::Array<mojo::String> paths,
- const GetResourcesCallback& callback) {
- mojo::Array<mojo::ScopedHandle> handles;
- if (!paths.is_null()) {
- handles.resize(paths.size());
- for (size_t i = 0; i < paths.size(); ++i) {
- handles[i] = GetHandleForPath(
- GetPathForResourceNamed(application_path_, paths[i]));
- }
- }
- callback.Run(handles.Pass());
-}
-
-} // namespace resource_provider
« no previous file with comments | « components/resource_provider/resource_provider_impl.h ('k') | components/test/data/resource_provider/dir/sample2 » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698