| 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/web/error_page_content.h" | 5 #import "ios/chrome/browser/web/error_page_content.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #import "base/mac/scoped_nsobject.h" | |
| 10 #import "ios/chrome/browser/web/error_page_generator.h" | 9 #import "ios/chrome/browser/web/error_page_generator.h" |
| 11 #include "ios/web/public/referrer.h" | 10 #include "ios/web/public/referrer.h" |
| 12 #include "ui/base/page_transition_types.h" | 11 #include "ui/base/page_transition_types.h" |
| 13 #include "url/gurl.h" | 12 #include "url/gurl.h" |
| 14 | 13 |
| 14 #if !defined(__has_feature) || !__has_feature(objc_arc) |
| 15 #error "This file requires ARC support." |
| 16 #endif |
| 17 |
| 15 @implementation ErrorPageContent | 18 @implementation ErrorPageContent |
| 16 | 19 |
| 17 #pragma mark - | 20 #pragma mark - |
| 18 #pragma mark CRWNativeContent methods | 21 #pragma mark CRWNativeContent methods |
| 19 | 22 |
| 20 // Override StaticHtmlNativeContent method to always force error pages to | 23 // Override StaticHtmlNativeContent method to always force error pages to |
| 21 // try loading the URL again, because the error might have been fixed. | 24 // try loading the URL again, because the error might have been fixed. |
| 22 - (void)reload { | 25 - (void)reload { |
| 23 // Because we don't have the original page transition at this point, just | 26 // Because we don't have the original page transition at this point, just |
| 24 // use PAGE_TRANSITION_TYPED. We can revisit if this causes problems. | 27 // use PAGE_TRANSITION_TYPED. We can revisit if this causes problems. |
| 25 [super loadURL:[self url] | 28 [super loadURL:[self url] |
| 26 referrer:web::Referrer() | 29 referrer:web::Referrer() |
| 27 transition:ui::PAGE_TRANSITION_TYPED | 30 transition:ui::PAGE_TRANSITION_TYPED |
| 28 rendererInitiated:YES]; | 31 rendererInitiated:YES]; |
| 29 } | 32 } |
| 30 | 33 |
| 31 - (id)initWithLoader:(id<UrlLoader>)loader | 34 - (id)initWithLoader:(id<UrlLoader>)loader |
| 32 browserState:(web::BrowserState*)browserState | 35 browserState:(web::BrowserState*)browserState |
| 33 url:(const GURL&)url | 36 url:(const GURL&)url |
| 34 error:(NSError*)error | 37 error:(NSError*)error |
| 35 isPost:(BOOL)isPost | 38 isPost:(BOOL)isPost |
| 36 isIncognito:(BOOL)isIncognito { | 39 isIncognito:(BOOL)isIncognito { |
| 37 ErrorPageGenerator* generator = | 40 ErrorPageGenerator* generator = |
| 38 [[[ErrorPageGenerator alloc] initWithError:error | 41 [[ErrorPageGenerator alloc] initWithError:error |
| 39 isPost:isPost | 42 isPost:isPost |
| 40 isIncognito:isIncognito] autorelease]; | 43 isIncognito:isIncognito]; |
| 41 | 44 |
| 42 base::scoped_nsobject<StaticHtmlViewController> HTMLViewController( | 45 StaticHtmlViewController* HTMLViewController = |
| 43 [[StaticHtmlViewController alloc] initWithGenerator:generator | 46 [[StaticHtmlViewController alloc] initWithGenerator:generator |
| 44 browserState:browserState]); | 47 browserState:browserState]; |
| 45 return [super initWithLoader:loader | 48 return [super initWithLoader:loader |
| 46 staticHTMLViewController:HTMLViewController | 49 staticHTMLViewController:HTMLViewController |
| 47 URL:url]; | 50 URL:url]; |
| 48 } | 51 } |
| 49 | 52 |
| 50 @end | 53 @end |
| OLD | NEW |