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

Side by Side Diff: ios/web/webui/crw_web_ui_manager.mm

Issue 1996723002: Switch ResourceBundle LoadDataResourceBytes to return RefCountedMemory. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update to address newly added use 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 unified diff | Download patch
« no previous file with comments | « ios/web/public/web_client.mm ('k') | ios/web/webui/web_ui_ios_data_source_impl.mm » ('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 #import "ios/web/webui/crw_web_ui_manager.h" 5 #import "ios/web/webui/crw_web_ui_manager.h"
6 6
7 #include "base/json/string_escape.h" 7 #include "base/json/string_escape.h"
8 #include "base/mac/bind_objc_block.h" 8 #include "base/mac/bind_objc_block.h"
9 #include "base/mac/scoped_nsobject.h" 9 #include "base/mac/scoped_nsobject.h"
10 #include "base/memory/ref_counted_memory.h" 10 #include "base/memory/ref_counted_memory.h"
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after
245 std::map<std::string, int> resource_map{ 245 std::map<std::string, int> resource_map{
246 {mojo::kBindingsModuleName, IDR_MOJO_BINDINGS_JS}, 246 {mojo::kBindingsModuleName, IDR_MOJO_BINDINGS_JS},
247 {mojo::kBufferModuleName, IDR_MOJO_BUFFER_JS}, 247 {mojo::kBufferModuleName, IDR_MOJO_BUFFER_JS},
248 {mojo::kCodecModuleName, IDR_MOJO_CODEC_JS}, 248 {mojo::kCodecModuleName, IDR_MOJO_CODEC_JS},
249 {mojo::kConnectionModuleName, IDR_MOJO_CONNECTION_JS}, 249 {mojo::kConnectionModuleName, IDR_MOJO_CONNECTION_JS},
250 {mojo::kConnectorModuleName, IDR_MOJO_CONNECTOR_JS}, 250 {mojo::kConnectorModuleName, IDR_MOJO_CONNECTOR_JS},
251 {mojo::kRouterModuleName, IDR_MOJO_ROUTER_JS}, 251 {mojo::kRouterModuleName, IDR_MOJO_ROUTER_JS},
252 {mojo::kUnicodeModuleName, IDR_MOJO_UNICODE_JS}, 252 {mojo::kUnicodeModuleName, IDR_MOJO_UNICODE_JS},
253 {mojo::kValidatorModuleName, IDR_MOJO_VALIDATOR_JS}, 253 {mojo::kValidatorModuleName, IDR_MOJO_VALIDATOR_JS},
254 }; 254 };
255 scoped_refptr<base::RefCountedStaticMemory> scriptData( 255 scoped_refptr<base::RefCountedMemory> scriptData(
256 web::GetWebClient()->GetDataResourceBytes(resource_map[moduleName])); 256 web::GetWebClient()->GetDataResourceBytes(resource_map[moduleName]));
257 if (scriptData) { 257 if (scriptData) {
258 std::string script(reinterpret_cast<const char*>(scriptData->front()), 258 std::string script(reinterpret_cast<const char*>(scriptData->front()),
259 scriptData->size()); 259 scriptData->size());
260 [self executeMojoScript:script forModuleName:moduleName loadID:loadID]; 260 [self executeMojoScript:script forModuleName:moduleName loadID:loadID];
261 return YES; 261 return YES;
262 } 262 }
263 263
264 // Not a built-in script, try retrieving from network. 264 // Not a built-in script, try retrieving from network.
265 GURL resourceURL(self.webState->GetLastCommittedURL().Resolve(moduleName)); 265 GURL resourceURL(self.webState->GetLastCommittedURL().Resolve(moduleName));
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
322 322
323 - (std::unique_ptr<web::URLFetcherBlockAdapter>) 323 - (std::unique_ptr<web::URLFetcherBlockAdapter>)
324 fetcherForURL:(const GURL&)URL 324 fetcherForURL:(const GURL&)URL
325 completionHandler:(web::URLFetcherBlockAdapterCompletion)handler { 325 completionHandler:(web::URLFetcherBlockAdapterCompletion)handler {
326 return std::unique_ptr<web::URLFetcherBlockAdapter>( 326 return std::unique_ptr<web::URLFetcherBlockAdapter>(
327 new web::URLFetcherBlockAdapter( 327 new web::URLFetcherBlockAdapter(
328 URL, _webState->GetBrowserState()->GetRequestContext(), handler)); 328 URL, _webState->GetBrowserState()->GetRequestContext(), handler));
329 } 329 }
330 330
331 @end 331 @end
OLDNEW
« no previous file with comments | « ios/web/public/web_client.mm ('k') | ios/web/webui/web_ui_ios_data_source_impl.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698