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

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

Issue 2660333006: Pass the correct webState to the nativeContent. (Closed)
Patch Set: 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 2884 matching lines...) Expand 10 before | Expand all | Expand 10 after
2895 return errorPageContent; 2895 return errorPageContent;
2896 } 2896 }
2897 2897
2898 - (BOOL)hasControllerForURL:(const GURL&)url { 2898 - (BOOL)hasControllerForURL:(const GURL&)url {
2899 std::string host(url.host()); 2899 std::string host(url.host());
2900 2900
2901 return host == kChromeUINewTabHost || host == kChromeUIBookmarksHost || 2901 return host == kChromeUINewTabHost || host == kChromeUIBookmarksHost ||
2902 host == kChromeUITermsHost || host == kChromeUIOfflineHost; 2902 host == kChromeUITermsHost || host == kChromeUIOfflineHost;
2903 } 2903 }
2904 2904
2905 - (id<CRWNativeContent>)controllerForURL:(const GURL&)url { 2905 - (id<CRWNativeContent>)controllerForURL:(const GURL&)url
2906 webState:(web::WebState*)webState {
2906 DCHECK(url.SchemeIs(kChromeUIScheme)); 2907 DCHECK(url.SchemeIs(kChromeUIScheme));
2907 2908
2908 id<CRWNativeContent> nativeController = nil; 2909 id<CRWNativeContent> nativeController = nil;
2909 std::string url_host = url.host(); 2910 std::string url_host = url.host();
2910 if (url_host == kChromeUINewTabHost || url_host == kChromeUIBookmarksHost) { 2911 if (url_host == kChromeUINewTabHost || url_host == kChromeUIBookmarksHost) {
2911 NewTabPageController* pageController = 2912 NewTabPageController* pageController =
2912 [[[NewTabPageController alloc] initWithUrl:url 2913 [[[NewTabPageController alloc] initWithUrl:url
2913 loader:self 2914 loader:self
2914 focuser:_toolbarController 2915 focuser:_toolbarController
2915 ntpObserver:self 2916 ntpObserver:self
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
2948 loader:self 2949 loader:self
2949 browserState:_browserState 2950 browserState:_browserState
2950 url:GURL(kChromeUITermsURL)] autorelease]; 2951 url:GURL(kChromeUITermsURL)] autorelease];
2951 [self setOverScrollActionControllerToStaticNativeContent: 2952 [self setOverScrollActionControllerToStaticNativeContent:
2952 staticNativeController]; 2953 staticNativeController];
2953 nativeController = staticNativeController; 2954 nativeController = staticNativeController;
2954 } else if (url_host == kChromeUIOfflineHost) { 2955 } else if (url_host == kChromeUIOfflineHost) {
2955 StaticHtmlNativeContent* staticNativeController = 2956 StaticHtmlNativeContent* staticNativeController =
2956 [[[OfflinePageNativeContent alloc] initWithLoader:self 2957 [[[OfflinePageNativeContent alloc] initWithLoader:self
2957 browserState:_browserState 2958 browserState:_browserState
2958 webState:[self currentWebState] 2959 webState:webState
2959 URL:url] autorelease]; 2960 URL:url] autorelease];
2960 [self setOverScrollActionControllerToStaticNativeContent: 2961 [self setOverScrollActionControllerToStaticNativeContent:
2961 staticNativeController]; 2962 staticNativeController];
2962 nativeController = staticNativeController; 2963 nativeController = staticNativeController;
2963 } else if (url_host == kChromeUIExternalFileHost) { 2964 } else if (url_host == kChromeUIExternalFileHost) {
2964 // Return an instance of the |ExternalFileController| only if the file is 2965 // Return an instance of the |ExternalFileController| only if the file is
2965 // still in the sandbox. 2966 // still in the sandbox.
2966 NSString* filePath = [ExternalFileController pathForExternalFileURL:url]; 2967 NSString* filePath = [ExternalFileController pathForExternalFileURL:url];
2967 if ([[NSFileManager defaultManager] fileExistsAtPath:filePath]) { 2968 if ([[NSFileManager defaultManager] fileExistsAtPath:filePath]) {
2968 nativeController = [[[ExternalFileController alloc] 2969 nativeController = [[[ExternalFileController alloc]
(...skipping 2165 matching lines...) Expand 10 before | Expand all | Expand 10 after
5134 5135
5135 - (UIView*)voiceSearchButton { 5136 - (UIView*)voiceSearchButton {
5136 return _voiceSearchButton; 5137 return _voiceSearchButton;
5137 } 5138 }
5138 5139
5139 - (id<LogoAnimationControllerOwner>)logoAnimationControllerOwner { 5140 - (id<LogoAnimationControllerOwner>)logoAnimationControllerOwner {
5140 return [self currentLogoAnimationControllerOwner]; 5141 return [self currentLogoAnimationControllerOwner];
5141 } 5142 }
5142 5143
5143 @end 5144 @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