OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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/chrome/browser/ui/static_content/static_html_native_content.h" | 5 #import "ios/chrome/browser/ui/static_content/static_html_native_content.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #import "base/mac/scoped_nsobject.h" | 8 #import "base/mac/scoped_nsobject.h" |
9 #import "ios/chrome/browser/ui/overscroll_actions/overscroll_actions_controller.
h" | 9 #import "ios/chrome/browser/ui/overscroll_actions/overscroll_actions_controller.
h" |
10 #include "ios/chrome/browser/ui/static_content/static_html_view_controller.h" | 10 #include "ios/chrome/browser/ui/static_content/static_html_view_controller.h" |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 DCHECK(URL.is_valid()); | 61 DCHECK(URL.is_valid()); |
62 DCHECK(resourcePath); | 62 DCHECK(resourcePath); |
63 base::scoped_nsobject<StaticHtmlViewController> HTMLViewController( | 63 base::scoped_nsobject<StaticHtmlViewController> HTMLViewController( |
64 [[StaticHtmlViewController alloc] initWithResource:resourcePath | 64 [[StaticHtmlViewController alloc] initWithResource:resourcePath |
65 browserState:browserState]); | 65 browserState:browserState]); |
66 return [self initWithLoader:loader | 66 return [self initWithLoader:loader |
67 staticHTMLViewController:HTMLViewController | 67 staticHTMLViewController:HTMLViewController |
68 URL:URL]; | 68 URL:URL]; |
69 } | 69 } |
70 | 70 |
| 71 - (void)dealloc { |
| 72 [[self scrollView] setDelegate:nil]; |
| 73 [super dealloc]; |
| 74 } |
| 75 |
71 - (void)loadURL:(const GURL&)URL | 76 - (void)loadURL:(const GURL&)URL |
72 referrer:(const web::Referrer&)referrer | 77 referrer:(const web::Referrer&)referrer |
73 transition:(ui::PageTransition)transition | 78 transition:(ui::PageTransition)transition |
74 rendererInitiated:(BOOL)rendererInitiated { | 79 rendererInitiated:(BOOL)rendererInitiated { |
75 [_loader loadURL:URL | 80 [_loader loadURL:URL |
76 referrer:referrer | 81 referrer:referrer |
77 transition:transition | 82 transition:transition |
78 rendererInitiated:rendererInitiated]; | 83 rendererInitiated:rendererInitiated]; |
79 } | 84 } |
80 | 85 |
81 - (OverscrollActionsController*)overscrollActionsController { | 86 - (OverscrollActionsController*)overscrollActionsController { |
82 return _overscrollActionsController.get(); | 87 return _overscrollActionsController.get(); |
83 } | 88 } |
84 | 89 |
85 - (void)setOverscrollActionsController: | 90 - (void)setOverscrollActionsController: |
86 (OverscrollActionsController*)controller { | 91 (OverscrollActionsController*)controller { |
87 _overscrollActionsController.reset([controller retain]); | 92 _overscrollActionsController.reset([controller retain]); |
| 93 [[self scrollView] setDelegate:controller]; |
88 } | 94 } |
89 | 95 |
90 #pragma mark - | 96 #pragma mark - |
91 #pragma mark CRWNativeContent implementation | 97 #pragma mark CRWNativeContent implementation |
92 | 98 |
93 - (void)close { | 99 - (void)close { |
94 [_overscrollActionsController invalidate]; | 100 [_overscrollActionsController invalidate]; |
95 } | 101 } |
96 | 102 |
97 - (void)willUpdateSnapshot { | 103 - (void)willUpdateSnapshot { |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
142 if (!_webUsageEnabled) { | 148 if (!_webUsageEnabled) { |
143 _staticHTMLViewController.reset(); | 149 _staticHTMLViewController.reset(); |
144 } | 150 } |
145 } | 151 } |
146 | 152 |
147 - (UIScrollView*)scrollView { | 153 - (UIScrollView*)scrollView { |
148 return [_staticHTMLViewController scrollView]; | 154 return [_staticHTMLViewController scrollView]; |
149 } | 155 } |
150 | 156 |
151 @end | 157 @end |
OLD | NEW |