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

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

Issue 1901343002: [ios] Do not use private web// API in ios_web_shell. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added missing include 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 #import "ios/net/request_tracker.h"
19 #import "ios/web/public/navigation_manager.h"
18 #include "ios/web/public/referrer.h" 20 #include "ios/web/public/referrer.h"
19 #include "ios/web/public/web_state/web_state.h" 21 #include "ios/web/public/web_state/web_state.h"
20 #import "ios/web/public/web_state/web_state_delegate_bridge.h" 22 #import "ios/web/public/web_state/web_state_delegate_bridge.h"
21 #import "ios/web/public/web_state/web_state_observer_bridge.h" 23 #import "ios/web/public/web_state/web_state_observer_bridge.h"
22 #include "ios/web/shell/shell_browser_state.h"
23 #include "ios/web/web_state/web_state_impl.h"
24 #include "ui/base/page_transition_types.h" 24 #include "ui/base/page_transition_types.h"
25 25
26 NSString* const kWebShellBackButtonAccessibilityLabel = @"Back"; 26 NSString* const kWebShellBackButtonAccessibilityLabel = @"Back";
27 NSString* const kWebShellForwardButtonAccessibilityLabel = @"Forward"; 27 NSString* const kWebShellForwardButtonAccessibilityLabel = @"Forward";
28 NSString* const kWebShellAddressFieldAccessibilityLabel = @"Address field"; 28 NSString* const kWebShellAddressFieldAccessibilityLabel = @"Address field";
29 29
30 using web::NavigationManager; 30 using web::NavigationManager;
31 31
32 @interface ViewController ()<CRWWebStateDelegate, 32 @interface ViewController ()<CRWWebStateDelegate,
33 CRWWebStateObserver, 33 CRWWebStateObserver,
34 UITextFieldDelegate> { 34 UITextFieldDelegate> {
35 web::BrowserState* _browserState; 35 web::BrowserState* _browserState;
36 std::unique_ptr<web::WebStateImpl> _webState; 36 std::unique_ptr<web::WebState> _webState;
37 std::unique_ptr<web::WebStateObserverBridge> _webStateObserver; 37 std::unique_ptr<web::WebStateObserverBridge> _webStateObserver;
38 std::unique_ptr<web::WebStateDelegateBridge> _webStateDelegate; 38 std::unique_ptr<web::WebStateDelegateBridge> _webStateDelegate;
39 39
40 base::mac::ObjCPropertyReleaser _propertyReleaser_ViewController; 40 base::mac::ObjCPropertyReleaser _propertyReleaser_ViewController;
41 } 41 }
42 @property(nonatomic, assign, readonly) NavigationManager* navigationManager; 42 @property(nonatomic, assign, readonly) NavigationManager* navigationManager;
43 @property(nonatomic, readwrite, retain) UITextField* field; 43 @property(nonatomic, readwrite, retain) UITextField* field;
44 @end 44 @end
45 45
46 @implementation ViewController 46 @implementation ViewController
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 [field setClearButtonMode:UITextFieldViewModeWhileEditing]; 104 [field setClearButtonMode:UITextFieldViewModeWhileEditing];
105 self.field = field; 105 self.field = field;
106 106
107 [_toolbarView addSubview:back]; 107 [_toolbarView addSubview:back];
108 [_toolbarView addSubview:forward]; 108 [_toolbarView addSubview:forward];
109 [_toolbarView addSubview:field]; 109 [_toolbarView addSubview:field];
110 110
111 // Set up the network stack before creating the WebState. 111 // Set up the network stack before creating the WebState.
112 [self setUpNetworkStack]; 112 [self setUpNetworkStack];
113 113
114 _webState.reset(new web::WebStateImpl(_browserState)); 114 web::WebState::CreateParams web_state_create_params(_browserState);
rohitrao (ping after 24h) 2016/04/21 00:17:18 webStateCreateParams?
Eugene But (OOO till 7-30) 2016/04/21 00:48:16 Done.
115 _webState->GetNavigationManagerImpl().InitializeSession(nil, nil, NO, 0); 115 _webState = web::WebState::Create(web_state_create_params);
116 _webState->SetWebUsageEnabled(true); 116 _webState->SetWebUsageEnabled(true);
117 117
118 _webStateObserver.reset( 118 _webStateObserver.reset(
119 new web::WebStateObserverBridge(_webState.get(), self)); 119 new web::WebStateObserverBridge(_webState.get(), self));
120 _webStateDelegate.reset(new web::WebStateDelegateBridge(self)); 120 _webStateDelegate.reset(new web::WebStateDelegateBridge(self));
121 _webState->SetDelegate(_webStateDelegate.get()); 121 _webState->SetDelegate(_webStateDelegate.get());
122 122
123 UIView* view = _webState->GetView(); 123 UIView* view = _webState->GetView();
124 [view setFrame:[_containerView bounds]]; 124 [view setFrame:[_containerView bounds]];
125 [_containerView addSubview:view]; 125 [_containerView addSubview:view];
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
252 (const web::LoadCommittedDetails&)details { 252 (const web::LoadCommittedDetails&)details {
253 [self updateToolbar]; 253 [self updateToolbar];
254 } 254 }
255 255
256 - (void)webStateDidLoadPage:(web::WebState*)webState { 256 - (void)webStateDidLoadPage:(web::WebState*)webState {
257 DCHECK_EQ(_webState.get(), webState); 257 DCHECK_EQ(_webState.get(), webState);
258 [self updateToolbar]; 258 [self updateToolbar];
259 } 259 }
260 260
261 @end 261 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698