Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(297)

Side by Side Diff: ios/chrome/browser/ui/browser_view_controller.mm

Issue 2655463014: Pass the correct webState to the nativeContent. (Closed)
Patch Set: s/ithW// Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | ios/chrome/browser/ui/browser_view_controller_unittest.mm » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 2897 matching lines...) Expand 10 before | Expand all | Expand 10 after
2908 return errorPageContent; 2908 return errorPageContent;
2909 } 2909 }
2910 2910
2911 - (BOOL)hasControllerForURL:(const GURL&)url { 2911 - (BOOL)hasControllerForURL:(const GURL&)url {
2912 std::string host(url.host()); 2912 std::string host(url.host());
2913 2913
2914 return host == kChromeUINewTabHost || host == kChromeUIBookmarksHost || 2914 return host == kChromeUINewTabHost || host == kChromeUIBookmarksHost ||
2915 host == kChromeUITermsHost || host == kChromeUIOfflineHost; 2915 host == kChromeUITermsHost || host == kChromeUIOfflineHost;
2916 } 2916 }
2917 2917
2918 - (id<CRWNativeContent>)controllerForURL:(const GURL&)url { 2918 - (id<CRWNativeContent>)controllerForURL:(const GURL&)url
2919 webState:(web::WebState*)webState {
2919 DCHECK(url.SchemeIs(kChromeUIScheme)); 2920 DCHECK(url.SchemeIs(kChromeUIScheme));
2920 2921
2921 id<CRWNativeContent> nativeController = nil; 2922 id<CRWNativeContent> nativeController = nil;
2922 std::string url_host = url.host(); 2923 std::string url_host = url.host();
2923 if (url_host == kChromeUINewTabHost || url_host == kChromeUIBookmarksHost) { 2924 if (url_host == kChromeUINewTabHost || url_host == kChromeUIBookmarksHost) {
2924 NewTabPageController* pageController = 2925 NewTabPageController* pageController =
2925 [[[NewTabPageController alloc] initWithUrl:url 2926 [[[NewTabPageController alloc] initWithUrl:url
2926 loader:self 2927 loader:self
2927 focuser:_toolbarController 2928 focuser:_toolbarController
2928 ntpObserver:self 2929 ntpObserver:self
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
2961 loader:self 2962 loader:self
2962 browserState:_browserState 2963 browserState:_browserState
2963 url:GURL(kChromeUITermsURL)] autorelease]; 2964 url:GURL(kChromeUITermsURL)] autorelease];
2964 [self setOverScrollActionControllerToStaticNativeContent: 2965 [self setOverScrollActionControllerToStaticNativeContent:
2965 staticNativeController]; 2966 staticNativeController];
2966 nativeController = staticNativeController; 2967 nativeController = staticNativeController;
2967 } else if (url_host == kChromeUIOfflineHost) { 2968 } else if (url_host == kChromeUIOfflineHost) {
2968 StaticHtmlNativeContent* staticNativeController = 2969 StaticHtmlNativeContent* staticNativeController =
2969 [[[OfflinePageNativeContent alloc] initWithLoader:self 2970 [[[OfflinePageNativeContent alloc] initWithLoader:self
2970 browserState:_browserState 2971 browserState:_browserState
2971 webState:[self currentWebState] 2972 webState:webState
2972 URL:url] autorelease]; 2973 URL:url] autorelease];
2973 [self setOverScrollActionControllerToStaticNativeContent: 2974 [self setOverScrollActionControllerToStaticNativeContent:
2974 staticNativeController]; 2975 staticNativeController];
2975 nativeController = staticNativeController; 2976 nativeController = staticNativeController;
2976 } else if (url_host == kChromeUIExternalFileHost) { 2977 } else if (url_host == kChromeUIExternalFileHost) {
2977 // Return an instance of the |ExternalFileController| only if the file is 2978 // Return an instance of the |ExternalFileController| only if the file is
2978 // still in the sandbox. 2979 // still in the sandbox.
2979 NSString* filePath = [ExternalFileController pathForExternalFileURL:url]; 2980 NSString* filePath = [ExternalFileController pathForExternalFileURL:url];
2980 if ([[NSFileManager defaultManager] fileExistsAtPath:filePath]) { 2981 if ([[NSFileManager defaultManager] fileExistsAtPath:filePath]) {
2981 nativeController = [[[ExternalFileController alloc] 2982 nativeController = [[[ExternalFileController alloc]
(...skipping 2186 matching lines...) Expand 10 before | Expand all | Expand 10 after
5168 5169
5169 - (UIView*)voiceSearchButton { 5170 - (UIView*)voiceSearchButton {
5170 return _voiceSearchButton; 5171 return _voiceSearchButton;
5171 } 5172 }
5172 5173
5173 - (id<LogoAnimationControllerOwner>)logoAnimationControllerOwner { 5174 - (id<LogoAnimationControllerOwner>)logoAnimationControllerOwner {
5174 return [self currentLogoAnimationControllerOwner]; 5175 return [self currentLogoAnimationControllerOwner];
5175 } 5176 }
5176 5177
5177 @end 5178 @end
OLDNEW
« no previous file with comments | « no previous file | ios/chrome/browser/ui/browser_view_controller_unittest.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698