| 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 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 266 Hideable = 0, | 266 Hideable = 0, |
| 267 // This header stays on screen and doesn't overlap with the content. | 267 // This header stays on screen and doesn't overlap with the content. |
| 268 Visible, | 268 Visible, |
| 269 // This header stay on screen and covers part of the content. | 269 // This header stay on screen and covers part of the content. |
| 270 Overlap | 270 Overlap |
| 271 }; | 271 }; |
| 272 | 272 |
| 273 const CGFloat kIPadFindBarOverlap = 11; | 273 const CGFloat kIPadFindBarOverlap = 11; |
| 274 | 274 |
| 275 bool IsURLAllowedInIncognito(const GURL& url) { | 275 bool IsURLAllowedInIncognito(const GURL& url) { |
| 276 // Most URLs are allowed in incognito; the following are exceptions. | 276 // Most URLs are allowed in incognito; the following is an exception. |
| 277 if (!url.SchemeIs(kChromeUIScheme)) | 277 return !(url.SchemeIs(kChromeUIScheme) && url.host() == kChromeUIHistoryHost); |
| 278 return true; | |
| 279 std::string url_host = url.host(); | |
| 280 return url_host != kChromeUIHistoryHost && | |
| 281 url_host != kChromeUIHistoryFrameHost; | |
| 282 } | 278 } |
| 283 | 279 |
| 284 // Temporary key to use when storing native controllers vended to tabs before | 280 // Temporary key to use when storing native controllers vended to tabs before |
| 285 // they are added to the tab model. | 281 // they are added to the tab model. |
| 286 NSString* const kNativeControllerTemporaryKey = @"NativeControllerTemporaryKey"; | 282 NSString* const kNativeControllerTemporaryKey = @"NativeControllerTemporaryKey"; |
| 287 | 283 |
| 288 } // namespace | 284 } // namespace |
| 289 | 285 |
| 290 #pragma mark - HeaderDefinition helper | 286 #pragma mark - HeaderDefinition helper |
| 291 | 287 |
| (...skipping 2804 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3096 NSString* filePath = [ExternalFileController pathForExternalFileURL:url]; | 3092 NSString* filePath = [ExternalFileController pathForExternalFileURL:url]; |
| 3097 if ([[NSFileManager defaultManager] fileExistsAtPath:filePath]) { | 3093 if ([[NSFileManager defaultManager] fileExistsAtPath:filePath]) { |
| 3098 nativeController = | 3094 nativeController = |
| 3099 [[ExternalFileController alloc] initWithURL:url | 3095 [[ExternalFileController alloc] initWithURL:url |
| 3100 browserState:_browserState]; | 3096 browserState:_browserState]; |
| 3101 } | 3097 } |
| 3102 } else { | 3098 } else { |
| 3103 DCHECK(![self hasControllerForURL:url]); | 3099 DCHECK(![self hasControllerForURL:url]); |
| 3104 // In any other case the PageNotAvailableController is returned. | 3100 // In any other case the PageNotAvailableController is returned. |
| 3105 nativeController = [[PageNotAvailableController alloc] initWithUrl:url]; | 3101 nativeController = [[PageNotAvailableController alloc] initWithUrl:url]; |
| 3106 if (url_host == kChromeUIHistoryFrameHost) { | |
| 3107 base::mac::ObjCCastStrict<PageNotAvailableController>(nativeController) | |
| 3108 .descriptionText = l10n_util::GetNSStringFWithFixup( | |
| 3109 IDS_IOS_HISTORY_URL_NOT_AVAILABLE, | |
| 3110 base::UTF8ToUTF16(kChromeUIHistoryURL), | |
| 3111 l10n_util::GetStringUTF16(IDS_HISTORY_SHOW_HISTORY)); | |
| 3112 } | |
| 3113 } | 3102 } |
| 3114 // If a native controller is vended before its tab is added to the tab model, | 3103 // If a native controller is vended before its tab is added to the tab model, |
| 3115 // use the temporary key and add it under the new tab's tabId in the | 3104 // use the temporary key and add it under the new tab's tabId in the |
| 3116 // TabModelObserver callback. This happens: | 3105 // TabModelObserver callback. This happens: |
| 3117 // - when there is no current tab (occurs when vending the NTP controller for | 3106 // - when there is no current tab (occurs when vending the NTP controller for |
| 3118 // the first tab that is opened), | 3107 // the first tab that is opened), |
| 3119 // - when the current tab's url doesn't match |url| (occurs when a native | 3108 // - when the current tab's url doesn't match |url| (occurs when a native |
| 3120 // controller is opened in a new tab) | 3109 // controller is opened in a new tab) |
| 3121 // - when the current tab's url matches |url| and there is already a native | 3110 // - when the current tab's url matches |url| and there is already a native |
| 3122 // controller of the appropriate type vended to it (occurs when a native | 3111 // controller of the appropriate type vended to it (occurs when a native |
| (...skipping 579 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3702 locationBarDidSubmitURL:url | 3691 locationBarDidSubmitURL:url |
| 3703 transition:transition | 3692 transition:transition |
| 3704 browserState:_browserState]; | 3693 browserState:_browserState]; |
| 3705 | 3694 |
| 3706 [_bookmarkInteractionController dismissBookmarkModalControllerAnimated:YES]; | 3695 [_bookmarkInteractionController dismissBookmarkModalControllerAnimated:YES]; |
| 3707 if (transition & ui::PAGE_TRANSITION_FROM_ADDRESS_BAR) { | 3696 if (transition & ui::PAGE_TRANSITION_FROM_ADDRESS_BAR) { |
| 3708 new_tab_page_uma::RecordActionFromOmnibox(_browserState, url, transition); | 3697 new_tab_page_uma::RecordActionFromOmnibox(_browserState, url, transition); |
| 3709 } | 3698 } |
| 3710 | 3699 |
| 3711 // NOTE: This check for the Crash Host URL is here to avoid the URL from | 3700 // NOTE: This check for the Crash Host URL is here to avoid the URL from |
| 3712 // ending up in the history causign the app to crash at every subsequent | 3701 // ending up in the history causing the app to crash at every subsequent |
| 3713 // restart. | 3702 // restart. |
| 3714 if (url.host() == kChromeUIBrowserCrashHost) { | 3703 if (url.host() == kChromeUIBrowserCrashHost) { |
| 3715 [self induceBrowserCrash]; | 3704 [self induceBrowserCrash]; |
| 3716 // In debug the app can continue working even after the CHECK. Adding a | 3705 // In debug the app can continue working even after the CHECK. Adding a |
| 3717 // return avoids the crash url to be added to the history. | 3706 // return avoids the crash url to be added to the history. |
| 3718 return; | 3707 return; |
| 3719 } | 3708 } |
| 3720 | 3709 |
| 3721 if (url == [_preloadController prerenderedURL]) { | 3710 if (url == [_preloadController prerenderedURL]) { |
| 3722 std::unique_ptr<web::WebState> newWebState = | 3711 std::unique_ptr<web::WebState> newWebState = |
| (...skipping 1461 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5184 | 5173 |
| 5185 - (UIView*)voiceSearchButton { | 5174 - (UIView*)voiceSearchButton { |
| 5186 return _voiceSearchButton; | 5175 return _voiceSearchButton; |
| 5187 } | 5176 } |
| 5188 | 5177 |
| 5189 - (id<LogoAnimationControllerOwner>)logoAnimationControllerOwner { | 5178 - (id<LogoAnimationControllerOwner>)logoAnimationControllerOwner { |
| 5190 return [self currentLogoAnimationControllerOwner]; | 5179 return [self currentLogoAnimationControllerOwner]; |
| 5191 } | 5180 } |
| 5192 | 5181 |
| 5193 @end | 5182 @end |
| OLD | NEW |