| 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/tabs/tab.h" | 5 #import "ios/chrome/browser/tabs/tab.h" |
| 6 | 6 |
| 7 #import <CoreLocation/CoreLocation.h> | 7 #import <CoreLocation/CoreLocation.h> |
| 8 #import <UIKit/UIKit.h> | 8 #import <UIKit/UIKit.h> |
| 9 | 9 |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 1044 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1055 history::HistoryService* historyService = | 1055 history::HistoryService* historyService = |
| 1056 ios::HistoryServiceFactory::GetForBrowserState( | 1056 ios::HistoryServiceFactory::GetForBrowserState( |
| 1057 browserState_, ServiceAccessType::IMPLICIT_ACCESS); | 1057 browserState_, ServiceAccessType::IMPLICIT_ACCESS); |
| 1058 DCHECK(historyService); | 1058 DCHECK(historyService); |
| 1059 | 1059 |
| 1060 for (size_t i = 0; i < addPageVector_.size(); ++i) | 1060 for (size_t i = 0; i < addPageVector_.size(); ++i) |
| 1061 historyService->AddPage(addPageVector_[i]); | 1061 historyService->AddPage(addPageVector_[i]); |
| 1062 addPageVector_.clear(); | 1062 addPageVector_.clear(); |
| 1063 } | 1063 } |
| 1064 | 1064 |
| 1065 - (void)webWillInitiateLoadWithParams: | |
| 1066 (web::NavigationManager::WebLoadParams&)params { | |
| 1067 GURL navUrl = params.url; | |
| 1068 | |
| 1069 // After a crash the NTP is loaded by default. | |
| 1070 if (navUrl.host() != kChromeUINewTabHost) { | |
| 1071 static BOOL hasLoadedPage = NO; | |
| 1072 if (!hasLoadedPage) { | |
| 1073 // As soon as an URL is loaded, a crash shouldn't be counted as a startup | |
| 1074 // crash. Since loading an url requires user action and is a significant | |
| 1075 // source of crashes that could lead to false positives in crash loop | |
| 1076 // detection. | |
| 1077 crash_util::ResetFailedStartupAttemptCount(); | |
| 1078 hasLoadedPage = YES; | |
| 1079 } | |
| 1080 } | |
| 1081 } | |
| 1082 | |
| 1083 - (void)webDidUpdateSessionForLoadWithParams: | 1065 - (void)webDidUpdateSessionForLoadWithParams: |
| 1084 (const web::NavigationManager::WebLoadParams&)params | 1066 (const web::NavigationManager::WebLoadParams&)params |
| 1085 wasInitialNavigation:(BOOL)initialNavigation { | 1067 wasInitialNavigation:(BOOL)initialNavigation { |
| 1086 GURL navUrl = params.url; | 1068 // After a crash the NTP is loaded by default. |
| 1069 if (params.url.host() != kChromeUINewTabHost) { |
| 1070 static BOOL hasLoadedPage = NO; |
| 1071 if (!hasLoadedPage) { |
| 1072 // As soon as load is initialted, a crash shouldn't be counted as a |
| 1073 // startup crash. Since initiating a url load requires user action and is |
| 1074 // a significant source of crashes that could lead to false positives in |
| 1075 // crash loop detection. |
| 1076 crash_util::ResetFailedStartupAttemptCount(); |
| 1077 hasLoadedPage = YES; |
| 1078 } |
| 1079 } |
| 1080 |
| 1087 ui::PageTransition transition = params.transition_type; | 1081 ui::PageTransition transition = params.transition_type; |
| 1088 | 1082 |
| 1089 // Record any explicit, non-redirect navigation as a clobber (as long as it's | 1083 // Record any explicit, non-redirect navigation as a clobber (as long as it's |
| 1090 // in a real tab). | 1084 // in a real tab). |
| 1091 if (!initialNavigation && !isPrerenderTab_ && | 1085 if (!initialNavigation && !isPrerenderTab_ && |
| 1092 !PageTransitionCoreTypeIs(transition, ui::PAGE_TRANSITION_RELOAD) && | 1086 !PageTransitionCoreTypeIs(transition, ui::PAGE_TRANSITION_RELOAD) && |
| 1093 (transition & ui::PAGE_TRANSITION_IS_REDIRECT_MASK) == 0) { | 1087 (transition & ui::PAGE_TRANSITION_IS_REDIRECT_MASK) == 0) { |
| 1094 base::RecordAction(UserMetricsAction("MobileTabClobbered")); | 1088 base::RecordAction(UserMetricsAction("MobileTabClobbered")); |
| 1095 } | 1089 } |
| 1096 if ([parentTabModel_ tabUsageRecorder]) | 1090 if ([parentTabModel_ tabUsageRecorder]) |
| (...skipping 998 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2095 | 2089 |
| 2096 - (TabModel*)parentTabModel { | 2090 - (TabModel*)parentTabModel { |
| 2097 return parentTabModel_; | 2091 return parentTabModel_; |
| 2098 } | 2092 } |
| 2099 | 2093 |
| 2100 - (FormInputAccessoryViewController*)inputAccessoryViewController { | 2094 - (FormInputAccessoryViewController*)inputAccessoryViewController { |
| 2101 return inputAccessoryViewController_.get(); | 2095 return inputAccessoryViewController_.get(); |
| 2102 } | 2096 } |
| 2103 | 2097 |
| 2104 @end | 2098 @end |
| OLD | NEW |