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

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

Issue 2755823002: Moved |openedByDOM| to WebState's CreateParams and public interface. (Closed)
Patch Set: test fix & removed include Created 3 years, 9 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
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 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 #include "ios/chrome/grit/ios_strings.h" 165 #include "ios/chrome/grit/ios_strings.h"
166 #import "ios/net/request_tracker.h" 166 #import "ios/net/request_tracker.h"
167 #include "ios/public/provider/chrome/browser/chrome_browser_provider.h" 167 #include "ios/public/provider/chrome/browser/chrome_browser_provider.h"
168 #include "ios/public/provider/chrome/browser/ui/app_rating_prompt.h" 168 #include "ios/public/provider/chrome/browser/ui/app_rating_prompt.h"
169 #include "ios/public/provider/chrome/browser/ui/default_ios_web_view_factory.h" 169 #include "ios/public/provider/chrome/browser/ui/default_ios_web_view_factory.h"
170 #import "ios/public/provider/chrome/browser/voice/voice_search_bar.h" 170 #import "ios/public/provider/chrome/browser/voice/voice_search_bar.h"
171 #import "ios/public/provider/chrome/browser/voice/voice_search_bar_owner.h" 171 #import "ios/public/provider/chrome/browser/voice/voice_search_bar_owner.h"
172 #include "ios/public/provider/chrome/browser/voice/voice_search_controller.h" 172 #include "ios/public/provider/chrome/browser/voice/voice_search_controller.h"
173 #include "ios/public/provider/chrome/browser/voice/voice_search_controller_deleg ate.h" 173 #include "ios/public/provider/chrome/browser/voice/voice_search_controller_deleg ate.h"
174 #include "ios/public/provider/chrome/browser/voice/voice_search_provider.h" 174 #include "ios/public/provider/chrome/browser/voice/voice_search_provider.h"
175 #import "ios/web/navigation/crw_session_controller.h"
176 #include "ios/web/navigation/navigation_manager_impl.h" 175 #include "ios/web/navigation/navigation_manager_impl.h"
177 #include "ios/web/public/active_state_manager.h" 176 #include "ios/web/public/active_state_manager.h"
178 #include "ios/web/public/navigation_item.h" 177 #include "ios/web/public/navigation_item.h"
179 #import "ios/web/public/navigation_manager.h" 178 #import "ios/web/public/navigation_manager.h"
180 #include "ios/web/public/referrer_util.h" 179 #include "ios/web/public/referrer_util.h"
181 #include "ios/web/public/ssl_status.h" 180 #include "ios/web/public/ssl_status.h"
182 #include "ios/web/public/url_scheme_util.h" 181 #include "ios/web/public/url_scheme_util.h"
183 #include "ios/web/public/user_agent.h" 182 #include "ios/web/public/user_agent.h"
184 #include "ios/web/public/web_client.h" 183 #include "ios/web/public/web_client.h"
185 #import "ios/web/public/web_state/context_menu_params.h" 184 #import "ios/web/public/web_state/context_menu_params.h"
(...skipping 2225 matching lines...) Expand 10 before | Expand all | Expand 10 after
2411 openedByDOM:YES 2410 openedByDOM:YES
2412 atIndex:TabModelConstants::kTabPositionAutomatically 2411 atIndex:TabModelConstants::kTabPositionAutomatically
2413 inBackground:NO]; 2412 inBackground:NO];
2414 return childTab.webState; 2413 return childTab.webState;
2415 } 2414 }
2416 2415
2417 - (void)closeWebState:(web::WebState*)webState { 2416 - (void)closeWebState:(web::WebState*)webState {
2418 // Only allow a web page to close itself if it was opened by DOM, or if there 2417 // Only allow a web page to close itself if it was opened by DOM, or if there
2419 // are no navigation items. 2418 // are no navigation items.
2420 Tab* tab = LegacyTabHelper::GetTabForWebState(webState); 2419 Tab* tab = LegacyTabHelper::GetTabForWebState(webState);
2421 DCHECK([[tab navigationManagerImpl]->GetSessionController() isOpenedByDOM] || 2420 DCHECK(webState && webState->HasOpener() ||
Eugene But (OOO till 7-30) 2017/03/18 00:33:30 nit: Consider dropping |webState && | it's still g
kkhorimoto 2017/03/20 22:39:20 Done.
2422 ![tab navigationManager]->GetItemCount()); 2421 ![tab navigationManager]->GetItemCount());
2423 2422
2424 if (![self tabModel]) 2423 if (![self tabModel])
2425 return; 2424 return;
2426 2425
2427 NSUInteger index = [[self tabModel] indexOfTab:tab]; 2426 NSUInteger index = [[self tabModel] indexOfTab:tab];
2428 if (index != NSNotFound) 2427 if (index != NSNotFound)
2429 [[self tabModel] closeTabAtIndex:index]; 2428 [[self tabModel] closeTabAtIndex:index];
2430 } 2429 }
2431 2430
(...skipping 2693 matching lines...) Expand 10 before | Expand all | Expand 10 after
5125 5124
5126 - (UIView*)voiceSearchButton { 5125 - (UIView*)voiceSearchButton {
5127 return _voiceSearchButton; 5126 return _voiceSearchButton;
5128 } 5127 }
5129 5128
5130 - (id<LogoAnimationControllerOwner>)logoAnimationControllerOwner { 5129 - (id<LogoAnimationControllerOwner>)logoAnimationControllerOwner {
5131 return [self currentLogoAnimationControllerOwner]; 5130 return [self currentLogoAnimationControllerOwner];
5132 } 5131 }
5133 5132
5134 @end 5133 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698