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

Unified Diff: ios/web_view/internal/criwv_web_view.mm

Issue 2675633002: Let CRIWVWebView inherit UIView instead of NSObject. (Closed)
Patch Set: Fix format. Created 3 years, 11 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 side-by-side diff with in-line comments
Download patch
Index: ios/web_view/internal/criwv_web_view.mm
diff --git a/ios/web_view/internal/criwv_web_view_impl.mm b/ios/web_view/internal/criwv_web_view.mm
similarity index 85%
rename from ios/web_view/internal/criwv_web_view_impl.mm
rename to ios/web_view/internal/criwv_web_view.mm
index 924ac2ef587a688bc085b6ae5d0eef56ca9d80d3..87f7c889a881b3e68445b75a877df4b0e0c156d2 100644
--- a/ios/web_view/internal/criwv_web_view_impl.mm
+++ b/ios/web_view/internal/criwv_web_view.mm
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#import "ios/web_view/internal/criwv_web_view_impl.h"
+#import "ios/web_view/internal/criwv_web_view_internal.h"
#include <memory>
#include <utility>
@@ -23,7 +23,7 @@
#include "ui/base/page_transition_types.h"
#include "url/gurl.h"
-@interface CRIWVWebViewImpl ()<CRWWebStateDelegate, CRWWebStateObserver> {
+@interface CRIWVWebView ()<CRWWebStateDelegate, CRWWebStateObserver> {
id<CRIWVWebViewDelegate> _delegate;
ios_web_view::CRIWVBrowserState* _browserState;
std::unique_ptr<web::WebState> _webState;
@@ -34,14 +34,24 @@
@end
-@implementation CRIWVWebViewImpl
+@implementation CRIWVWebView
@synthesize delegate = _delegate;
@synthesize loadProgress = _loadProgress;
-- (instancetype)initWithBrowserState:
- (ios_web_view::CRIWVBrowserState*)browserState {
- self = [super init];
+- (instancetype)initWithFrame:(CGRect)frame {
+ NSAssert(NO, @"Should not be called");
michaeldo 2017/02/02 19:39:18 Please use NOTREACHED() instead of NSAssert for bo
Eugene But (OOO till 7-30) 2017/02/02 20:54:32 Do we even need this implementation? No one can ca
Hiroshi Ichikawa 2017/02/03 02:14:57 Good point, I found that I don't need this impleme
+ return nil;
+}
+
+- (instancetype)initWithCoder:(NSCoder*)aDecoder {
+ NSAssert(NO, @"Should not be called");
+ return nil;
+}
+
+- (instancetype)initWithFrame:(CGRect)frame
+ browserState:(ios_web_view::CRIWVBrowserState*)browserState {
+ self = [super initWithFrame:frame];
if (self) {
_browserState = browserState;
@@ -60,6 +70,15 @@
return self;
}
+- (void)willMoveToSuperview:(UIView*)newSuperview {
+ [super willMoveToSuperview:newSuperview];
+ UIView* subview = _webState->GetView();
+ subview.frame = self.frame;
Eugene But (OOO till 7-30) 2017/02/02 20:54:32 Do you need to check if |subview| is already a sub
Hiroshi Ichikawa 2017/02/03 02:14:57 Done.
+ subview.autoresizingMask =
+ UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
+ [self addSubview:subview];
+}
+
- (UIView*)view {
return _webState->GetView();
}

Powered by Google App Engine
This is Rietveld 408576698