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

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

Issue 1311353005: Adds a way to determine id of content handler that created app (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: nuke comment Created 5 years, 3 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
« no previous file with comments | « components/pdf_viewer/pdf_viewer.cc ('k') | content/browser/frame_host/frame_mojo_shell.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/public/cpp/resource_loader.h" 5 #include "components/resource_provider/public/cpp/resource_loader.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/files/file.h" 8 #include "base/files/file.h"
9 #include "mojo/application/public/cpp/connect.h" 9 #include "mojo/application/public/cpp/connect.h"
10 #include "mojo/application/public/interfaces/service_provider.mojom.h" 10 #include "mojo/application/public/interfaces/service_provider.mojom.h"
(...skipping 11 matching lines...) Expand all
22 return base::File(platform_handle).Pass(); 22 return base::File(platform_handle).Pass();
23 } 23 }
24 } 24 }
25 25
26 ResourceLoader::ResourceLoader(mojo::Shell* shell, 26 ResourceLoader::ResourceLoader(mojo::Shell* shell,
27 const std::set<std::string>& paths) 27 const std::set<std::string>& paths)
28 : loaded_(false), did_block_(false) { 28 : loaded_(false), did_block_(false) {
29 mojo::URLRequestPtr request(mojo::URLRequest::New()); 29 mojo::URLRequestPtr request(mojo::URLRequest::New());
30 request->url = mojo::String::From("mojo:resource_provider"); 30 request->url = mojo::String::From("mojo:resource_provider");
31 mojo::ServiceProviderPtr resource_provider_service_provider; 31 mojo::ServiceProviderPtr resource_provider_service_provider;
32 shell->ConnectToApplication(request.Pass(), 32 shell->ConnectToApplication(
33 GetProxy(&resource_provider_service_provider), 33 request.Pass(), GetProxy(&resource_provider_service_provider), nullptr,
34 nullptr, 34 nullptr, mojo::Shell::ConnectToApplicationCallback());
35 nullptr);
36 mojo::ConnectToService(resource_provider_service_provider.get(), 35 mojo::ConnectToService(resource_provider_service_provider.get(),
37 &resource_provider_); 36 &resource_provider_);
38 std::vector<std::string> paths_vector(paths.begin(), paths.end()); 37 std::vector<std::string> paths_vector(paths.begin(), paths.end());
39 resource_provider_->GetResources( 38 resource_provider_->GetResources(
40 mojo::Array<mojo::String>::From(paths_vector), 39 mojo::Array<mojo::String>::From(paths_vector),
41 base::Bind(&ResourceLoader::OnGotResources, base::Unretained(this), 40 base::Bind(&ResourceLoader::OnGotResources, base::Unretained(this),
42 paths_vector)); 41 paths_vector));
43 } 42 }
44 43
45 ResourceLoader::~ResourceLoader() { 44 ResourceLoader::~ResourceLoader() {
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 new base::File(GetFileFromHandle(resources[i].Pass()))); 79 new base::File(GetFileFromHandle(resources[i].Pass())));
81 } 80 }
82 loaded_ = true; 81 loaded_ = true;
83 } 82 }
84 83
85 void ResourceLoader::OnGotICU(base::File* file, mojo::ScopedHandle handle) { 84 void ResourceLoader::OnGotICU(base::File* file, mojo::ScopedHandle handle) {
86 *file = GetFileFromHandle(handle.Pass()); 85 *file = GetFileFromHandle(handle.Pass());
87 } 86 }
88 87
89 } // namespace resource_provider 88 } // namespace resource_provider
OLDNEW
« no previous file with comments | « components/pdf_viewer/pdf_viewer.cc ('k') | content/browser/frame_host/frame_mojo_shell.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698