| 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/browser_view_controller.h" | 5 #import "ios/chrome/browser/ui/browser_view_controller.h" |
| 6 | 6 |
| 7 #import <AssetsLibrary/AssetsLibrary.h> | 7 #import <AssetsLibrary/AssetsLibrary.h> |
| 8 #import <MobileCoreServices/MobileCoreServices.h> | 8 #import <MobileCoreServices/MobileCoreServices.h> |
| 9 #import <PassKit/PassKit.h> | 9 #import <PassKit/PassKit.h> |
| 10 #import <Photos/Photos.h> | 10 #import <Photos/Photos.h> |
| (...skipping 2952 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2963 url:url | 2963 url:url |
| 2964 error:error | 2964 error:error |
| 2965 isPost:isPost | 2965 isPost:isPost |
| 2966 isIncognito:_isOffTheRecord] autorelease]; | 2966 isIncognito:_isOffTheRecord] autorelease]; |
| 2967 [self setOverScrollActionControllerToStaticNativeContent:errorPageContent]; | 2967 [self setOverScrollActionControllerToStaticNativeContent:errorPageContent]; |
| 2968 return errorPageContent; | 2968 return errorPageContent; |
| 2969 } | 2969 } |
| 2970 | 2970 |
| 2971 - (BOOL)hasControllerForURL:(const GURL&)url { | 2971 - (BOOL)hasControllerForURL:(const GURL&)url { |
| 2972 std::string host(url.host()); | 2972 std::string host(url.host()); |
| 2973 if (host == kChromeUIOfflineHost) { |
| 2974 // Only allow offline URL that are fully specified. |
| 2975 return reading_list::IsOfflineURLValid( |
| 2976 url, ReadingListModelFactory::GetForBrowserState(_browserState)); |
| 2977 } |
| 2973 | 2978 |
| 2974 return host == kChromeUINewTabHost || host == kChromeUIBookmarksHost || | 2979 return host == kChromeUINewTabHost || host == kChromeUIBookmarksHost || |
| 2975 host == kChromeUITermsHost || host == kChromeUIOfflineHost; | 2980 host == kChromeUITermsHost; |
| 2976 } | 2981 } |
| 2977 | 2982 |
| 2978 - (id<CRWNativeContent>)controllerForURL:(const GURL&)url | 2983 - (id<CRWNativeContent>)controllerForURL:(const GURL&)url |
| 2979 webState:(web::WebState*)webState { | 2984 webState:(web::WebState*)webState { |
| 2980 DCHECK(url.SchemeIs(kChromeUIScheme)); | 2985 DCHECK(url.SchemeIs(kChromeUIScheme)); |
| 2981 | 2986 |
| 2982 id<CRWNativeContent> nativeController = nil; | 2987 id<CRWNativeContent> nativeController = nil; |
| 2983 std::string url_host = url.host(); | 2988 std::string url_host = url.host(); |
| 2984 if (url_host == kChromeUINewTabHost || url_host == kChromeUIBookmarksHost) { | 2989 if (url_host == kChromeUINewTabHost || url_host == kChromeUIBookmarksHost) { |
| 2985 NewTabPageController* pageController = | 2990 NewTabPageController* pageController = |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3018 | 3023 |
| 3019 StaticHtmlNativeContent* staticNativeController = | 3024 StaticHtmlNativeContent* staticNativeController = |
| 3020 [[[StaticHtmlNativeContent alloc] | 3025 [[[StaticHtmlNativeContent alloc] |
| 3021 initWithResourcePathResource:base::SysUTF8ToNSString(filename) | 3026 initWithResourcePathResource:base::SysUTF8ToNSString(filename) |
| 3022 loader:self | 3027 loader:self |
| 3023 browserState:_browserState | 3028 browserState:_browserState |
| 3024 url:GURL(kChromeUITermsURL)] autorelease]; | 3029 url:GURL(kChromeUITermsURL)] autorelease]; |
| 3025 [self setOverScrollActionControllerToStaticNativeContent: | 3030 [self setOverScrollActionControllerToStaticNativeContent: |
| 3026 staticNativeController]; | 3031 staticNativeController]; |
| 3027 nativeController = staticNativeController; | 3032 nativeController = staticNativeController; |
| 3028 } else if (url_host == kChromeUIOfflineHost) { | 3033 } else if (url_host == kChromeUIOfflineHost && |
| 3034 [self hasControllerForURL:url]) { |
| 3029 StaticHtmlNativeContent* staticNativeController = | 3035 StaticHtmlNativeContent* staticNativeController = |
| 3030 [[[OfflinePageNativeContent alloc] initWithLoader:self | 3036 [[[OfflinePageNativeContent alloc] initWithLoader:self |
| 3031 browserState:_browserState | 3037 browserState:_browserState |
| 3032 webState:webState | 3038 webState:webState |
| 3033 URL:url] autorelease]; | 3039 URL:url] autorelease]; |
| 3034 [self setOverScrollActionControllerToStaticNativeContent: | 3040 [self setOverScrollActionControllerToStaticNativeContent: |
| 3035 staticNativeController]; | 3041 staticNativeController]; |
| 3036 nativeController = staticNativeController; | 3042 nativeController = staticNativeController; |
| 3037 } else if (url_host == kChromeUIExternalFileHost) { | 3043 } else if (url_host == kChromeUIExternalFileHost) { |
| 3038 // Return an instance of the |ExternalFileController| only if the file is | 3044 // Return an instance of the |ExternalFileController| only if the file is |
| (...skipping 2085 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5124 | 5130 |
| 5125 - (UIView*)voiceSearchButton { | 5131 - (UIView*)voiceSearchButton { |
| 5126 return _voiceSearchButton; | 5132 return _voiceSearchButton; |
| 5127 } | 5133 } |
| 5128 | 5134 |
| 5129 - (id<LogoAnimationControllerOwner>)logoAnimationControllerOwner { | 5135 - (id<LogoAnimationControllerOwner>)logoAnimationControllerOwner { |
| 5130 return [self currentLogoAnimationControllerOwner]; | 5136 return [self currentLogoAnimationControllerOwner]; |
| 5131 } | 5137 } |
| 5132 | 5138 |
| 5133 @end | 5139 @end |
| OLD | NEW |