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

Side by Side Diff: components/resource_provider/resource_provider_impl.cc

Issue 1425853003: mandoline: Fix ICU initialization. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase to to Created 5 years, 1 month 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 #include "components/resource_provider/resource_provider_impl.h" 5 #include "components/resource_provider/resource_provider_impl.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/files/file_util.h" 8 #include "base/files/file_util.h"
9 #include "base/location.h" 9 #include "base/location.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
11 #include "components/resource_provider/file_utils.h" 11 #include "components/resource_provider/file_utils.h"
12 #include "mojo/platform_handle/platform_handle_functions.h" 12 #include "mojo/platform_handle/platform_handle_functions.h"
13 #include "url/gurl.h" 13 #include "url/gurl.h"
14 14
15 using mojo::ScopedHandle; 15 using mojo::ScopedHandle;
16 16
17 namespace resource_provider { 17 namespace resource_provider {
18 namespace { 18 namespace {
19 19
20 const char kResourceIcudtl[] = "icudtl.dat";
21
22 ScopedHandle GetHandleForPath(const base::FilePath& path) { 20 ScopedHandle GetHandleForPath(const base::FilePath& path) {
23 if (path.empty()) 21 if (path.empty())
24 return ScopedHandle(); 22 return ScopedHandle();
25 23
26 ScopedHandle to_pass; 24 ScopedHandle to_pass;
27 base::File file(path, base::File::FLAG_OPEN | base::File::FLAG_READ); 25 base::File file(path, base::File::FLAG_OPEN | base::File::FLAG_READ);
28 if (!file.IsValid()) { 26 if (!file.IsValid()) {
29 LOG(WARNING) << "file not valid, path=" << path.value(); 27 LOG(WARNING) << "file not valid, path=" << path.value();
30 return ScopedHandle(); 28 return ScopedHandle();
31 } 29 }
(...skipping 29 matching lines...) Expand all
61 if (!paths.is_null()) { 59 if (!paths.is_null()) {
62 handles.resize(paths.size()); 60 handles.resize(paths.size());
63 for (size_t i = 0; i < paths.size(); ++i) { 61 for (size_t i = 0; i < paths.size(); ++i) {
64 handles[i] = GetHandleForPath( 62 handles[i] = GetHandleForPath(
65 GetPathForResourceNamed(application_path_, paths[i])); 63 GetPathForResourceNamed(application_path_, paths[i]));
66 } 64 }
67 } 65 }
68 callback.Run(handles.Pass()); 66 callback.Run(handles.Pass());
69 } 67 }
70 68
71 void ResourceProviderImpl::GetICUHandle(const GetICUHandleCallback& callback) {
72 const base::FilePath resource_app_path(
73 GetPathForApplicationUrl(resource_provider_app_url_));
74 mojo::ScopedHandle handle = GetHandleForPath(
75 GetPathForResourceNamed(resource_app_path, kResourceIcudtl));
76 callback.Run(handle.Pass());
77 }
78
79 } // namespace resource_provider 69 } // namespace resource_provider
OLDNEW
« no previous file with comments | « components/resource_provider/resource_provider_impl.h ('k') | mandoline/app/desktop/launcher_process.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698