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/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 1895 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1906 if (browserState_ && !browserState_->IsOffTheRecord()) { | 1906 if (browserState_ && !browserState_->IsOffTheRecord()) { |
| 1907 // Report the crash. | 1907 // Report the crash. |
| 1908 GetApplicationContext() | 1908 GetApplicationContext() |
| 1909 ->GetMetricsServicesManager() | 1909 ->GetMetricsServicesManager() |
| 1910 ->OnRendererProcessCrash(); | 1910 ->OnRendererProcessCrash(); |
| 1911 | 1911 |
| 1912 // Log the tab state for the termination. | 1912 // Log the tab state for the termination. |
| 1913 RendererTerminationTabState tab_state = | 1913 RendererTerminationTabState tab_state = |
| 1914 visible_ ? RendererTerminationTabState::FOREGROUND_TAB_FOREGROUND_APP | 1914 visible_ ? RendererTerminationTabState::FOREGROUND_TAB_FOREGROUND_APP |
| 1915 : RendererTerminationTabState::BACKGROUND_TAB_FOREGROUND_APP; | 1915 : RendererTerminationTabState::BACKGROUND_TAB_FOREGROUND_APP; |
| 1916 if ([UIApplication sharedApplication].applicationState == | 1916 if ([UIApplication sharedApplication].applicationState != |
| 1917 UIApplicationStateBackground) { | 1917 UIApplicationStateActive) { |
| 1918 tab_state = | 1918 tab_state = |
| 1919 visible_ ? RendererTerminationTabState::FOREGROUND_TAB_BACKGROUND_APP | 1919 visible_ ? RendererTerminationTabState::FOREGROUND_TAB_BACKGROUND_APP |
| 1920 : RendererTerminationTabState::BACKGROUND_TAB_BACKGROUND_APP; | 1920 : RendererTerminationTabState::BACKGROUND_TAB_BACKGROUND_APP; |
| 1921 } | 1921 } |
| 1922 UMA_HISTOGRAM_ENUMERATION( | 1922 UMA_HISTOGRAM_ENUMERATION( |
| 1923 kRendererTerminationStateHistogram, static_cast<int>(tab_state), | 1923 kRendererTerminationStateHistogram, static_cast<int>(tab_state), |
| 1924 static_cast<int>( | 1924 static_cast<int>( |
| 1925 RendererTerminationTabState::TERMINATION_TAB_STATE_COUNT)); | 1925 RendererTerminationTabState::TERMINATION_TAB_STATE_COUNT)); |
| 1926 if ([parentTabModel_ tabUsageRecorder]) | 1926 if ([parentTabModel_ tabUsageRecorder]) |
| 1927 [parentTabModel_ tabUsageRecorder]->RendererTerminated(self, visible_); | 1927 [parentTabModel_ tabUsageRecorder]->RendererTerminated(self, visible_); |
| 1928 } | 1928 } |
| 1929 | 1929 |
| 1930 BOOL applicationIsBackgrounded = | 1930 BOOL applicationIsBackgrounded = |
|
pkl (ping after 24h if needed)
2017/03/29 14:28:01
nit: Can we rename this var to isNotActive or appI
justincohen
2017/03/29 15:23:37
Done.
| |
| 1931 [UIApplication sharedApplication].applicationState == | 1931 [UIApplication sharedApplication].applicationState != |
| 1932 UIApplicationStateBackground; | 1932 UIApplicationStateActive; |
| 1933 if (visible_) { | 1933 if (visible_) { |
| 1934 if (!applicationIsBackgrounded) { | 1934 if (!applicationIsBackgrounded) { |
| 1935 base::WeakNSObject<Tab> weakSelf(self); | 1935 base::WeakNSObject<Tab> weakSelf(self); |
| 1936 base::scoped_nsobject<SadTabView> sadTabView( | 1936 base::scoped_nsobject<SadTabView> sadTabView( |
| 1937 [[SadTabView alloc] initWithReloadHandler:^{ | 1937 [[SadTabView alloc] initWithReloadHandler:^{ |
| 1938 base::scoped_nsobject<Tab> strongSelf([weakSelf retain]); | 1938 base::scoped_nsobject<Tab> strongSelf([weakSelf retain]); |
| 1939 | 1939 |
| 1940 // |check_for_repost| is true because this is called from SadTab and | 1940 // |check_for_repost| is true because this is called from SadTab and |
| 1941 // explicitly initiated by the user. | 1941 // explicitly initiated by the user. |
| 1942 [strongSelf navigationManager]->Reload(web::ReloadType::NORMAL, | 1942 [strongSelf navigationManager]->Reload(web::ReloadType::NORMAL, |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2087 | 2087 |
| 2088 - (TabModel*)parentTabModel { | 2088 - (TabModel*)parentTabModel { |
| 2089 return parentTabModel_; | 2089 return parentTabModel_; |
| 2090 } | 2090 } |
| 2091 | 2091 |
| 2092 - (FormInputAccessoryViewController*)inputAccessoryViewController { | 2092 - (FormInputAccessoryViewController*)inputAccessoryViewController { |
| 2093 return inputAccessoryViewController_.get(); | 2093 return inputAccessoryViewController_.get(); |
| 2094 } | 2094 } |
| 2095 | 2095 |
| 2096 @end | 2096 @end |
| OLD | NEW |