Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(206)

Side by Side Diff: ios/web_view/internal/cwv.mm

Issue 2747683002: Merge CWVWebsiteDataStore into CWVWebViewConfiguration. (Closed)
Patch Set: Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 #include "base/memory/ptr_util.h" 11 #include "base/memory/ptr_util.h"
12 #include "base/single_thread_task_runner.h" 12 #include "base/single_thread_task_runner.h"
13 #include "ios/web/public/app/web_main.h" 13 #include "ios/web/public/app/web_main.h"
14 #include "ios/web/public/web_thread.h" 14 #include "ios/web/public/web_thread.h"
15 #import "ios/web_view/internal/web_view_web_main_delegate.h" 15 #import "ios/web_view/internal/web_view_web_main_delegate.h"
16 #import "ios/web_view/public/cwv_delegate.h" 16 #import "ios/web_view/public/cwv_delegate.h"
17 #import "ios/web_view/public/cwv_web_view.h" 17 #import "ios/web_view/public/cwv_web_view.h"
18 #import "ios/web_view/public/cwv_web_view_configuration.h" 18 #import "ios/web_view/public/cwv_web_view_configuration.h"
19 #import "ios/web_view/public/cwv_website_data_store.h"
20 19
21 #if !defined(__has_feature) || !__has_feature(objc_arc) 20 #if !defined(__has_feature) || !__has_feature(objc_arc)
22 #error "This file requires ARC support." 21 #error "This file requires ARC support."
23 #endif 22 #endif
24 23
25 namespace { 24 namespace {
26 CWV* g_criwv = nil; 25 CWV* g_criwv = nil;
27 } 26 }
28 27
29 @interface CWV () { 28 @interface CWV () {
(...skipping 13 matching lines...) Expand all
43 + (void)configureWithDelegate:(id<CWVDelegate>)delegate { 42 + (void)configureWithDelegate:(id<CWVDelegate>)delegate {
44 g_criwv = [[CWV alloc] initWithDelegate:delegate]; 43 g_criwv = [[CWV alloc] initWithDelegate:delegate];
45 } 44 }
46 45
47 + (void)shutDown { 46 + (void)shutDown {
48 g_criwv = nil; 47 g_criwv = nil;
49 } 48 }
50 49
51 + (CWVWebView*)webViewWithFrame:(CGRect)frame { 50 + (CWVWebView*)webViewWithFrame:(CGRect)frame {
52 CWVWebViewConfiguration* configuration = 51 CWVWebViewConfiguration* configuration =
53 [[CWVWebViewConfiguration alloc] init]; 52 [CWVWebViewConfiguration defaultConfiguration];
54 configuration.websiteDataStore = [CWVWebsiteDataStore defaultDataStore];
55
56 return [[CWVWebView alloc] initWithFrame:frame configuration:configuration]; 53 return [[CWVWebView alloc] initWithFrame:frame configuration:configuration];
57 } 54 }
58 55
59 - (instancetype)initWithDelegate:(id<CWVDelegate>)delegate { 56 - (instancetype)initWithDelegate:(id<CWVDelegate>)delegate {
60 self = [super init]; 57 self = [super init];
61 if (self) { 58 if (self) {
62 _delegate = delegate; 59 _delegate = delegate;
63 _webMainDelegate = 60 _webMainDelegate =
64 base::MakeUnique<ios_web_view::WebViewWebMainDelegate>(_delegate); 61 base::MakeUnique<ios_web_view::WebViewWebMainDelegate>(_delegate);
65 web::WebMainParams params(_webMainDelegate.get()); 62 web::WebMainParams params(_webMainDelegate.get());
66 _webMain = base::MakeUnique<web::WebMain>(params); 63 _webMain = base::MakeUnique<web::WebMain>(params);
67 } 64 }
68 return self; 65 return self;
69 } 66 }
70 67
71 - (void)dealloc { 68 - (void)dealloc {
72 _webMain.reset(); 69 _webMain.reset();
73 _webMainDelegate.reset(); 70 _webMainDelegate.reset();
74 } 71 }
75 72
76 @end 73 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698