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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 64 #import "ios/chrome/browser/geolocation/omnibox_geolocation_controller.h" | 64 #import "ios/chrome/browser/geolocation/omnibox_geolocation_controller.h" |
| 65 #include "ios/chrome/browser/infobars/infobar_container_ios.h" | 65 #include "ios/chrome/browser/infobars/infobar_container_ios.h" |
| 66 #include "ios/chrome/browser/infobars/infobar_container_view.h" | 66 #include "ios/chrome/browser/infobars/infobar_container_view.h" |
| 67 #import "ios/chrome/browser/metrics/new_tab_page_uma.h" | 67 #import "ios/chrome/browser/metrics/new_tab_page_uma.h" |
| 68 #include "ios/chrome/browser/metrics/tab_usage_recorder.h" | 68 #include "ios/chrome/browser/metrics/tab_usage_recorder.h" |
| 69 #import "ios/chrome/browser/native_app_launcher/native_app_navigation_controller .h" | 69 #import "ios/chrome/browser/native_app_launcher/native_app_navigation_controller .h" |
| 70 #import "ios/chrome/browser/open_url_util.h" | 70 #import "ios/chrome/browser/open_url_util.h" |
| 71 #import "ios/chrome/browser/passwords/password_controller.h" | 71 #import "ios/chrome/browser/passwords/password_controller.h" |
| 72 #import "ios/chrome/browser/payments/payment_request_manager.h" | 72 #import "ios/chrome/browser/payments/payment_request_manager.h" |
| 73 #include "ios/chrome/browser/pref_names.h" | 73 #include "ios/chrome/browser/pref_names.h" |
| 74 #include "ios/chrome/browser/reading_list/offline_url_utils.h" | |
| 74 #include "ios/chrome/browser/reading_list/reading_list_model_factory.h" | 75 #include "ios/chrome/browser/reading_list/reading_list_model_factory.h" |
| 75 #include "ios/chrome/browser/search_engines/template_url_service_factory.h" | 76 #include "ios/chrome/browser/search_engines/template_url_service_factory.h" |
| 76 #include "ios/chrome/browser/sessions/ios_chrome_tab_restore_service_factory.h" | 77 #include "ios/chrome/browser/sessions/ios_chrome_tab_restore_service_factory.h" |
| 77 #include "ios/chrome/browser/sessions/tab_restore_service_delegate_impl_ios.h" | 78 #include "ios/chrome/browser/sessions/tab_restore_service_delegate_impl_ios.h" |
| 78 #include "ios/chrome/browser/sessions/tab_restore_service_delegate_impl_ios_fact ory.h" | 79 #include "ios/chrome/browser/sessions/tab_restore_service_delegate_impl_ios_fact ory.h" |
| 79 #import "ios/chrome/browser/snapshots/snapshot_cache.h" | 80 #import "ios/chrome/browser/snapshots/snapshot_cache.h" |
| 80 #import "ios/chrome/browser/snapshots/snapshot_overlay.h" | 81 #import "ios/chrome/browser/snapshots/snapshot_overlay.h" |
| 81 #import "ios/chrome/browser/snapshots/snapshot_overlay_provider.h" | 82 #import "ios/chrome/browser/snapshots/snapshot_overlay_provider.h" |
| 82 #import "ios/chrome/browser/storekit_launcher.h" | 83 #import "ios/chrome/browser/storekit_launcher.h" |
| 83 #import "ios/chrome/browser/tabs/legacy_tab_helper.h" | 84 #import "ios/chrome/browser/tabs/legacy_tab_helper.h" |
| (...skipping 3227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3311 web::NavigationItem* navItem = [tab navigationManager]->GetVisibleItem(); | 3312 web::NavigationItem* navItem = [tab navigationManager]->GetVisibleItem(); |
| 3312 | 3313 |
| 3313 // It is fully expected to have a navItem here, as showPageInfoPopup can only | 3314 // It is fully expected to have a navItem here, as showPageInfoPopup can only |
| 3314 // be trigerred by a button enabled when a current item matches some | 3315 // be trigerred by a button enabled when a current item matches some |
| 3315 // conditions. However a crash was seen were navItem was NULL hence this | 3316 // conditions. However a crash was seen were navItem was NULL hence this |
| 3316 // test after a DCHECK. | 3317 // test after a DCHECK. |
| 3317 DCHECK(navItem); | 3318 DCHECK(navItem); |
| 3318 if (!navItem) | 3319 if (!navItem) |
| 3319 return; | 3320 return; |
| 3320 | 3321 |
| 3321 // Don't show if the page is native. | 3322 // Don't show if the page is native except for offline pages (to show the |
| 3322 if ([self isTabNativePage:tab]) | 3323 // offline page info). |
| 3324 if ([self isTabNativePage:tab] && | |
| 3325 !reading_list::IsOfflineURL(navItem->GetURL())) { | |
| 3323 return; | 3326 return; |
| 3327 } | |
| 3324 | 3328 |
| 3325 // Don't show the bubble twice (this can happen when tapping very quickly in | 3329 // Don't show the bubble twice (this can happen when tapping very quickly in |
| 3326 // accessibility mode). | 3330 // accessibility mode). |
| 3327 if (_pageInfoController) | 3331 if (_pageInfoController) |
| 3328 return; | 3332 return; |
| 3329 | 3333 |
| 3330 base::RecordAction(UserMetricsAction("MobileToolbarPageSecurityInfo")); | 3334 base::RecordAction(UserMetricsAction("MobileToolbarPageSecurityInfo")); |
| 3331 | 3335 |
| 3332 // Dismiss the omnibox (if open). | 3336 // Dismiss the omnibox (if open). |
| 3333 [_toolbarController cancelOmniboxEdit]; | 3337 [_toolbarController cancelOmniboxEdit]; |
| 3334 | 3338 |
| 3335 [[NSNotificationCenter defaultCenter] | 3339 [[NSNotificationCenter defaultCenter] |
| 3336 postNotificationName:ios_internal::kPageInfoWillShowNotification | 3340 postNotificationName:ios_internal::kPageInfoWillShowNotification |
| 3337 object:nil]; | 3341 object:nil]; |
| 3338 | 3342 |
| 3339 // TODO(rohitrao): Get rid of PageInfoModel completely. | 3343 // TODO(rohitrao): Get rid of PageInfoModel completely. |
| 3340 PageInfoModelBubbleBridge* bridge = new PageInfoModelBubbleBridge(); | 3344 PageInfoModelBubbleBridge* bridge = new PageInfoModelBubbleBridge(); |
| 3341 PageInfoModel* pageInfoModel = new PageInfoModel( | 3345 PageInfoModel* pageInfoModel = new PageInfoModel( |
| 3342 _browserState, navItem->GetURL(), navItem->GetSSL(), bridge); | 3346 _browserState, navItem->GetURL(), navItem->GetSSL(), bridge); |
|
kkhorimoto
2017/03/01 18:43:53
Are we sure we want to be able to show the PageInf
kkhorimoto
2017/03/01 18:46:42
Actually Eugene showed me that there's already a s
| |
| 3343 | 3347 |
| 3344 UIView* view = [self view]; | 3348 UIView* view = [self view]; |
| 3345 _pageInfoController.reset([[PageInfoViewController alloc] | 3349 _pageInfoController.reset([[PageInfoViewController alloc] |
| 3346 initWithModel:pageInfoModel | 3350 initWithModel:pageInfoModel |
| 3347 bridge:bridge | 3351 bridge:bridge |
| 3348 sourceFrame:[sourceView convertRect:[sourceView bounds] toView:view] | 3352 sourceFrame:[sourceView convertRect:[sourceView bounds] toView:view] |
| 3349 parentView:view]); | 3353 parentView:view]); |
| 3350 bridge->set_controller(_pageInfoController.get()); | 3354 bridge->set_controller(_pageInfoController.get()); |
| 3351 } | 3355 } |
| 3352 | 3356 |
| (...skipping 1668 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5021 | 5025 |
| 5022 - (UIView*)voiceSearchButton { | 5026 - (UIView*)voiceSearchButton { |
| 5023 return _voiceSearchButton; | 5027 return _voiceSearchButton; |
| 5024 } | 5028 } |
| 5025 | 5029 |
| 5026 - (id<LogoAnimationControllerOwner>)logoAnimationControllerOwner { | 5030 - (id<LogoAnimationControllerOwner>)logoAnimationControllerOwner { |
| 5027 return [self currentLogoAnimationControllerOwner]; | 5031 return [self currentLogoAnimationControllerOwner]; |
| 5028 } | 5032 } |
| 5029 | 5033 |
| 5030 @end | 5034 @end |
| OLD | NEW |