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

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

Issue 2617243002: Remove ScopedVector from ios/. (Closed)
Patch Set: rebase Created 3 years, 11 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/web_state/ui/crw_web_controller.mm ('k') | ios/web/webui/web_ui_ios_impl.h » ('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>
8 #include <vector>
9
7 #include "base/json/string_escape.h" 10 #include "base/json/string_escape.h"
8 #import "base/mac/bind_objc_block.h" 11 #import "base/mac/bind_objc_block.h"
9 #import "base/mac/scoped_nsobject.h" 12 #import "base/mac/scoped_nsobject.h"
13 #include "base/memory/ptr_util.h"
10 #include "base/memory/ref_counted_memory.h" 14 #include "base/memory/ref_counted_memory.h"
11 #include "base/memory/scoped_vector.h"
12 #include "base/strings/stringprintf.h" 15 #include "base/strings/stringprintf.h"
13 #import "base/strings/sys_string_conversions.h" 16 #import "base/strings/sys_string_conversions.h"
14 #include "base/strings/utf_string_conversions.h" 17 #include "base/strings/utf_string_conversions.h"
15 #include "base/values.h" 18 #include "base/values.h"
16 #include "ios/web/grit/ios_web_resources.h" 19 #include "ios/web/grit/ios_web_resources.h"
17 #import "ios/web/net/request_group_util.h" 20 #import "ios/web/net/request_group_util.h"
18 #include "ios/web/public/browser_state.h" 21 #include "ios/web/public/browser_state.h"
19 #import "ios/web/public/web_client.h" 22 #import "ios/web/public/web_client.h"
20 #import "ios/web/public/web_state/web_state_observer_bridge.h" 23 #import "ios/web/public/web_state/web_state_observer_bridge.h"
21 #import "ios/web/web_state/web_state_impl.h" 24 #import "ios/web/web_state/web_state_impl.h"
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 // Removes favicon callback from web state. 65 // Removes favicon callback from web state.
63 - (void)resetWebState; 66 - (void)resetWebState;
64 67
65 // Removes fetcher from vector of active fetchers. 68 // Removes fetcher from vector of active fetchers.
66 - (void)removeFetcher:(web::URLFetcherBlockAdapter*)fetcher; 69 - (void)removeFetcher:(web::URLFetcherBlockAdapter*)fetcher;
67 70
68 @end 71 @end
69 72
70 @implementation CRWWebUIManager { 73 @implementation CRWWebUIManager {
71 // Set of live WebUI fetchers for retrieving data. 74 // Set of live WebUI fetchers for retrieving data.
72 ScopedVector<web::URLFetcherBlockAdapter> _fetchers; 75 std::vector<std::unique_ptr<web::URLFetcherBlockAdapter>> _fetchers;
73 // Bridge to observe the web state from Objective-C. 76 // Bridge to observe the web state from Objective-C.
74 std::unique_ptr<web::WebStateObserverBridge> _webStateObserverBridge; 77 std::unique_ptr<web::WebStateObserverBridge> _webStateObserverBridge;
75 // Weak WebStateImpl this CRWWebUIManager is associated with. 78 // Weak WebStateImpl this CRWWebUIManager is associated with.
76 web::WebStateImpl* _webState; 79 web::WebStateImpl* _webState;
77 } 80 }
78 81
79 - (instancetype)init { 82 - (instancetype)init {
80 NOTREACHED(); 83 NOTREACHED();
81 return self; 84 return self;
82 } 85 }
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
286 _webState->RemoveScriptCommandCallback(kScriptCommandPrefix); 289 _webState->RemoveScriptCommandCallback(kScriptCommandPrefix);
287 } 290 }
288 _webState = nullptr; 291 _webState = nullptr;
289 } 292 }
290 293
291 - (web::WebStateImpl*)webState { 294 - (web::WebStateImpl*)webState {
292 return _webState; 295 return _webState;
293 } 296 }
294 297
295 - (void)removeFetcher:(web::URLFetcherBlockAdapter*)fetcher { 298 - (void)removeFetcher:(web::URLFetcherBlockAdapter*)fetcher {
296 _fetchers.erase(std::find(_fetchers.begin(), _fetchers.end(), fetcher)); 299 _fetchers.erase(std::find_if(
300 _fetchers.begin(), _fetchers.end(),
301 [fetcher](const std::unique_ptr<web::URLFetcherBlockAdapter>& ptr) {
302 return ptr.get() == fetcher;
303 }));
297 } 304 }
298 305
299 #pragma mark - Testing-Only Methods 306 #pragma mark - Testing-Only Methods
300 307
301 - (std::unique_ptr<web::URLFetcherBlockAdapter>) 308 - (std::unique_ptr<web::URLFetcherBlockAdapter>)
302 fetcherForURL:(const GURL&)URL 309 fetcherForURL:(const GURL&)URL
303 completionHandler:(web::URLFetcherBlockAdapterCompletion)handler { 310 completionHandler:(web::URLFetcherBlockAdapterCompletion)handler {
304 return std::unique_ptr<web::URLFetcherBlockAdapter>( 311 return base::MakeUnique<web::URLFetcherBlockAdapter>(
305 new web::URLFetcherBlockAdapter( 312 URL, _webState->GetBrowserState()->GetRequestContext(), handler);
306 URL, _webState->GetBrowserState()->GetRequestContext(), handler));
307 } 313 }
308 314
309 @end 315 @end
OLDNEW
« no previous file with comments | « ios/web/web_state/ui/crw_web_controller.mm ('k') | ios/web/webui/web_ui_ios_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698