| 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/mac/bind_objc_block.h" | 7 #include "base/mac/bind_objc_block.h" |
| 8 #include "base/mac/scoped_nsobject.h" | 8 #include "base/mac/scoped_nsobject.h" |
| 9 #include "base/memory/scoped_vector.h" | 9 #include "base/memory/scoped_vector.h" |
| 10 #import "base/strings/sys_string_conversions.h" | 10 #import "base/strings/sys_string_conversions.h" |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 | 45 |
| 46 // Removes fetcher from vector of active fetchers. | 46 // Removes fetcher from vector of active fetchers. |
| 47 - (void)removeFetcher:(web::URLFetcherBlockAdapter*)fetcher; | 47 - (void)removeFetcher:(web::URLFetcherBlockAdapter*)fetcher; |
| 48 | 48 |
| 49 @end | 49 @end |
| 50 | 50 |
| 51 @implementation CRWWebUIManager { | 51 @implementation CRWWebUIManager { |
| 52 // Set of live WebUI fetchers for retrieving data. | 52 // Set of live WebUI fetchers for retrieving data. |
| 53 ScopedVector<web::URLFetcherBlockAdapter> _fetchers; | 53 ScopedVector<web::URLFetcherBlockAdapter> _fetchers; |
| 54 // Bridge to observe the web state from Objective-C. | 54 // Bridge to observe the web state from Objective-C. |
| 55 scoped_ptr<web::WebStateObserverBridge> _webStateObserverBridge; | 55 std::unique_ptr<web::WebStateObserverBridge> _webStateObserverBridge; |
| 56 // Weak WebStateImpl this CRWWebUIManager is associated with. | 56 // Weak WebStateImpl this CRWWebUIManager is associated with. |
| 57 web::WebStateImpl* _webState; | 57 web::WebStateImpl* _webState; |
| 58 } | 58 } |
| 59 | 59 |
| 60 - (instancetype)init { | 60 - (instancetype)init { |
| 61 NOTREACHED(); | 61 NOTREACHED(); |
| 62 return self; | 62 return self; |
| 63 } | 63 } |
| 64 | 64 |
| 65 - (instancetype)initWithWebState:(web::WebStateImpl*)webState { | 65 - (instancetype)initWithWebState:(web::WebStateImpl*)webState { |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 208 - (web::WebStateImpl*)webState { | 208 - (web::WebStateImpl*)webState { |
| 209 return _webState; | 209 return _webState; |
| 210 } | 210 } |
| 211 | 211 |
| 212 - (void)removeFetcher:(web::URLFetcherBlockAdapter*)fetcher { | 212 - (void)removeFetcher:(web::URLFetcherBlockAdapter*)fetcher { |
| 213 _fetchers.erase(std::find(_fetchers.begin(), _fetchers.end(), fetcher)); | 213 _fetchers.erase(std::find(_fetchers.begin(), _fetchers.end(), fetcher)); |
| 214 } | 214 } |
| 215 | 215 |
| 216 #pragma mark - Testing-Only Methods | 216 #pragma mark - Testing-Only Methods |
| 217 | 217 |
| 218 - (scoped_ptr<web::URLFetcherBlockAdapter>) | 218 - (std::unique_ptr<web::URLFetcherBlockAdapter>) |
| 219 fetcherForURL:(const GURL&)URL | 219 fetcherForURL:(const GURL&)URL |
| 220 completionHandler:(web::URLFetcherBlockAdapterCompletion)handler { | 220 completionHandler:(web::URLFetcherBlockAdapterCompletion)handler { |
| 221 return scoped_ptr<web::URLFetcherBlockAdapter>( | 221 return std::unique_ptr<web::URLFetcherBlockAdapter>( |
| 222 new web::URLFetcherBlockAdapter( | 222 new web::URLFetcherBlockAdapter( |
| 223 URL, _webState->GetBrowserState()->GetRequestContext(), handler)); | 223 URL, _webState->GetBrowserState()->GetRequestContext(), handler)); |
| 224 } | 224 } |
| 225 | 225 |
| 226 @end | 226 @end |
| OLD | NEW |