| 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 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 148 #include "ios/chrome/browser/ui/toolbar/toolbar_model_delegate_ios.h" | 148 #include "ios/chrome/browser/ui/toolbar/toolbar_model_delegate_ios.h" |
| 149 #include "ios/chrome/browser/ui/toolbar/toolbar_model_ios.h" | 149 #include "ios/chrome/browser/ui/toolbar/toolbar_model_ios.h" |
| 150 #import "ios/chrome/browser/ui/tools_menu/tools_menu_configuration.h" | 150 #import "ios/chrome/browser/ui/tools_menu/tools_menu_configuration.h" |
| 151 #import "ios/chrome/browser/ui/tools_menu/tools_menu_view_item.h" | 151 #import "ios/chrome/browser/ui/tools_menu/tools_menu_view_item.h" |
| 152 #import "ios/chrome/browser/ui/tools_menu/tools_popup_controller.h" | 152 #import "ios/chrome/browser/ui/tools_menu/tools_popup_controller.h" |
| 153 #include "ios/chrome/browser/ui/ui_util.h" | 153 #include "ios/chrome/browser/ui/ui_util.h" |
| 154 #import "ios/chrome/browser/ui/uikit_ui_util.h" | 154 #import "ios/chrome/browser/ui/uikit_ui_util.h" |
| 155 #import "ios/chrome/browser/ui/util/pasteboard_util.h" | 155 #import "ios/chrome/browser/ui/util/pasteboard_util.h" |
| 156 #import "ios/chrome/browser/ui/voice/text_to_speech_player.h" | 156 #import "ios/chrome/browser/ui/voice/text_to_speech_player.h" |
| 157 #include "ios/chrome/browser/upgrade/upgrade_center.h" | 157 #include "ios/chrome/browser/upgrade/upgrade_center.h" |
| 158 #import "ios/chrome/browser/web/blocked_popup_tab_helper.h" |
| 158 #import "ios/chrome/browser/web/error_page_content.h" | 159 #import "ios/chrome/browser/web/error_page_content.h" |
| 159 #import "ios/chrome/browser/web/passkit_dialog_provider.h" | 160 #import "ios/chrome/browser/web/passkit_dialog_provider.h" |
| 160 #import "ios/chrome/browser/web/repost_form_tab_helper.h" | 161 #import "ios/chrome/browser/web/repost_form_tab_helper.h" |
| 161 #import "ios/chrome/browser/xcallback_parameters.h" | 162 #import "ios/chrome/browser/xcallback_parameters.h" |
| 162 #import "ios/chrome/common/material_timing.h" | 163 #import "ios/chrome/common/material_timing.h" |
| 163 #include "ios/chrome/grit/ios_chromium_strings.h" | 164 #include "ios/chrome/grit/ios_chromium_strings.h" |
| 164 #include "ios/chrome/grit/ios_strings.h" | 165 #include "ios/chrome/grit/ios_strings.h" |
| 165 #import "ios/net/request_tracker.h" | 166 #import "ios/net/request_tracker.h" |
| 166 #include "ios/public/provider/chrome/browser/chrome_browser_provider.h" | 167 #include "ios/public/provider/chrome/browser/chrome_browser_provider.h" |
| 167 #include "ios/public/provider/chrome/browser/ui/app_rating_prompt.h" | 168 #include "ios/public/provider/chrome/browser/ui/app_rating_prompt.h" |
| (...skipping 2207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2375 } | 2376 } |
| 2376 | 2377 |
| 2377 - (UIStatusBarStyle)preferredStatusBarStyle { | 2378 - (UIStatusBarStyle)preferredStatusBarStyle { |
| 2378 return (IsIPadIdiom() || _isOffTheRecord) ? UIStatusBarStyleLightContent | 2379 return (IsIPadIdiom() || _isOffTheRecord) ? UIStatusBarStyleLightContent |
| 2379 : UIStatusBarStyleDefault; | 2380 : UIStatusBarStyleDefault; |
| 2380 } | 2381 } |
| 2381 | 2382 |
| 2382 #pragma mark - CRWWebStateDelegate methods. | 2383 #pragma mark - CRWWebStateDelegate methods. |
| 2383 | 2384 |
| 2384 - (web::WebState*)webState:(web::WebState*)webState | 2385 - (web::WebState*)webState:(web::WebState*)webState |
| 2386 createNewWebStateForURL:(const GURL&)URL |
| 2387 openerURL:(const GURL&)openerURL |
| 2388 initiatedByUser:(BOOL)initiatedByUser { |
| 2389 // Check if requested web state is a popup and block it if necessary. |
| 2390 if (!initiatedByUser) { |
| 2391 auto* helper = BlockedPopupTabHelper::FromWebState(webState); |
| 2392 if (helper->ShouldBlockPopup(openerURL)) { |
| 2393 web::NavigationItem* item = |
| 2394 webState->GetNavigationManager()->GetLastCommittedItem(); |
| 2395 web::Referrer referrer(openerURL, item->GetReferrer().policy); |
| 2396 helper->HandlePopup(URL, referrer); |
| 2397 return nil; |
| 2398 } |
| 2399 } |
| 2400 |
| 2401 // Requested web state should not be blocked from opening. |
| 2402 Tab* currentTab = LegacyTabHelper::GetTabForWebState(webState); |
| 2403 [currentTab updateSnapshotWithOverlay:YES visibleFrameOnly:YES]; |
| 2404 |
| 2405 // Tabs open by DOM are always renderer initiated. |
| 2406 web::NavigationManager::WebLoadParams params(GURL{}); |
| 2407 params.transition_type = ui::PAGE_TRANSITION_LINK; |
| 2408 params.is_renderer_initiated = true; |
| 2409 Tab* childTab = [[self tabModel] |
| 2410 insertTabWithLoadParams:params |
| 2411 opener:currentTab |
| 2412 openedByDOM:YES |
| 2413 atIndex:TabModelConstants::kTabPositionAutomatically |
| 2414 inBackground:NO]; |
| 2415 return childTab.webState; |
| 2416 } |
| 2417 |
| 2418 - (web::WebState*)webState:(web::WebState*)webState |
| 2385 openURLWithParams:(const web::WebState::OpenURLParams&)params { | 2419 openURLWithParams:(const web::WebState::OpenURLParams&)params { |
| 2386 switch (params.disposition) { | 2420 switch (params.disposition) { |
| 2387 case WindowOpenDisposition::NEW_FOREGROUND_TAB: | 2421 case WindowOpenDisposition::NEW_FOREGROUND_TAB: |
| 2388 case WindowOpenDisposition::NEW_BACKGROUND_TAB: { | 2422 case WindowOpenDisposition::NEW_BACKGROUND_TAB: { |
| 2389 Tab* tab = [[self tabModel] | 2423 Tab* tab = [[self tabModel] |
| 2390 insertTabWithURL:params.url | 2424 insertTabWithURL:params.url |
| 2391 referrer:params.referrer | 2425 referrer:params.referrer |
| 2392 transition:params.transition | 2426 transition:params.transition |
| 2393 opener:LegacyTabHelper::GetTabForWebState(webState) | 2427 opener:LegacyTabHelper::GetTabForWebState(webState) |
| 2394 openedByDOM:NO | 2428 openedByDOM:NO |
| (...skipping 2659 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5054 | 5088 |
| 5055 - (UIView*)voiceSearchButton { | 5089 - (UIView*)voiceSearchButton { |
| 5056 return _voiceSearchButton; | 5090 return _voiceSearchButton; |
| 5057 } | 5091 } |
| 5058 | 5092 |
| 5059 - (id<LogoAnimationControllerOwner>)logoAnimationControllerOwner { | 5093 - (id<LogoAnimationControllerOwner>)logoAnimationControllerOwner { |
| 5060 return [self currentLogoAnimationControllerOwner]; | 5094 return [self currentLogoAnimationControllerOwner]; |
| 5061 } | 5095 } |
| 5062 | 5096 |
| 5063 @end | 5097 @end |
| OLD | NEW |