| 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 #include "ios/public/provider/web/web_controller_provider.h" | 5 #include "ios/public/provider/web/web_controller_provider.h" |
| 6 | 6 |
| 7 #if !defined(__has_feature) || !__has_feature(objc_arc) | 7 #if !defined(__has_feature) || !__has_feature(objc_arc) |
| 8 #error "This file requires ARC support." | 8 #error "This file requires ARC support." |
| 9 #endif | 9 #endif |
| 10 | 10 |
| 11 namespace ios { | 11 namespace ios { |
| 12 | 12 |
| 13 static WebControllerProviderFactory* g_web_controller_provider_factory; | |
| 14 | |
| 15 void SetWebControllerProviderFactory( | |
| 16 WebControllerProviderFactory* provider_factory) { | |
| 17 g_web_controller_provider_factory = provider_factory; | |
| 18 } | |
| 19 | |
| 20 WebControllerProviderFactory* GetWebControllerProviderFactory() { | |
| 21 return g_web_controller_provider_factory; | |
| 22 } | |
| 23 | |
| 24 WebControllerProvider::WebControllerProvider(web::BrowserState* browser_state) { | 13 WebControllerProvider::WebControllerProvider(web::BrowserState* browser_state) { |
| 25 } | 14 } |
| 26 | 15 |
| 27 WebControllerProvider::~WebControllerProvider() { | 16 WebControllerProvider::~WebControllerProvider() {} |
| 28 } | |
| 29 | 17 |
| 30 bool WebControllerProvider::SuppressesDialogs() const { | 18 bool WebControllerProvider::SuppressesDialogs() const { |
| 31 return false; | 19 return false; |
| 32 } | 20 } |
| 33 | 21 |
| 34 web::WebState* WebControllerProvider::GetWebState() const { | 22 web::WebState* WebControllerProvider::GetWebState() const { |
| 35 return nullptr; | 23 return nullptr; |
| 36 } | 24 } |
| 37 | 25 |
| 38 void WebControllerProvider::InjectScript( | 26 void WebControllerProvider::InjectScript( |
| 39 const std::string& script, | 27 const std::string& script, |
| 40 web::JavaScriptResultBlock completion) { | 28 web::JavaScriptResultBlock completion) { |
| 41 if (completion) | 29 if (completion) |
| 42 completion(nil, nil); | 30 completion(nil, nil); |
| 43 } | 31 } |
| 44 | 32 |
| 45 WebControllerProviderFactory::WebControllerProviderFactory() { | |
| 46 } | |
| 47 | |
| 48 WebControllerProviderFactory::~WebControllerProviderFactory() { | |
| 49 } | |
| 50 | |
| 51 std::unique_ptr<WebControllerProvider> | |
| 52 WebControllerProviderFactory::CreateWebControllerProvider( | |
| 53 web::BrowserState* browser_state) { | |
| 54 return std::unique_ptr<WebControllerProvider>( | |
| 55 new WebControllerProvider(browser_state)); | |
| 56 } | |
| 57 | |
| 58 } // namespace ios | 33 } // namespace ios |
| OLD | NEW |