| 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/app/main_controller.h" | 5 #import "ios/chrome/app/main_controller.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #import <CoreSpotlight/CoreSpotlight.h> | 10 #import <CoreSpotlight/CoreSpotlight.h> |
| (...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 210 GetApplicationContext()->GetComponentUpdateService(); | 210 GetApplicationContext()->GetComponentUpdateService(); |
| 211 DCHECK(cus); | 211 DCHECK(cus); |
| 212 base::FilePath path; | 212 base::FilePath path; |
| 213 const bool success = PathService::Get(ios::DIR_USER_DATA, &path); | 213 const bool success = PathService::Get(ios::DIR_USER_DATA, &path); |
| 214 DCHECK(success); | 214 DCHECK(success); |
| 215 // CRLSetFetcher attempts to load a CRL set from either the local disk or | 215 // CRLSetFetcher attempts to load a CRL set from either the local disk or |
| 216 // network. | 216 // network. |
| 217 GetApplicationContext()->GetCRLSetFetcher()->StartInitialLoad(cus, path); | 217 GetApplicationContext()->GetCRLSetFetcher()->StartInitialLoad(cus, path); |
| 218 } | 218 } |
| 219 | 219 |
| 220 // Unsynchronizes the cookie store associated to |browserState| on the IO | |
| 221 // thread. | |
| 222 void UnSynchronizeCookieStore(ios::ChromeBrowserState* browserState) { | |
| 223 DCHECK(browserState); | |
| 224 scoped_refptr<net::URLRequestContextGetter> getter = | |
| 225 browserState->GetRequestContext(); | |
| 226 web::WebThread::PostTask( | |
| 227 web::WebThread::IO, FROM_HERE, base::BindBlock(^{ | |
| 228 net::CookieStoreIOS* store = static_cast<net::CookieStoreIOS*>( | |
| 229 getter->GetURLRequestContext()->cookie_store()); | |
| 230 store->UnSynchronize(); | |
| 231 })); | |
| 232 } | |
| 233 | |
| 234 // Returns YES if |url| matches chrome://newtab. | 220 // Returns YES if |url| matches chrome://newtab. |
| 235 BOOL IsURLNtp(const GURL& url) { | 221 BOOL IsURLNtp(const GURL& url) { |
| 236 return UrlHasChromeScheme(url) && url.host() == kChromeUINewTabHost; | 222 return UrlHasChromeScheme(url) && url.host() == kChromeUINewTabHost; |
| 237 } | 223 } |
| 238 | 224 |
| 239 // Used to update the current BVC mode if a new tab is added while the stack | 225 // Used to update the current BVC mode if a new tab is added while the stack |
| 240 // view is being dimissed. This is different than ApplicationMode in that it | 226 // view is being dimissed. This is different than ApplicationMode in that it |
| 241 // can be set to |NONE| when not in use. | 227 // can be set to |NONE| when not in use. |
| 242 enum class StackViewDismissalMode { NONE, NORMAL, INCOGNITO }; | 228 enum class StackViewDismissalMode { NONE, NORMAL, INCOGNITO }; |
| 243 | 229 |
| (...skipping 1495 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1739 | 1725 |
| 1740 // Tell the BVC that was made current that it can use the web. | 1726 // Tell the BVC that was made current that it can use the web. |
| 1741 [self activateCurrentBVC]; | 1727 [self activateCurrentBVC]; |
| 1742 } | 1728 } |
| 1743 | 1729 |
| 1744 #pragma mark - Tab closure handlers | 1730 #pragma mark - Tab closure handlers |
| 1745 | 1731 |
| 1746 - (void)lastIncognitoTabClosed { | 1732 - (void)lastIncognitoTabClosed { |
| 1747 DCHECK(_mainBrowserState->HasOffTheRecordChromeBrowserState()); | 1733 DCHECK(_mainBrowserState->HasOffTheRecordChromeBrowserState()); |
| 1748 [self clearIOSSpecificIncognitoData]; | 1734 [self clearIOSSpecificIncognitoData]; |
| 1749 UnSynchronizeCookieStore( | |
| 1750 _mainBrowserState->GetOffTheRecordChromeBrowserState()); | |
| 1751 | 1735 |
| 1752 // OffTheRecordProfileIOData cannot be deleted before all the requests are | 1736 // OffTheRecordProfileIOData cannot be deleted before all the requests are |
| 1753 // deleted. All of the request trackers associated with the closed OTR tabs | 1737 // deleted. All of the request trackers associated with the closed OTR tabs |
| 1754 // will have posted CancelRequest calls to the IO thread by now; this just | 1738 // will have posted CancelRequest calls to the IO thread by now; this just |
| 1755 // waits for those calls to run before calling |deleteIncognitoBrowserState|. | 1739 // waits for those calls to run before calling |deleteIncognitoBrowserState|. |
| 1756 web::RequestTrackerImpl::RunAfterRequestsCancel(base::BindBlock(^{ | 1740 web::RequestTrackerImpl::RunAfterRequestsCancel(base::BindBlock(^{ |
| 1757 [self deleteIncognitoBrowserState]; | 1741 [self deleteIncognitoBrowserState]; |
| 1758 })); | 1742 })); |
| 1759 | 1743 |
| 1760 // a) The first condition can happen when the last incognito tab is closed | 1744 // a) The first condition can happen when the last incognito tab is closed |
| (...skipping 947 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2708 }; | 2692 }; |
| 2709 | 2693 |
| 2710 callbackCounter->IncrementCount(); | 2694 callbackCounter->IncrementCount(); |
| 2711 [self removeBrowsingDataFromBrowserState:_mainBrowserState | 2695 [self removeBrowsingDataFromBrowserState:_mainBrowserState |
| 2712 mask:removeAllMask | 2696 mask:removeAllMask |
| 2713 timePeriod:browsing_data::ALL_TIME | 2697 timePeriod:browsing_data::ALL_TIME |
| 2714 completionHandler:decrementCallbackCounterCount]; | 2698 completionHandler:decrementCallbackCounterCount]; |
| 2715 } | 2699 } |
| 2716 | 2700 |
| 2717 @end | 2701 @end |
| OLD | NEW |