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

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, 10 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
« no previous file with comments | « ios/web_view/internal/criwv.mm ('k') | ios/web_view/internal/criwv_web_view_impl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 87%
rename from ios/web_view/internal/criwv_web_view_impl.mm
rename to ios/web_view/internal/criwv_web_view.mm
index 924ac2ef587a688bc085b6ae5d0eef56ca9d80d3..5982379984dae4a7aec04d1c1017e7a4ee245745 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>
@@ -10,8 +10,8 @@
#import "base/ios/weak_nsobject.h"
#include "base/memory/ptr_util.h"
#include "base/strings/sys_string_conversions.h"
-#include "ios/web/public/referrer.h"
#import "ios/web/public/navigation_manager.h"
+#include "ios/web/public/referrer.h"
#import "ios/web/public/web_state/ui/crw_web_delegate.h"
#import "ios/web/public/web_state/web_state.h"
#import "ios/web/public/web_state/web_state_delegate_bridge.h"
@@ -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,14 @@
@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
+ browserState:(ios_web_view::CRIWVBrowserState*)browserState {
+ self = [super initWithFrame:frame];
if (self) {
_browserState = browserState;
@@ -60,6 +60,18 @@
return self;
}
+- (void)willMoveToSuperview:(UIView*)newSuperview {
+ [super willMoveToSuperview:newSuperview];
+ UIView* subview = _webState->GetView();
+ if (subview.superview == self) {
+ return;
+ }
+ subview.frame = self.frame;
+ subview.autoresizingMask =
+ UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
+ [self addSubview:subview];
+}
+
- (UIView*)view {
return _webState->GetView();
}
« no previous file with comments | « ios/web_view/internal/criwv.mm ('k') | ios/web_view/internal/criwv_web_view_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698