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

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

Issue 2614023006: [ios] Removed -[CRWWebDelegate openURLWithParams:]. (Closed)
Patch Set: Created 3 years, 11 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 | « ios/chrome/browser/tabs/tab.mm ('k') | ios/web/public/web_state/ui/crw_web_delegate.h » ('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 669 matching lines...) Expand 10 before | Expand all | Expand 10 after
680 // Shows an alert with the given title and message id. 680 // Shows an alert with the given title and message id.
681 - (void)showErrorAlert:(int)titleMessageId message:(int)messageId; 681 - (void)showErrorAlert:(int)titleMessageId message:(int)messageId;
682 // Helper method displaying an alert with the given title and message. 682 // Helper method displaying an alert with the given title and message.
683 // Dismisses previous alert if it has not been dismissed yet. 683 // Dismisses previous alert if it has not been dismissed yet.
684 - (void)showErrorAlertWithStringTitle:(NSString*)title 684 - (void)showErrorAlertWithStringTitle:(NSString*)title
685 message:(NSString*)message; 685 message:(NSString*)message;
686 // Shows a self-dismissing snackbar displaying |message|. 686 // Shows a self-dismissing snackbar displaying |message|.
687 - (void)showSnackbar:(NSString*)message; 687 - (void)showSnackbar:(NSString*)message;
688 // Induces an intentional crash in the browser process. 688 // Induces an intentional crash in the browser process.
689 - (void)induceBrowserCrash; 689 - (void)induceBrowserCrash;
690 // Returns Tab that corresponds to the given |webState|.
691 - (Tab*)tabForWebState:(web::WebState*)webState;
690 // Saves the image or display error message, based on privacy settings. 692 // Saves the image or display error message, based on privacy settings.
691 - (void)managePermissionAndSaveImage:(NSData*)data; 693 - (void)managePermissionAndSaveImage:(NSData*)data;
692 // Saves the image. In order to keep the metadata of the image, the image is 694 // Saves the image. In order to keep the metadata of the image, the image is
693 // saved as a temporary file on disk then saved in photos. 695 // saved as a temporary file on disk then saved in photos.
694 // This should be called on FILE thread. 696 // This should be called on FILE thread.
695 - (void)saveImage:(NSData*)data; 697 - (void)saveImage:(NSData*)data;
696 // Called when Chrome has been denied access to the photos or videos and the 698 // Called when Chrome has been denied access to the photos or videos and the
697 // user can change it. 699 // user can change it.
698 // Shows a privacy alert on the main queue, allowing the user to go to Chrome's 700 // Shows a privacy alert on the main queue, allowing the user to go to Chrome's
699 // settings. Dismiss previous alert if it has not been dismissed yet. 701 // settings. Dismiss previous alert if it has not been dismissed yet.
(...skipping 1656 matching lines...) Expand 10 before | Expand all | Expand 10 after
2356 } 2358 }
2357 } 2359 }
2358 2360
2359 - (UIStatusBarStyle)preferredStatusBarStyle { 2361 - (UIStatusBarStyle)preferredStatusBarStyle {
2360 return (IsIPadIdiom() || _isOffTheRecord) ? UIStatusBarStyleLightContent 2362 return (IsIPadIdiom() || _isOffTheRecord) ? UIStatusBarStyleLightContent
2361 : UIStatusBarStyleDefault; 2363 : UIStatusBarStyleDefault;
2362 } 2364 }
2363 2365
2364 #pragma mark - CRWWebStateDelegate methods. 2366 #pragma mark - CRWWebStateDelegate methods.
2365 2367
2368 - (web::WebState*)webState:(web::WebState*)webState
2369 openURLWithParams:(const web::WebState::OpenURLParams&)params {
2370 switch (params.disposition) {
2371 case WindowOpenDisposition::NEW_FOREGROUND_TAB:
2372 case WindowOpenDisposition::NEW_BACKGROUND_TAB: {
2373 Tab* tab = [[self tabModel]
2374 insertOrUpdateTabWithURL:params.url
2375 referrer:params.referrer
2376 transition:params.transition
2377 windowName:nil
2378 opener:[self tabForWebState:webState]
2379 openedByDOM:NO
2380 atIndex:TabModelConstants::kTabPositionAutomatically
2381 inBackground:(params.disposition ==
2382 WindowOpenDisposition::NEW_BACKGROUND_TAB)];
2383 return tab.webState;
2384 }
2385 case WindowOpenDisposition::CURRENT_TAB: {
2386 web::NavigationManager::WebLoadParams loadParams(params.url);
2387 loadParams.referrer = params.referrer;
2388 loadParams.transition_type = params.transition;
2389 loadParams.is_renderer_initiated = params.is_renderer_initiated;
2390 webState->GetNavigationManager()->LoadURLWithParams(loadParams);
2391 return webState;
2392 }
2393 default:
2394 NOTIMPLEMENTED();
2395 return nullptr;
2396 };
2397 }
2398
2366 - (void)webState:(web::WebState*)webState didChangeProgress:(double)progress { 2399 - (void)webState:(web::WebState*)webState didChangeProgress:(double)progress {
2367 if (webState == [_model currentTab].webState) { 2400 if (webState == [_model currentTab].webState) {
2368 // TODO(crbug.com/546406): It is probably possible to do something smarter, 2401 // TODO(crbug.com/546406): It is probably possible to do something smarter,
2369 // but the fact that this is not always sent will have to be taken into 2402 // but the fact that this is not always sent will have to be taken into
2370 // account. 2403 // account.
2371 [self updateToolbar]; 2404 [self updateToolbar];
2372 } 2405 }
2373 } 2406 }
2374 2407
2375 - (BOOL)webState:(web::WebState*)webState 2408 - (BOOL)webState:(web::WebState*)webState
(...skipping 1298 matching lines...) Expand 10 before | Expand all | Expand 10 after
3674 [_preloadController cancelPrerender]; 3707 [_preloadController cancelPrerender];
3675 DCHECK([_model currentTab]); 3708 DCHECK([_model currentTab]);
3676 [[_model currentTab].webController executeUserJavaScript:script 3709 [[_model currentTab].webController executeUserJavaScript:script
3677 completionHandler:nil]; 3710 completionHandler:nil];
3678 } 3711 }
3679 3712
3680 - (web::WebState*)currentWebState { 3713 - (web::WebState*)currentWebState {
3681 return [[_model currentTab] webState]; 3714 return [[_model currentTab] webState];
3682 } 3715 }
3683 3716
3717 - (Tab*)tabForWebState:(web::WebState*)webState {
3718 for (Tab* tab in _model.get()) {
3719 if (tab.webState == webState)
3720 return tab;
3721 }
3722 return nil;
3723 }
3724
3684 // This is called from within an animation block. 3725 // This is called from within an animation block.
3685 - (void)toolbarHeightChanged { 3726 - (void)toolbarHeightChanged {
3686 if ([self headerHeight] != 0) { 3727 if ([self headerHeight] != 0) {
3687 // Ensure full screen height is updated. 3728 // Ensure full screen height is updated.
3688 Tab* currentTab = [_model currentTab]; 3729 Tab* currentTab = [_model currentTab];
3689 BOOL visible = self.isToolbarOnScreen; 3730 BOOL visible = self.isToolbarOnScreen;
3690 [currentTab updateFullscreenWithToolbarVisible:visible]; 3731 [currentTab updateFullscreenWithToolbarVisible:visible];
3691 } 3732 }
3692 } 3733 }
3693 3734
(...skipping 1402 matching lines...) Expand 10 before | Expand all | Expand 10 after
5096 5137
5097 - (UIView*)voiceSearchButton { 5138 - (UIView*)voiceSearchButton {
5098 return _voiceSearchButton; 5139 return _voiceSearchButton;
5099 } 5140 }
5100 5141
5101 - (id<LogoAnimationControllerOwner>)logoAnimationControllerOwner { 5142 - (id<LogoAnimationControllerOwner>)logoAnimationControllerOwner {
5102 return [self currentLogoAnimationControllerOwner]; 5143 return [self currentLogoAnimationControllerOwner];
5103 } 5144 }
5104 5145
5105 @end 5146 @end
OLDNEW
« no previous file with comments | « ios/chrome/browser/tabs/tab.mm ('k') | ios/web/public/web_state/ui/crw_web_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698