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

Side by Side Diff: ios/web/shell/view_controller.mm

Issue 1891483005: [ios] Added API to enable/disable web usage for WebState. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Self review Created 4 years, 8 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/shell/view_controller.h" 5 #import "ios/web/shell/view_controller.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include <memory> 9 #include <memory>
10 #include <utility> 10 #include <utility>
11 11
12 #include "base/mac/objc_property_releaser.h" 12 #include "base/mac/objc_property_releaser.h"
13 #import "base/mac/scoped_nsobject.h" 13 #import "base/mac/scoped_nsobject.h"
14 #include "base/strings/sys_string_conversions.h" 14 #include "base/strings/sys_string_conversions.h"
15 #include "ios/net/cookies/cookie_store_ios.h" 15 #include "ios/net/cookies/cookie_store_ios.h"
16 #import "ios/net/crn_http_protocol_handler.h" 16 #import "ios/net/crn_http_protocol_handler.h"
17 #import "ios/net/empty_nsurlcache.h" 17 #import "ios/net/empty_nsurlcache.h"
18 #include "ios/web/public/referrer.h" 18 #include "ios/web/public/referrer.h"
19 #include "ios/web/public/web_state/web_state.h" 19 #include "ios/web/public/web_state/web_state.h"
20 #import "ios/web/public/web_state/web_state_delegate_bridge.h" 20 #import "ios/web/public/web_state/web_state_delegate_bridge.h"
21 #import "ios/web/public/web_state/web_state_observer_bridge.h" 21 #import "ios/web/public/web_state/web_state_observer_bridge.h"
22 #include "ios/web/shell/shell_browser_state.h" 22 #include "ios/web/shell/shell_browser_state.h"
23 #include "ios/web/web_state/ui/crw_web_controller.h"
24 #include "ios/web/web_state/web_state_impl.h" 23 #include "ios/web/web_state/web_state_impl.h"
25 #include "ui/base/page_transition_types.h" 24 #include "ui/base/page_transition_types.h"
26 25
27 NSString* const kWebShellBackButtonAccessibilityLabel = @"Back"; 26 NSString* const kWebShellBackButtonAccessibilityLabel = @"Back";
28 NSString* const kWebShellForwardButtonAccessibilityLabel = @"Forward"; 27 NSString* const kWebShellForwardButtonAccessibilityLabel = @"Forward";
29 NSString* const kWebShellAddressFieldAccessibilityLabel = @"Address field"; 28 NSString* const kWebShellAddressFieldAccessibilityLabel = @"Address field";
30 29
31 using web::NavigationManager; 30 using web::NavigationManager;
32 31
33 @interface ViewController ()<CRWWebStateDelegate, 32 @interface ViewController ()<CRWWebStateDelegate,
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 106
108 [_toolbarView addSubview:back]; 107 [_toolbarView addSubview:back];
109 [_toolbarView addSubview:forward]; 108 [_toolbarView addSubview:forward];
110 [_toolbarView addSubview:field]; 109 [_toolbarView addSubview:field];
111 110
112 // Set up the network stack before creating the WebState. 111 // Set up the network stack before creating the WebState.
113 [self setUpNetworkStack]; 112 [self setUpNetworkStack];
114 113
115 _webState.reset(new web::WebStateImpl(_browserState)); 114 _webState.reset(new web::WebStateImpl(_browserState));
116 _webState->GetNavigationManagerImpl().InitializeSession(nil, nil, NO, 0); 115 _webState->GetNavigationManagerImpl().InitializeSession(nil, nil, NO, 0);
117 [_webState->GetWebController() setWebUsageEnabled:YES]; 116 _webState->SetWebUsageEnabled(true);
118 117
119 _webStateObserver.reset( 118 _webStateObserver.reset(
120 new web::WebStateObserverBridge(_webState.get(), self)); 119 new web::WebStateObserverBridge(_webState.get(), self));
121 _webStateDelegate.reset(new web::WebStateDelegateBridge(self)); 120 _webStateDelegate.reset(new web::WebStateDelegateBridge(self));
122 _webState->SetDelegate(_webStateDelegate.get()); 121 _webState->SetDelegate(_webStateDelegate.get());
123 122
124 UIView* view = _webState->GetView(); 123 UIView* view = _webState->GetView();
125 [view setFrame:[_containerView bounds]]; 124 [view setFrame:[_containerView bounds]];
126 [_containerView addSubview:view]; 125 [_containerView addSubview:view];
127 126
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
253 (const web::LoadCommittedDetails&)details { 252 (const web::LoadCommittedDetails&)details {
254 [self updateToolbar]; 253 [self updateToolbar];
255 } 254 }
256 255
257 - (void)webStateDidLoadPage:(web::WebState*)webState { 256 - (void)webStateDidLoadPage:(web::WebState*)webState {
258 DCHECK_EQ(_webState.get(), webState); 257 DCHECK_EQ(_webState.get(), webState);
259 [self updateToolbar]; 258 [self updateToolbar];
260 } 259 }
261 260
262 @end 261 @end
OLDNEW
« ios/web/shell/DEPS ('K') | « ios/web/shell/DEPS ('k') | ios/web/test/web_test.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698