Commit ccadc0dd authored by Eugene But's avatar Eugene But Committed by Commit Bot

Remove crw_generic_content_view.h as unused.

Previously this class was used for SadTab presentation.

Bug: 616244
Change-Id: I8f8fcf722e79a723dd279c0be5f4348e3876069e
Reviewed-on: https://chromium-review.googlesource.com/c/1467983Reviewed-by: default avatarKurt Horimoto <kkhorimoto@chromium.org>
Commit-Queue: Eugene But <eugenebut@chromium.org>
Cr-Commit-Position: refs/heads/master@{#632360}
parent 98654186
......@@ -83,7 +83,6 @@
#include "ios/web/public/web_client.h"
#import "ios/web/public/web_state/js/crw_js_injection_receiver.h"
#import "ios/web/public/web_state/navigation_context.h"
#import "ios/web/public/web_state/ui/crw_generic_content_view.h"
#import "ios/web/public/web_state/web_state.h"
#import "ios/web/public/web_state/web_state_observer_bridge.h"
#include "ios/web/public/web_thread.h"
......
......@@ -13,7 +13,6 @@
#import "ios/web/public/test/fakes/fake_navigation_context.h"
#import "ios/web/public/test/fakes/test_navigation_manager.h"
#import "ios/web/public/test/fakes/test_web_state.h"
#import "ios/web/public/web_state/ui/crw_generic_content_view.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "testing/platform_test.h"
#import "third_party/ocmock/OCMock/OCMock.h"
......
......@@ -71,7 +71,6 @@ source_set("public") {
"web_state/session_certificate_policy_cache.h",
"web_state/ui/crw_content_view.h",
"web_state/ui/crw_context_menu_delegate.h",
"web_state/ui/crw_generic_content_view.h",
"web_state/ui/crw_native_content.h",
"web_state/ui/crw_native_content_provider.h",
"web_state/ui/crw_web_view_content_view.h",
......
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef IOS_WEB_PUBLIC_WEB_STATE_UI_CRW_GENERIC_CONTENT_VIEW_H_
#define IOS_WEB_PUBLIC_WEB_STATE_UI_CRW_GENERIC_CONTENT_VIEW_H_
#import "ios/web/public/web_state/ui/crw_content_view.h"
// Wraps an arbitrary native UIView in a CRWContentView.
@interface CRWGenericContentView : CRWContentView
// The view that was passed to |-initWithContentView:|. This is the view that
// is displayed in |self.scrollView|.
@property(nonatomic, strong, readonly) UIView* view;
// Initializes the CRWNativeContentContainerView to display |view|, which
// will be added to the scroll view.
- (instancetype)initWithView:(UIView*)view NS_DESIGNATED_INITIALIZER;
// CRWGenericContentViews should be initialized via |-initWithView:|.
- (instancetype)initWithCoder:(NSCoder*)decoder NS_UNAVAILABLE;
- (instancetype)initWithFrame:(CGRect)frame NS_UNAVAILABLE;
@end
#endif // IOS_WEB_PUBLIC_WEB_STATE_UI_CRW_GENERIC_CONTENT_VIEW_H_
......@@ -39,7 +39,6 @@ source_set("ui") {
]
sources = [
"crw_generic_content_view.mm",
"crw_swipe_recognizer_provider.h",
"crw_touch_tracking_recognizer.h",
"crw_touch_tracking_recognizer.mm",
......
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#import "ios/web/public/web_state/ui/crw_generic_content_view.h"
#include "base/logging.h"
#if !defined(__has_feature) || !__has_feature(objc_arc)
#error "This file requires ARC support."
#endif
@interface CRWGenericContentView () {
// The size of the view's bounds at the last call to |-layoutSubviews|.
CGSize _lastLayoutSize;
// Backing objectect for |self.scrollView|.
UIScrollView* _scrollView;
// Backing object for |self.view|.
UIView* _view;
}
@end
@implementation CRWGenericContentView
@synthesize contentOffset = _contentOffset;
- (instancetype)initWithView:(UIView*)view {
self = [super initWithFrame:CGRectZero];
if (self) {
DCHECK(view);
_lastLayoutSize = CGSizeZero;
_view = view;
_scrollView = [[UIScrollView alloc] initWithFrame:CGRectZero];
[self addSubview:_scrollView];
[_scrollView addSubview:_view];
[_scrollView setBackgroundColor:[_view backgroundColor]];
}
return self;
}
- (instancetype)initWithCoder:(NSCoder*)decoder {
NOTREACHED();
return nil;
}
- (instancetype)initWithFrame:(CGRect)frame {
NOTREACHED();
return nil;
}
#pragma mark Accessors
- (UIScrollView*)scrollView {
if (!_scrollView) {
_scrollView = [[UIScrollView alloc] initWithFrame:CGRectZero];
}
return _scrollView;
}
- (UIEdgeInsets)contentInset {
return self.scrollView.contentInset;
}
- (void)setContentInset:(UIEdgeInsets)contentInset {
self.scrollView.contentInset = contentInset;
}
- (UIView*)view {
return _view;
}
#pragma mark Layout
- (void)layoutSubviews {
[super layoutSubviews];
// Early return if the bounds' size hasn't changed since the last layout.
if (CGSizeEqualToSize(_lastLayoutSize, self.bounds.size))
return;
_lastLayoutSize = self.bounds.size;
// scrollView layout.
self.scrollView.frame = self.bounds;
// view layout.
CGRect contentRect =
UIEdgeInsetsInsetRect(self.bounds, self.scrollView.contentInset);
CGSize viewSize = [self.view sizeThatFits:contentRect.size];
self.view.frame = CGRectMake(0.0, 0.0, viewSize.width, viewSize.height);
// UIScrollViews only scroll vertically if the content size's height is
// greater than that of its bounds.
if (viewSize.height <= _lastLayoutSize.height) {
CGFloat singlePixel = 1.0f / [[UIScreen mainScreen] scale];
viewSize.height = _lastLayoutSize.height + singlePixel;
}
self.scrollView.contentSize = viewSize;
}
- (BOOL)isViewAlive {
return YES;
}
@end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment