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

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

Issue 1121783003: Move navigations with POST or referrer to the shell. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: merge Created 5 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 unified diff | Download patch
« no previous file with comments | « components/html_viewer/web_media_player_factory.cc ('k') | components/view_manager/DEPS » ('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/shell.mojom.h" 10 #include "mojo/application/public/interfaces/shell.mojom.h"
11 #include "mojo/common/common_type_converters.h" 11 #include "mojo/common/common_type_converters.h"
12 #include "mojo/platform_handle/platform_handle_functions.h" 12 #include "mojo/platform_handle/platform_handle_functions.h"
13 13
14 namespace resource_provider { 14 namespace resource_provider {
15 15
16 ResourceLoader::ResourceLoader(mojo::Shell* shell, 16 ResourceLoader::ResourceLoader(mojo::Shell* shell,
17 const std::set<std::string>& paths) 17 const std::set<std::string>& paths)
18 : loaded_(false), did_block_(false) { 18 : loaded_(false), did_block_(false) {
19 shell->ConnectToApplication("mojo:resource_provider", 19 mojo::URLRequestPtr request(mojo::URLRequest::New());
20 request->url = mojo::String::From("mojo:resource_provider");
21 shell->ConnectToApplication(request.Pass(),
20 GetProxy(&resource_provider_service_provider_), 22 GetProxy(&resource_provider_service_provider_),
21 nullptr); 23 nullptr);
22 mojo::ConnectToService(resource_provider_service_provider_.get(), 24 mojo::ConnectToService(resource_provider_service_provider_.get(),
23 &resource_provider_); 25 &resource_provider_);
24 std::vector<std::string> paths_vector(paths.begin(), paths.end()); 26 std::vector<std::string> paths_vector(paths.begin(), paths.end());
25 resource_provider_->GetResources( 27 resource_provider_->GetResources(
26 mojo::Array<mojo::String>::From(paths_vector), 28 mojo::Array<mojo::String>::From(paths_vector),
27 base::Bind(&ResourceLoader::OnGotResources, base::Unretained(this), 29 base::Bind(&ResourceLoader::OnGotResources, base::Unretained(this),
28 paths_vector)); 30 paths_vector));
29 } 31 }
(...skipping 29 matching lines...) Expand all
59 CHECK(resources[i].is_valid()); 61 CHECK(resources[i].is_valid());
60 MojoPlatformHandle platform_handle; 62 MojoPlatformHandle platform_handle;
61 CHECK(MojoExtractPlatformHandle(resources[i].release().value(), 63 CHECK(MojoExtractPlatformHandle(resources[i].release().value(),
62 &platform_handle) == MOJO_RESULT_OK); 64 &platform_handle) == MOJO_RESULT_OK);
63 resource_map_[paths[i]].reset(new base::File(platform_handle)); 65 resource_map_[paths[i]].reset(new base::File(platform_handle));
64 } 66 }
65 loaded_ = true; 67 loaded_ = true;
66 } 68 }
67 69
68 } // namespace resource_provider 70 } // namespace resource_provider
OLDNEW
« no previous file with comments | « components/html_viewer/web_media_player_factory.cc ('k') | components/view_manager/DEPS » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698