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

Side by Side Diff: ios/chrome/browser/application_context_impl.cc

Issue 1463833002: [iOS] Unfork ChromeBrowserStateManager (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month 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
« no previous file with comments | « no previous file | ios/chrome/browser/signin/ios_chrome_signin_status_metrics_provider_delegate.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 #include "ios/chrome/browser/application_context_impl.h" 5 #include "ios/chrome/browser/application_context_impl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 if (metrics_service && local_state) { 80 if (metrics_service && local_state) {
81 metrics_service->OnAppEnterForeground(); 81 metrics_service->OnAppEnterForeground();
82 local_state->CommitPendingWrite(); 82 local_state->CommitPendingWrite();
83 } 83 }
84 84
85 variations::VariationsService* variations_service = GetVariationsService(); 85 variations::VariationsService* variations_service = GetVariationsService();
86 if (variations_service) 86 if (variations_service)
87 variations_service->OnAppEnterForeground(); 87 variations_service->OnAppEnterForeground();
88 88
89 std::vector<ios::ChromeBrowserState*> loaded_browser_state = 89 std::vector<ios::ChromeBrowserState*> loaded_browser_state =
90 GetChromeBrowserStateManager()->GetLoadedChromeBrowserStates(); 90 GetChromeBrowserStateManager()->GetLoadedBrowserStates();
91 for (ios::ChromeBrowserState* browser_state : loaded_browser_state) { 91 for (ios::ChromeBrowserState* browser_state : loaded_browser_state) {
92 browser_state->SetExitType(ios::ChromeBrowserState::EXIT_CRASHED); 92 browser_state->SetExitType(ios::ChromeBrowserState::EXIT_CRASHED);
93 } 93 }
94 } 94 }
95 95
96 void ApplicationContextImpl::OnAppEnterBackground() { 96 void ApplicationContextImpl::OnAppEnterBackground() {
97 DCHECK(thread_checker_.CalledOnValidThread()); 97 DCHECK(thread_checker_.CalledOnValidThread());
98 // Mark all the ChromeBrowserStates as clean and persist history. 98 // Mark all the ChromeBrowserStates as clean and persist history.
99 std::vector<ios::ChromeBrowserState*> loaded_browser_state = 99 std::vector<ios::ChromeBrowserState*> loaded_browser_state =
100 GetChromeBrowserStateManager()->GetLoadedChromeBrowserStates(); 100 GetChromeBrowserStateManager()->GetLoadedBrowserStates();
101 for (ios::ChromeBrowserState* browser_state : loaded_browser_state) { 101 for (ios::ChromeBrowserState* browser_state : loaded_browser_state) {
102 if (history::HistoryService* history_service = 102 if (history::HistoryService* history_service =
103 ios::HistoryServiceFactory::GetForBrowserStateIfExists( 103 ios::HistoryServiceFactory::GetForBrowserStateIfExists(
104 browser_state, ServiceAccessType::EXPLICIT_ACCESS)) { 104 browser_state, ServiceAccessType::EXPLICIT_ACCESS)) {
105 history_service->HandleBackgrounding(); 105 history_service->HandleBackgrounding();
106 } 106 }
107 107
108 browser_state->SetExitType(ios::ChromeBrowserState::EXIT_NORMAL); 108 browser_state->SetExitType(ios::ChromeBrowserState::EXIT_NORMAL);
109 PrefService* browser_state_prefs = browser_state->GetPrefs(); 109 PrefService* browser_state_prefs = browser_state->GetPrefs();
110 if (browser_state_prefs) 110 if (browser_state_prefs)
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 std::max(std::min(max_per_proxy, 99), 207 std::max(std::min(max_per_proxy, 99),
208 net::ClientSocketPoolManager::max_sockets_per_group( 208 net::ClientSocketPoolManager::max_sockets_per_group(
209 net::HttpNetworkSession::NORMAL_SOCKET_POOL))); 209 net::HttpNetworkSession::NORMAL_SOCKET_POOL)));
210 210
211 // Register the shutdown state before anything changes it. 211 // Register the shutdown state before anything changes it.
212 if (local_state_->HasPrefPath(prefs::kLastSessionExitedCleanly)) { 212 if (local_state_->HasPrefPath(prefs::kLastSessionExitedCleanly)) {
213 was_last_shutdown_clean_ = 213 was_last_shutdown_clean_ =
214 local_state_->GetBoolean(prefs::kLastSessionExitedCleanly); 214 local_state_->GetBoolean(prefs::kLastSessionExitedCleanly);
215 } 215 }
216 } 216 }
OLDNEW
« no previous file with comments | « no previous file | ios/chrome/browser/signin/ios_chrome_signin_status_metrics_provider_delegate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698