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/public/web_controller_factory.h" | 5 #import "ios/web/public/web_controller_factory.h" |
6 | 6 |
| 7 #include <utility> |
| 8 |
7 #include "ios/web/public/browser_state.h" | 9 #include "ios/web/public/browser_state.h" |
8 #import "ios/web/web_state/ui/crw_ui_web_view_web_controller.h" | 10 #import "ios/web/web_state/ui/crw_ui_web_view_web_controller.h" |
9 #import "ios/web/web_state/ui/crw_wk_web_view_web_controller.h" | 11 #import "ios/web/web_state/ui/crw_wk_web_view_web_controller.h" |
10 #include "ios/web/web_state/web_state_impl.h" | 12 #include "ios/web/web_state/web_state_impl.h" |
11 | 13 |
12 namespace web { | 14 namespace web { |
13 | 15 |
14 CRWWebController* CreateWebController(WebViewType web_view_type, | 16 CRWWebController* CreateWebController(WebViewType web_view_type, |
15 scoped_ptr<WebStateImpl> web_state) { | 17 scoped_ptr<WebStateImpl> web_state) { |
16 switch (web_view_type) { | 18 switch (web_view_type) { |
17 case UI_WEB_VIEW_TYPE: | 19 case UI_WEB_VIEW_TYPE: |
18 return | 20 return [[CRWUIWebViewWebController alloc] |
19 [[CRWUIWebViewWebController alloc] initWithWebState:web_state.Pass()]; | 21 initWithWebState:std::move(web_state)]; |
20 case WK_WEB_VIEW_TYPE: | 22 case WK_WEB_VIEW_TYPE: |
21 return | 23 return [[CRWWKWebViewWebController alloc] |
22 [[CRWWKWebViewWebController alloc] initWithWebState:web_state.Pass()]; | 24 initWithWebState:std::move(web_state)]; |
23 } | 25 } |
24 NOTREACHED(); | 26 NOTREACHED(); |
25 return nil; | 27 return nil; |
26 } | 28 } |
27 | 29 |
28 CRWWebController* CreateWebController(WebViewType web_view_type, | 30 CRWWebController* CreateWebController(WebViewType web_view_type, |
29 BrowserState* browser_state) { | 31 BrowserState* browser_state) { |
30 DCHECK(browser_state); | 32 DCHECK(browser_state); |
31 scoped_ptr<web::WebStateImpl> web_state(new web::WebStateImpl(browser_state)); | 33 scoped_ptr<web::WebStateImpl> web_state(new web::WebStateImpl(browser_state)); |
32 web_state->GetNavigationManagerImpl().InitializeSession(nil, nil, NO, -1); | 34 web_state->GetNavigationManagerImpl().InitializeSession(nil, nil, NO, -1); |
33 return CreateWebController(web_view_type, web_state.Pass()); | 35 return CreateWebController(web_view_type, std::move(web_state)); |
34 } | 36 } |
35 | 37 |
36 } // namespace web | 38 } // namespace web |
OLD | NEW |