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

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

Issue 2676443005: Add interface versioning. Methods queryVersion and requireVersion. (Closed)
Patch Set: Expect the result inside the error handler for test. Code formatting and address codereview comment… Created 3 years, 10 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/ios_web_resources.grd ('k') | mojo/public/js/BUILD.gn » ('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 <memory> 7 #include <memory>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/json/string_escape.h" 10 #include "base/json/string_escape.h"
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 DLOG(WARNING) << "JS message parameter not found: Load ID"; 209 DLOG(WARNING) << "JS message parameter not found: Load ID";
210 return NO; 210 return NO;
211 } 211 }
212 212
213 // Look for built-in scripts first. 213 // Look for built-in scripts first.
214 std::map<std::string, int> resource_map{ 214 std::map<std::string, int> resource_map{
215 {mojo::kBindingsModuleName, IDR_MOJO_BINDINGS_JS}, 215 {mojo::kBindingsModuleName, IDR_MOJO_BINDINGS_JS},
216 {mojo::kBufferModuleName, IDR_MOJO_BUFFER_JS}, 216 {mojo::kBufferModuleName, IDR_MOJO_BUFFER_JS},
217 {mojo::kCodecModuleName, IDR_MOJO_CODEC_JS}, 217 {mojo::kCodecModuleName, IDR_MOJO_CODEC_JS},
218 {mojo::kConnectorModuleName, IDR_MOJO_CONNECTOR_JS}, 218 {mojo::kConnectorModuleName, IDR_MOJO_CONNECTOR_JS},
219 {mojo::kControlMessageHandlerModuleName,
220 IDR_MOJO_CONTROL_MESSAGE_HANDLER_JS},
221 {mojo::kControlMessageProxyModuleName, IDR_MOJO_CONTROL_MESSAGE_PROXY_JS},
222 {mojo::kInterfaceControlMessagesMojom,
223 IDR_MOJO_INTERFACE_CONTROL_MESSAGES_MOJOM_JS},
219 {mojo::kInterfaceTypesModuleName, IDR_MOJO_INTERFACE_TYPES_JS}, 224 {mojo::kInterfaceTypesModuleName, IDR_MOJO_INTERFACE_TYPES_JS},
220 {mojo::kRouterModuleName, IDR_MOJO_ROUTER_JS}, 225 {mojo::kRouterModuleName, IDR_MOJO_ROUTER_JS},
221 {mojo::kUnicodeModuleName, IDR_MOJO_UNICODE_JS}, 226 {mojo::kUnicodeModuleName, IDR_MOJO_UNICODE_JS},
222 {mojo::kValidatorModuleName, IDR_MOJO_VALIDATOR_JS}, 227 {mojo::kValidatorModuleName, IDR_MOJO_VALIDATOR_JS},
223 {web::kConsoleModuleName, IDR_IOS_CONSOLE_JS}, 228 {web::kConsoleModuleName, IDR_IOS_CONSOLE_JS},
229 {web::kCoreModuleName, IDR_IOS_MOJO_CORE_JS},
230 {web::kHandleUtilModuleName, IDR_IOS_MOJO_HANDLE_UTIL_JS},
231 {web::kInterfaceProviderModuleName, IDR_IOS_SHELL_INTERFACE_PROVIDER_JS},
232 {web::kSupportModuleName, IDR_IOS_MOJO_SUPPORT_JS},
224 {web::kSyncMessageChannelModuleName, 233 {web::kSyncMessageChannelModuleName,
225 IDR_IOS_MOJO_SYNC_MESSAGE_CHANNEL_JS}, 234 IDR_IOS_MOJO_SYNC_MESSAGE_CHANNEL_JS},
226 {web::kHandleUtilModuleName, IDR_IOS_MOJO_HANDLE_UTIL_JS},
227 {web::kSupportModuleName, IDR_IOS_MOJO_SUPPORT_JS},
228 {web::kCoreModuleName, IDR_IOS_MOJO_CORE_JS},
229 {web::kInterfaceProviderModuleName, IDR_IOS_SHELL_INTERFACE_PROVIDER_JS},
230 }; 235 };
231 scoped_refptr<base::RefCountedMemory> scriptData( 236 scoped_refptr<base::RefCountedMemory> scriptData(
232 web::GetWebClient()->GetDataResourceBytes(resource_map[moduleName])); 237 web::GetWebClient()->GetDataResourceBytes(resource_map[moduleName]));
233 if (scriptData) { 238 if (scriptData) {
234 std::string script(reinterpret_cast<const char*>(scriptData->front()), 239 std::string script(reinterpret_cast<const char*>(scriptData->front()),
235 scriptData->size()); 240 scriptData->size());
236 [self executeMojoScript:script forModuleName:moduleName loadID:loadID]; 241 [self executeMojoScript:script forModuleName:moduleName loadID:loadID];
237 return YES; 242 return YES;
238 } 243 }
239 244
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
301 #pragma mark - Testing-Only Methods 306 #pragma mark - Testing-Only Methods
302 307
303 - (std::unique_ptr<web::URLFetcherBlockAdapter>) 308 - (std::unique_ptr<web::URLFetcherBlockAdapter>)
304 fetcherForURL:(const GURL&)URL 309 fetcherForURL:(const GURL&)URL
305 completionHandler:(web::URLFetcherBlockAdapterCompletion)handler { 310 completionHandler:(web::URLFetcherBlockAdapterCompletion)handler {
306 return base::MakeUnique<web::URLFetcherBlockAdapter>( 311 return base::MakeUnique<web::URLFetcherBlockAdapter>(
307 URL, _webState->GetBrowserState()->GetRequestContext(), handler); 312 URL, _webState->GetBrowserState()->GetRequestContext(), handler);
308 } 313 }
309 314
310 @end 315 @end
OLDNEW
« no previous file with comments | « ios/web/ios_web_resources.grd ('k') | mojo/public/js/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698