Add ICU message format support
[chromium-blink-merge.git] / ios / web / public / web_controller_factory.mm
blobfe4641b7a82446fef03225f7c4bbd3d4f1fd6883
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
3 // found in the LICENSE file.
5 #import "ios/web/public/web_controller_factory.h"
7 #include "ios/web/public/browser_state.h"
8 #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"
10 #include "ios/web/web_state/web_state_impl.h"
12 namespace web {
14 CRWWebController* CreateWebController(WebViewType web_view_type,
15                                       scoped_ptr<WebStateImpl> web_state) {
16   switch (web_view_type) {
17     case UI_WEB_VIEW_TYPE:
18       return
19           [[CRWUIWebViewWebController alloc] initWithWebState:web_state.Pass()];
20     case WK_WEB_VIEW_TYPE:
21       return
22           [[CRWWKWebViewWebController alloc] initWithWebState:web_state.Pass()];
23   }
24   NOTREACHED();
25   return nil;
28 CRWWebController* CreateWebController(WebViewType web_view_type,
29                                       BrowserState* browser_state) {
30   DCHECK(browser_state);
31   scoped_ptr<web::WebStateImpl> web_state(new web::WebStateImpl(browser_state));
32   web_state->GetNavigationManagerImpl().InitializeSession(nil, nil, NO, -1);
33   return CreateWebController(web_view_type, web_state.Pass());
36 }  // namespace web