OLD | NEW |
---|---|
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_view/public/cwv.h" | 5 #import "ios/web_view/public/cwv.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 | 8 |
9 #include "base/location.h" | 9 #include "base/location.h" |
10 #import "base/mac/bind_objc_block.h" | 10 #import "base/mac/bind_objc_block.h" |
11 #import "base/mac/bundle_locations.h" | |
11 #include "base/memory/ptr_util.h" | 12 #include "base/memory/ptr_util.h" |
12 #include "base/single_thread_task_runner.h" | 13 #include "base/single_thread_task_runner.h" |
13 #include "ios/web/public/app/web_main.h" | 14 #include "ios/web/public/app/web_main.h" |
14 #include "ios/web/public/web_thread.h" | 15 #include "ios/web/public/web_thread.h" |
15 #import "ios/web_view/internal/web_view_web_main_delegate.h" | 16 #import "ios/web_view/internal/web_view_web_main_delegate.h" |
16 #import "ios/web_view/public/cwv_delegate.h" | 17 #import "ios/web_view/public/cwv_delegate.h" |
17 #import "ios/web_view/public/cwv_web_view.h" | 18 #import "ios/web_view/public/cwv_web_view.h" |
18 #import "ios/web_view/public/cwv_web_view_configuration.h" | 19 #import "ios/web_view/public/cwv_web_view_configuration.h" |
19 #import "ios/web_view/public/cwv_website_data_store.h" | 20 #import "ios/web_view/public/cwv_website_data_store.h" |
20 | 21 |
(...skipping 13 matching lines...) Expand all Loading... | |
34 @property(nonatomic, weak) id<CWVDelegate> delegate; | 35 @property(nonatomic, weak) id<CWVDelegate> delegate; |
35 | 36 |
36 - (instancetype)initWithDelegate:(id<CWVDelegate>)delegate; | 37 - (instancetype)initWithDelegate:(id<CWVDelegate>)delegate; |
37 @end | 38 @end |
38 | 39 |
39 @implementation CWV | 40 @implementation CWV |
40 | 41 |
41 @synthesize delegate = _delegate; | 42 @synthesize delegate = _delegate; |
42 | 43 |
43 + (void)configureWithDelegate:(id<CWVDelegate>)delegate { | 44 + (void)configureWithDelegate:(id<CWVDelegate>)delegate { |
45 base::mac::SetOverrideFrameworkBundle([NSBundle bundleForClass:[self class]]); | |
sdefresne
2017/03/14 09:16:34
Why not putting this in WebViewWebMainParts::PreMa
michaeldo
2017/03/14 15:34:23
Excellent idea, I didn't know where the best place
| |
44 g_criwv = [[CWV alloc] initWithDelegate:delegate]; | 46 g_criwv = [[CWV alloc] initWithDelegate:delegate]; |
45 } | 47 } |
46 | 48 |
47 + (void)shutDown { | 49 + (void)shutDown { |
48 g_criwv = nil; | 50 g_criwv = nil; |
49 } | 51 } |
50 | 52 |
51 + (CWVWebView*)webViewWithFrame:(CGRect)frame { | 53 + (CWVWebView*)webViewWithFrame:(CGRect)frame { |
52 CWVWebViewConfiguration* configuration = | 54 CWVWebViewConfiguration* configuration = |
53 [[CWVWebViewConfiguration alloc] init]; | 55 [[CWVWebViewConfiguration alloc] init]; |
(...skipping 13 matching lines...) Expand all Loading... | |
67 } | 69 } |
68 return self; | 70 return self; |
69 } | 71 } |
70 | 72 |
71 - (void)dealloc { | 73 - (void)dealloc { |
72 _webMain.reset(); | 74 _webMain.reset(); |
73 _webMainDelegate.reset(); | 75 _webMainDelegate.reset(); |
74 } | 76 } |
75 | 77 |
76 @end | 78 @end |
OLD | NEW |