OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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/public/provider/chrome/browser/ui/default_ios_web_view_factory.h" | 5 #import "ios/public/provider/chrome/browser/ui/default_ios_web_view_factory.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 | 8 |
| 9 #if !defined(__has_feature) || !__has_feature(objc_arc) |
| 10 #error "This file requires ARC support." |
| 11 #endif |
| 12 |
9 namespace { | 13 namespace { |
10 Class g_registered_factory_class = nil; | 14 Class g_registered_factory_class = nil; |
11 } // namespace | 15 } // namespace |
12 | 16 |
13 @implementation DefaultIOSWebViewFactory | 17 @implementation DefaultIOSWebViewFactory |
14 | 18 |
15 + (void)registerWebViewFactory:(Class)webViewFactoryClass { | 19 + (void)registerWebViewFactory:(Class)webViewFactoryClass { |
16 DCHECK([webViewFactoryClass conformsToProtocol:@protocol(IOSWebViewFactory)]); | 20 DCHECK([webViewFactoryClass conformsToProtocol:@protocol(IOSWebViewFactory)]); |
17 g_registered_factory_class = webViewFactoryClass; | 21 g_registered_factory_class = webViewFactoryClass; |
18 } | 22 } |
19 | 23 |
20 #pragma mark - | 24 #pragma mark - |
21 #pragma mark IOSWebViewFactory | 25 #pragma mark IOSWebViewFactory |
22 | 26 |
23 + (UIWebView*) | 27 + (UIWebView*) |
24 newExternalWebView:(IOSWebViewFactoryExternalService)externalService { | 28 newExternalWebView:(IOSWebViewFactoryExternalService)externalService { |
25 if (g_registered_factory_class) | 29 if (g_registered_factory_class) |
26 return [g_registered_factory_class newExternalWebView:externalService]; | 30 return [g_registered_factory_class newExternalWebView:externalService]; |
27 return [[UIWebView alloc] init]; | 31 return [[UIWebView alloc] init]; |
28 } | 32 } |
29 | 33 |
30 @end | 34 @end |
OLD | NEW |