| OLD | NEW |
| 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 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 return self; | 84 return self; |
| 85 } | 85 } |
| 86 | 86 |
| 87 - (instancetype)initWithWebState:(web::WebStateImpl*)webState { | 87 - (instancetype)initWithWebState:(web::WebStateImpl*)webState { |
| 88 if (self = [super init]) { | 88 if (self = [super init]) { |
| 89 _webState = webState; | 89 _webState = webState; |
| 90 _webStateObserverBridge.reset( | 90 _webStateObserverBridge.reset( |
| 91 new web::WebStateObserverBridge(webState, self)); | 91 new web::WebStateObserverBridge(webState, self)); |
| 92 base::WeakNSObject<CRWWebUIManager> weakSelf(self); | 92 base::WeakNSObject<CRWWebUIManager> weakSelf(self); |
| 93 _webState->AddScriptCommandCallback( | 93 _webState->AddScriptCommandCallback( |
| 94 base::BindBlock( | 94 base::BindBlockArc( |
| 95 ^bool(const base::DictionaryValue& message, const GURL&, bool) { | 95 ^bool(const base::DictionaryValue& message, const GURL&, bool) { |
| 96 return [weakSelf handleWebUIJSMessage:message]; | 96 return [weakSelf handleWebUIJSMessage:message]; |
| 97 }), | 97 }), |
| 98 kScriptCommandPrefix); | 98 kScriptCommandPrefix); |
| 99 } | 99 } |
| 100 return self; | 100 return self; |
| 101 } | 101 } |
| 102 | 102 |
| 103 - (void)dealloc { | 103 - (void)dealloc { |
| 104 [self resetWebState]; | 104 [self resetWebState]; |
| (...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 332 | 332 |
| 333 - (std::unique_ptr<web::URLFetcherBlockAdapter>) | 333 - (std::unique_ptr<web::URLFetcherBlockAdapter>) |
| 334 fetcherForURL:(const GURL&)URL | 334 fetcherForURL:(const GURL&)URL |
| 335 completionHandler:(web::URLFetcherBlockAdapterCompletion)handler { | 335 completionHandler:(web::URLFetcherBlockAdapterCompletion)handler { |
| 336 return std::unique_ptr<web::URLFetcherBlockAdapter>( | 336 return std::unique_ptr<web::URLFetcherBlockAdapter>( |
| 337 new web::URLFetcherBlockAdapter( | 337 new web::URLFetcherBlockAdapter( |
| 338 URL, _webState->GetBrowserState()->GetRequestContext(), handler)); | 338 URL, _webState->GetBrowserState()->GetRequestContext(), handler)); |
| 339 } | 339 } |
| 340 | 340 |
| 341 @end | 341 @end |
| OLD | NEW |