Chromium Code Reviews| 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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 49 #include "ios/chrome/browser/bookmarks/bookmark_model_factory.h" | 49 #include "ios/chrome/browser/bookmarks/bookmark_model_factory.h" |
| 50 #include "ios/chrome/browser/browser_state/chrome_browser_state.h" | 50 #include "ios/chrome/browser/browser_state/chrome_browser_state.h" |
| 51 #include "ios/chrome/browser/chrome_url_constants.h" | 51 #include "ios/chrome/browser/chrome_url_constants.h" |
| 52 #include "ios/chrome/browser/chrome_url_util.h" | 52 #include "ios/chrome/browser/chrome_url_util.h" |
| 53 #import "ios/chrome/browser/content_suggestions/content_suggestions_coordinator. h" | 53 #import "ios/chrome/browser/content_suggestions/content_suggestions_coordinator. h" |
| 54 #include "ios/chrome/browser/experimental_flags.h" | 54 #include "ios/chrome/browser/experimental_flags.h" |
| 55 #import "ios/chrome/browser/favicon/favicon_loader.h" | 55 #import "ios/chrome/browser/favicon/favicon_loader.h" |
| 56 #include "ios/chrome/browser/favicon/ios_chrome_favicon_loader_factory.h" | 56 #include "ios/chrome/browser/favicon/ios_chrome_favicon_loader_factory.h" |
| 57 #import "ios/chrome/browser/find_in_page/find_in_page_controller.h" | 57 #import "ios/chrome/browser/find_in_page/find_in_page_controller.h" |
| 58 #import "ios/chrome/browser/find_in_page/find_in_page_model.h" | 58 #import "ios/chrome/browser/find_in_page/find_in_page_model.h" |
| 59 #import "ios/chrome/browser/find_in_page/find_tab_helper.h" | |
| 59 #include "ios/chrome/browser/first_run/first_run.h" | 60 #include "ios/chrome/browser/first_run/first_run.h" |
| 60 #import "ios/chrome/browser/geolocation/omnibox_geolocation_controller.h" | 61 #import "ios/chrome/browser/geolocation/omnibox_geolocation_controller.h" |
| 61 #include "ios/chrome/browser/infobars/infobar_container_ios.h" | 62 #include "ios/chrome/browser/infobars/infobar_container_ios.h" |
| 62 #include "ios/chrome/browser/infobars/infobar_container_view.h" | 63 #include "ios/chrome/browser/infobars/infobar_container_view.h" |
| 63 #import "ios/chrome/browser/metrics/new_tab_page_uma.h" | 64 #import "ios/chrome/browser/metrics/new_tab_page_uma.h" |
| 64 #include "ios/chrome/browser/metrics/tab_usage_recorder.h" | 65 #include "ios/chrome/browser/metrics/tab_usage_recorder.h" |
| 65 #import "ios/chrome/browser/native_app_launcher/native_app_navigation_controller .h" | 66 #import "ios/chrome/browser/native_app_launcher/native_app_navigation_controller .h" |
| 66 #import "ios/chrome/browser/open_url_util.h" | 67 #import "ios/chrome/browser/open_url_util.h" |
| 67 #import "ios/chrome/browser/passwords/password_controller.h" | 68 #import "ios/chrome/browser/passwords/password_controller.h" |
| 68 #import "ios/chrome/browser/payments/payment_request_manager.h" | 69 #import "ios/chrome/browser/payments/payment_request_manager.h" |
| (...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 282 return true; | 283 return true; |
| 283 std::string url_host = url.host(); | 284 std::string url_host = url.host(); |
| 284 return url_host != kChromeUIHistoryHost && | 285 return url_host != kChromeUIHistoryHost && |
| 285 url_host != kChromeUIHistoryFrameHost; | 286 url_host != kChromeUIHistoryFrameHost; |
| 286 } | 287 } |
| 287 | 288 |
| 288 // Temporary key to use when storing native controllers vended to tabs before | 289 // Temporary key to use when storing native controllers vended to tabs before |
| 289 // they are added to the tab model. | 290 // they are added to the tab model. |
| 290 NSString* const kNativeControllerTemporaryKey = @"NativeControllerTemporaryKey"; | 291 NSString* const kNativeControllerTemporaryKey = @"NativeControllerTemporaryKey"; |
| 291 | 292 |
| 293 // Helper function to return the FindTabHelper for the given |tab|. If |tab| is | |
| 294 // nullptr, returns nullptr. | |
|
marq (ping after 24h)
2017/01/31 16:02:49
Why not just return the helper's FindInPageControl
rohitrao (ping after 24h)
2017/02/08 16:14:59
Done.
| |
| 295 FindTabHelper* GetFindTabHelper(Tab* tab) { | |
| 296 if (!tab) { | |
| 297 return nullptr; | |
| 298 } | |
| 299 return FindTabHelper::FromWebState(tab.webState); | |
|
Eugene But (OOO till 7-30)
2017/01/31 19:03:48
Optional nit: do you want to use ternary operator
rohitrao (ping after 24h)
2017/02/08 16:14:59
Acknowledged.
| |
| 300 } | |
| 301 | |
| 292 } // anonymous namespace | 302 } // anonymous namespace |
| 293 | 303 |
| 294 @interface BrowserViewController ()<AppRatingPromptDelegate, | 304 @interface BrowserViewController ()<AppRatingPromptDelegate, |
| 295 ContextualSearchControllerDelegate, | 305 ContextualSearchControllerDelegate, |
| 296 ContextualSearchPanelMotionObserver, | 306 ContextualSearchPanelMotionObserver, |
| 297 CRWNativeContentProvider, | 307 CRWNativeContentProvider, |
| 298 CRWWebStateDelegate, | 308 CRWWebStateDelegate, |
| 299 DialogPresenterDelegate, | 309 DialogPresenterDelegate, |
| 300 FullScreenControllerDelegate, | 310 FullScreenControllerDelegate, |
| 301 KeyCommandsPlumbing, | 311 KeyCommandsPlumbing, |
| (...skipping 793 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1095 Tab* tab = [_model currentTab]; | 1105 Tab* tab = [_model currentTab]; |
| 1096 // TODO(shreyasv): Make it so the URL returned by the tab is always valid and | 1106 // TODO(shreyasv): Make it so the URL returned by the tab is always valid and |
| 1097 // remove check on net::NSURLWithGURL(tab.url) ( http://crbug.com/400999 ). | 1107 // remove check on net::NSURLWithGURL(tab.url) ( http://crbug.com/400999 ). |
| 1098 return tab && !tab.url.SchemeIs(kChromeUIScheme) && | 1108 return tab && !tab.url.SchemeIs(kChromeUIScheme) && |
| 1099 net::NSURLWithGURL(tab.url); | 1109 net::NSURLWithGURL(tab.url); |
| 1100 } | 1110 } |
| 1101 | 1111 |
| 1102 - (BOOL)canShowFindBar { | 1112 - (BOOL)canShowFindBar { |
| 1103 // Make sure web controller can handle find in page. | 1113 // Make sure web controller can handle find in page. |
| 1104 Tab* tab = [_model currentTab]; | 1114 Tab* tab = [_model currentTab]; |
| 1105 if (![tab.findInPageController canFindInPage]) | 1115 FindTabHelper* findHelper = GetFindTabHelper(tab); |
| 1116 if (!findHelper) | |
| 1117 return NO; | |
| 1118 | |
| 1119 FindInPageController* controller = findHelper->GetController(); | |
| 1120 if (![controller canFindInPage]) | |
| 1106 return NO; | 1121 return NO; |
| 1107 | 1122 |
| 1108 // Don't show twice. | 1123 // Don't show twice. |
| 1109 if (tab.findInPageController.findInPageModel.enabled) | 1124 if (controller.findInPageModel.enabled) |
| 1110 return NO; | 1125 return NO; |
| 1111 | 1126 |
| 1112 return YES; | 1127 return YES; |
| 1113 } | 1128 } |
| 1114 | 1129 |
| 1115 - (void)setVisible:(BOOL)visible { | 1130 - (void)setVisible:(BOOL)visible { |
| 1116 if (_visible == visible) | 1131 if (_visible == visible) |
| 1117 return; | 1132 return; |
| 1118 _visible = visible; | 1133 _visible = visible; |
| 1119 } | 1134 } |
| (...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1466 selector:@selector(tabWasAdded:) | 1481 selector:@selector(tabWasAdded:) |
| 1467 name:kTabModelNewTabWillOpenNotification | 1482 name:kTabModelNewTabWillOpenNotification |
| 1468 object:_model]; | 1483 object:_model]; |
| 1469 } | 1484 } |
| 1470 | 1485 |
| 1471 - (void)pageLoadStarting:(NSNotification*)notify { | 1486 - (void)pageLoadStarting:(NSNotification*)notify { |
| 1472 Tab* tab = notify.userInfo[kTabModelTabKey]; | 1487 Tab* tab = notify.userInfo[kTabModelTabKey]; |
| 1473 DCHECK(tab && ([_model indexOfTab:tab] != NSNotFound)); | 1488 DCHECK(tab && ([_model indexOfTab:tab] != NSNotFound)); |
| 1474 // Hide find bar when navigating to a new page. | 1489 // Hide find bar when navigating to a new page. |
| 1475 [self hideFindBarWithAnimation:NO]; | 1490 [self hideFindBarWithAnimation:NO]; |
| 1476 tab.findInPageController.findInPageModel.enabled = NO; | 1491 |
| 1492 FindTabHelper* findHelper = GetFindTabHelper(tab); | |
| 1493 if (findHelper) { | |
| 1494 FindInPageController* controller = | |
| 1495 findHelper->GetController(); | |
| 1496 controller.findInPageModel.enabled = NO; | |
| 1497 } | |
| 1498 | |
| 1477 if (tab == [_model currentTab]) { | 1499 if (tab == [_model currentTab]) { |
| 1478 // TODO(pinkerton): Fill in here about hiding the forward button on | 1500 // TODO(pinkerton): Fill in here about hiding the forward button on |
| 1479 // navigation. | 1501 // navigation. |
| 1480 } | 1502 } |
| 1481 } | 1503 } |
| 1482 | 1504 |
| 1483 - (void)pageLoadStarted:(NSNotification*)notify { | 1505 - (void)pageLoadStarted:(NSNotification*)notify { |
| 1484 Tab* tab = notify.userInfo[kTabModelTabKey]; | 1506 Tab* tab = notify.userInfo[kTabModelTabKey]; |
| 1485 DCHECK(tab); | 1507 DCHECK(tab); |
| 1486 if (tab == [_model currentTab]) { | 1508 if (tab == [_model currentTab]) { |
| (...skipping 442 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1929 | 1951 |
| 1930 if (tab.isPrerenderTab && !_toolbarModelIOS->IsLoading()) | 1952 if (tab.isPrerenderTab && !_toolbarModelIOS->IsLoading()) |
| 1931 [_toolbarController showPrerenderingAnimation]; | 1953 [_toolbarController showPrerenderingAnimation]; |
| 1932 | 1954 |
| 1933 // Also update the loading state for the tools menu (that is really an | 1955 // Also update the loading state for the tools menu (that is really an |
| 1934 // extension of the toolbar on the iPhone). | 1956 // extension of the toolbar on the iPhone). |
| 1935 if (!IsIPadIdiom()) | 1957 if (!IsIPadIdiom()) |
| 1936 [[_toolbarController toolsPopupController] | 1958 [[_toolbarController toolsPopupController] |
| 1937 setIsTabLoading:_toolbarModelIOS->IsLoading()]; | 1959 setIsTabLoading:_toolbarModelIOS->IsLoading()]; |
| 1938 | 1960 |
| 1939 if (tab.findInPageController.findInPageModel.enabled) | 1961 FindTabHelper* findHelper = GetFindTabHelper(tab); |
| 1940 [self showFindBarWithAnimation:NO | 1962 if (findHelper) { |
| 1941 selectText:YES | 1963 FindInPageController* controller = |
| 1942 shouldFocus:[_findBarController isFocused]]; | 1964 findHelper->GetController(); |
| 1965 if (controller.findInPageModel.enabled) | |
| 1966 [self showFindBarWithAnimation:NO | |
| 1967 selectText:YES | |
| 1968 shouldFocus:[_findBarController isFocused]]; | |
| 1969 } | |
| 1943 | 1970 |
| 1944 // Hide the toolbar if displaying phone NTP. | 1971 // Hide the toolbar if displaying phone NTP. |
| 1945 if (!IsIPadIdiom()) { | 1972 if (!IsIPadIdiom()) { |
| 1946 CRWSessionEntry* entry = | 1973 CRWSessionEntry* entry = |
| 1947 [[tab navigationManager]->GetSessionController() currentEntry]; | 1974 [[tab navigationManager]->GetSessionController() currentEntry]; |
| 1948 BOOL hideToolbar = NO; | 1975 BOOL hideToolbar = NO; |
| 1949 if (entry) { | 1976 if (entry) { |
| 1950 GURL url = [entry navigationItem]->GetURL(); | 1977 GURL url = [entry navigationItem]->GetURL(); |
| 1951 BOOL isNTP = url.GetOrigin() == GURL(kChromeUINewTabURL); | 1978 BOOL isNTP = url.GetOrigin() == GURL(kChromeUINewTabURL); |
| 1952 hideToolbar = isNTP && !_isOffTheRecord && | 1979 hideToolbar = isNTP && !_isOffTheRecord && |
| (...skipping 1999 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3952 currentlyBookmarked:_toolbarModelIOS->IsCurrentTabBookmarkedByUser() | 3979 currentlyBookmarked:_toolbarModelIOS->IsCurrentTabBookmarkedByUser() |
| 3953 inView:[_toolbarController bookmarkButtonView] | 3980 inView:[_toolbarController bookmarkButtonView] |
| 3954 originRect:[_toolbarController bookmarkButtonAnchorRect]]; | 3981 originRect:[_toolbarController bookmarkButtonAnchorRect]]; |
| 3955 break; | 3982 break; |
| 3956 case IDC_CLOSE_TAB: | 3983 case IDC_CLOSE_TAB: |
| 3957 [self closeCurrentTab]; | 3984 [self closeCurrentTab]; |
| 3958 break; | 3985 break; |
| 3959 case IDC_FIND: | 3986 case IDC_FIND: |
| 3960 [self initFindBarForTab]; | 3987 [self initFindBarForTab]; |
| 3961 break; | 3988 break; |
| 3962 case IDC_FIND_NEXT: | 3989 case IDC_FIND_NEXT: { |
| 3990 FindInPageController* findInPageController = | |
| 3991 FindTabHelper::FromWebState([_model currentTab].webState) | |
|
Eugene But (OOO till 7-30)
2017/01/31 19:03:48
Should you use your helper function here and in ot
rohitrao (ping after 24h)
2017/02/08 16:14:59
Changed for now, but I'm going to revisit. I thin
| |
| 3992 ->GetController(); | |
| 3963 // TODO(crbug.com/603524): Reshow find bar if necessary. | 3993 // TODO(crbug.com/603524): Reshow find bar if necessary. |
| 3964 [[_model currentTab].findInPageController | 3994 [findInPageController findNextStringInPageWithCompletionHandler:^{ |
| 3965 findNextStringInPageWithCompletionHandler:^{ | 3995 FindInPageModel* model = findInPageController.findInPageModel; |
| 3966 FindInPageModel* model = | 3996 [_findBarController updateResultsCount:model]; |
| 3967 [_model currentTab].findInPageController.findInPageModel; | 3997 }]; |
| 3968 [_findBarController updateResultsCount:model]; | |
| 3969 }]; | |
| 3970 break; | 3998 break; |
| 3971 case IDC_FIND_PREVIOUS: | 3999 } |
| 4000 case IDC_FIND_PREVIOUS: { | |
| 4001 FindInPageController* findInPageController = | |
| 4002 FindTabHelper::FromWebState([_model currentTab].webState) | |
| 4003 ->GetController(); | |
| 3972 // TODO(crbug.com/603524): Reshow find bar if necessary. | 4004 // TODO(crbug.com/603524): Reshow find bar if necessary. |
| 3973 [[_model currentTab].findInPageController | 4005 [findInPageController findPreviousStringInPageWithCompletionHandler:^{ |
| 3974 findPreviousStringInPageWithCompletionHandler:^{ | 4006 FindInPageModel* model = findInPageController.findInPageModel; |
| 3975 FindInPageModel* model = | 4007 [_findBarController updateResultsCount:model]; |
| 3976 [_model currentTab].findInPageController.findInPageModel; | 4008 }]; |
| 3977 [_findBarController updateResultsCount:model]; | |
| 3978 }]; | |
| 3979 break; | 4009 break; |
| 4010 } | |
| 3980 case IDC_FIND_CLOSE: | 4011 case IDC_FIND_CLOSE: |
| 3981 [self closeFindInPage]; | 4012 [self closeFindInPage]; |
| 3982 break; | 4013 break; |
| 3983 case IDC_FIND_UPDATE: | 4014 case IDC_FIND_UPDATE: |
| 3984 [self searchFindInPage]; | 4015 [self searchFindInPage]; |
| 3985 break; | 4016 break; |
| 3986 case IDC_FORWARD: | 4017 case IDC_FORWARD: |
| 3987 [[_model currentTab] goForward]; | 4018 [[_model currentTab] goForward]; |
| 3988 break; | 4019 break; |
| 3989 case IDC_FULLSCREEN: | 4020 case IDC_FULLSCREEN: |
| (...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4208 | 4239 |
| 4209 - (void)clearPresentedStateWithCompletion:(ProceduralBlock)completion { | 4240 - (void)clearPresentedStateWithCompletion:(ProceduralBlock)completion { |
| 4210 [[_dependencyFactory shareControllerInstance] cancelShareAnimated:NO]; | 4241 [[_dependencyFactory shareControllerInstance] cancelShareAnimated:NO]; |
| 4211 [_bookmarkInteractionController dismissBookmarkModalControllerAnimated:NO]; | 4242 [_bookmarkInteractionController dismissBookmarkModalControllerAnimated:NO]; |
| 4212 [_bookmarkInteractionController dismissSnackbar]; | 4243 [_bookmarkInteractionController dismissSnackbar]; |
| 4213 [_toolbarController cancelOmniboxEdit]; | 4244 [_toolbarController cancelOmniboxEdit]; |
| 4214 [_dialogPresenter cancelAllDialogs]; | 4245 [_dialogPresenter cancelAllDialogs]; |
| 4215 [self hidePageInfoPopupForView:nil]; | 4246 [self hidePageInfoPopupForView:nil]; |
| 4216 if (_voiceSearchController) | 4247 if (_voiceSearchController) |
| 4217 _voiceSearchController->DismissMicPermissionsHelp(); | 4248 _voiceSearchController->DismissMicPermissionsHelp(); |
| 4218 [[_model currentTab] dismissModals]; | 4249 |
| 4219 [[_model currentTab].findInPageController | 4250 Tab* currentTab = [_model currentTab]; |
| 4220 disableFindInPageWithCompletionHandler:^{ | 4251 [currentTab dismissModals]; |
| 4252 | |
| 4253 FindTabHelper* findHelper = GetFindTabHelper(currentTab); | |
| 4254 if (findHelper) { | |
| 4255 FindInPageController* findInPageController = | |
| 4256 findHelper | |
| 4257 ->GetController(); | |
| 4258 [findInPageController disableFindInPageWithCompletionHandler:^{ | |
| 4221 [self updateFindBar:NO shouldFocus:NO]; | 4259 [self updateFindBar:NO shouldFocus:NO]; |
| 4222 }]; | 4260 }]; |
| 4261 } | |
| 4262 | |
| 4223 [_contextualSearchController movePanelOffscreen]; | 4263 [_contextualSearchController movePanelOffscreen]; |
| 4224 | |
| 4225 [_paymentRequestManager cancelRequest]; | 4264 [_paymentRequestManager cancelRequest]; |
| 4226 | |
| 4227 [_printController dismissAnimated:YES]; | 4265 [_printController dismissAnimated:YES]; |
| 4228 _printController.reset(); | 4266 _printController.reset(); |
| 4229 if (_noTabsController.get()) | 4267 if (_noTabsController.get()) |
| 4230 [_noTabsController dismissToolsMenuPopup]; | 4268 [_noTabsController dismissToolsMenuPopup]; |
| 4231 else | 4269 else |
| 4232 [_toolbarController dismissToolsMenuPopup]; | 4270 [_toolbarController dismissToolsMenuPopup]; |
| 4233 [_contextMenuCoordinator stop]; | 4271 [_contextMenuCoordinator stop]; |
| 4234 [self dismissRateThisAppDialog]; | 4272 [self dismissRateThisAppDialog]; |
| 4235 | 4273 |
| 4236 [_contentSuggestionsCoordinator stop]; | 4274 [_contentSuggestionsCoordinator stop]; |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4316 // Create find bar controller and pass it to the web controller. | 4354 // Create find bar controller and pass it to the web controller. |
| 4317 - (void)initFindBarForTab { | 4355 - (void)initFindBarForTab { |
| 4318 if (!self.canShowFindBar) | 4356 if (!self.canShowFindBar) |
| 4319 return; | 4357 return; |
| 4320 | 4358 |
| 4321 if (!_findBarController) | 4359 if (!_findBarController) |
| 4322 _findBarController.reset( | 4360 _findBarController.reset( |
| 4323 [[FindBarControllerIOS alloc] initWithIncognito:_isOffTheRecord]); | 4361 [[FindBarControllerIOS alloc] initWithIncognito:_isOffTheRecord]); |
| 4324 | 4362 |
| 4325 Tab* tab = [_model currentTab]; | 4363 Tab* tab = [_model currentTab]; |
| 4326 DCHECK(!tab.findInPageController.findInPageModel.enabled); | 4364 FindInPageController* controller = |
| 4327 tab.findInPageController.findInPageModel.enabled = YES; | 4365 FindTabHelper::FromWebState(tab.webState)->GetController(); |
| 4366 DCHECK(!controller.findInPageModel.enabled); | |
| 4367 controller.findInPageModel.enabled = YES; | |
| 4328 [self showFindBarWithAnimation:YES selectText:YES shouldFocus:YES]; | 4368 [self showFindBarWithAnimation:YES selectText:YES shouldFocus:YES]; |
| 4329 } | 4369 } |
| 4330 | 4370 |
| 4331 - (void)searchFindInPage { | 4371 - (void)searchFindInPage { |
| 4332 FindInPageController* findInPageController = | 4372 FindInPageController* findInPageController = |
| 4333 [[_model currentTab] findInPageController]; | 4373 FindTabHelper::FromWebState([_model currentTab].webState) |
| 4374 ->GetController(); | |
| 4334 base::WeakNSObject<BrowserViewController> weakSelf(self); | 4375 base::WeakNSObject<BrowserViewController> weakSelf(self); |
| 4335 [findInPageController | 4376 [findInPageController findStringInPage:[_findBarController searchTerm] |
| 4336 findStringInPage:[_findBarController searchTerm] | 4377 completionHandler:^{ |
| 4337 completionHandler:^{ | 4378 FindInPageModel* model = |
| 4338 FindInPageModel* model = | 4379 findInPageController.findInPageModel; |
| 4339 [_model currentTab].findInPageController.findInPageModel; | 4380 [_findBarController updateResultsCount:model]; |
| 4340 [_findBarController updateResultsCount:model]; | 4381 }]; |
| 4341 }]; | |
| 4342 if (!_isOffTheRecord) | 4382 if (!_isOffTheRecord) |
| 4343 [findInPageController saveSearchTerm]; | 4383 [findInPageController saveSearchTerm]; |
| 4344 } | 4384 } |
| 4345 | 4385 |
| 4346 - (void)closeFindInPage { | 4386 - (void)closeFindInPage { |
| 4347 base::WeakNSObject<BrowserViewController> weakSelf(self); | 4387 base::WeakNSObject<BrowserViewController> weakSelf(self); |
| 4348 [[_model currentTab].findInPageController | 4388 FindInPageController* findInPageController = |
| 4349 disableFindInPageWithCompletionHandler:^{ | 4389 FindTabHelper::FromWebState([_model currentTab].webState) |
| 4350 [weakSelf updateFindBar:NO shouldFocus:NO]; | 4390 ->GetController(); |
| 4351 }]; | 4391 [findInPageController disableFindInPageWithCompletionHandler:^{ |
| 4392 [weakSelf updateFindBar:NO shouldFocus:NO]; | |
| 4393 }]; | |
| 4352 } | 4394 } |
| 4353 | 4395 |
| 4354 - (void)updateFindBar:(BOOL)initialUpdate shouldFocus:(BOOL)shouldFocus { | 4396 - (void)updateFindBar:(BOOL)initialUpdate shouldFocus:(BOOL)shouldFocus { |
| 4355 FindInPageModel* model = | 4397 FindInPageController* findInPageController = |
| 4356 [_model currentTab].findInPageController.findInPageModel; | 4398 FindTabHelper::FromWebState([_model currentTab].webState) |
| 4399 ->GetController(); | |
| 4400 FindInPageModel* model = findInPageController.findInPageModel; | |
| 4357 if (model.enabled) { | 4401 if (model.enabled) { |
| 4358 if (initialUpdate && !_isOffTheRecord) { | 4402 if (initialUpdate && !_isOffTheRecord) { |
| 4359 [[_model currentTab].findInPageController restoreSearchTerm]; | 4403 [findInPageController restoreSearchTerm]; |
| 4360 } | 4404 } |
| 4361 | 4405 |
| 4362 [self setFramesForHeaders:[self headerViews] | 4406 [self setFramesForHeaders:[self headerViews] |
| 4363 atOffset:[self currentHeaderOffset]]; | 4407 atOffset:[self currentHeaderOffset]]; |
| 4364 [_findBarController updateView:model | 4408 [_findBarController updateView:model |
| 4365 initialUpdate:initialUpdate | 4409 initialUpdate:initialUpdate |
| 4366 focusTextfield:shouldFocus]; | 4410 focusTextfield:shouldFocus]; |
| 4367 } else { | 4411 } else { |
| 4368 [self hideFindBarWithAnimation:YES]; | 4412 [self hideFindBarWithAnimation:YES]; |
| 4369 } | 4413 } |
| (...skipping 798 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5168 | 5212 |
| 5169 - (UIView*)voiceSearchButton { | 5213 - (UIView*)voiceSearchButton { |
| 5170 return _voiceSearchButton; | 5214 return _voiceSearchButton; |
| 5171 } | 5215 } |
| 5172 | 5216 |
| 5173 - (id<LogoAnimationControllerOwner>)logoAnimationControllerOwner { | 5217 - (id<LogoAnimationControllerOwner>)logoAnimationControllerOwner { |
| 5174 return [self currentLogoAnimationControllerOwner]; | 5218 return [self currentLogoAnimationControllerOwner]; |
| 5175 } | 5219 } |
| 5176 | 5220 |
| 5177 @end | 5221 @end |
| OLD | NEW |