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

Side by Side Diff: ios/chrome/app/main_controller.mm

Issue 2596653003: [ios] Removed CookieStoreIOS::SetCookiePolicy. (Closed)
Patch Set: Created 4 years 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 | « ios/chrome/app/app_delegate.mm ('k') | ios/chrome/app/steps/launch_to_foreground.h » ('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 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 470 matching lines...) Expand 10 before | Expand all | Expand 10 after
481 - (void)changeStorageFromBrowserState:(ios::ChromeBrowserState*)oldState 481 - (void)changeStorageFromBrowserState:(ios::ChromeBrowserState*)oldState
482 toBrowserState:(ios::ChromeBrowserState*)newState; 482 toBrowserState:(ios::ChromeBrowserState*)newState;
483 // Returns the set of the sessions ids of the tabs in the given |tabModel|. 483 // Returns the set of the sessions ids of the tabs in the given |tabModel|.
484 - (NSMutableSet*)liveSessionsForTabModel:(TabModel*)tabModel; 484 - (NSMutableSet*)liveSessionsForTabModel:(TabModel*)tabModel;
485 // Purge the unused snapshots. 485 // Purge the unused snapshots.
486 - (void)purgeSnapshots; 486 - (void)purgeSnapshots;
487 // Sets a LocalState pref marking the TOS EULA as accepted. 487 // Sets a LocalState pref marking the TOS EULA as accepted.
488 - (void)markEulaAsAccepted; 488 - (void)markEulaAsAccepted;
489 // Sends any feedback that happens to still be on local storage. 489 // Sends any feedback that happens to still be on local storage.
490 - (void)sendQueuedFeedback; 490 - (void)sendQueuedFeedback;
491 // Sets the iOS cookie policy to match that of the given browser state.
492 - (void)setInitialCookiesPolicy:(ios::ChromeBrowserState*)browserState;
493 // Called whenever an orientation change is received. 491 // Called whenever an orientation change is received.
494 - (void)orientationDidChange:(NSNotification*)notification; 492 - (void)orientationDidChange:(NSNotification*)notification;
495 // Register to receive orientation change notification to update breakpad 493 // Register to receive orientation change notification to update breakpad
496 // report. 494 // report.
497 - (void)registerForOrientationChangeNotifications; 495 - (void)registerForOrientationChangeNotifications;
498 // Asynchronously creates the pref observers. 496 // Asynchronously creates the pref observers.
499 - (void)schedulePrefObserverInitialization; 497 - (void)schedulePrefObserverInitialization;
500 // Asynchronously schedules a check for what other native iOS apps are currently 498 // Asynchronously schedules a check for what other native iOS apps are currently
501 // installed. 499 // installed.
502 - (void)scheduleCheckNativeApps; 500 - (void)scheduleCheckNativeApps;
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after
783 } 781 }
784 782
785 [self scheduleTasksRequiringBVCWithBrowserState]; 783 [self scheduleTasksRequiringBVCWithBrowserState];
786 784
787 // Now that everything is properly set up, run the tests. 785 // Now that everything is properly set up, run the tests.
788 tests_hook::RunTestsIfPresent(); 786 tests_hook::RunTestsIfPresent();
789 } 787 }
790 788
791 - (void)initializeBrowserState:(ios::ChromeBrowserState*)browserState { 789 - (void)initializeBrowserState:(ios::ChromeBrowserState*)browserState {
792 DCHECK(!browserState->IsOffTheRecord()); 790 DCHECK(!browserState->IsOffTheRecord());
793 [self setInitialCookiesPolicy:browserState];
794 search_engines::UpdateSearchEnginesIfNeeded( 791 search_engines::UpdateSearchEnginesIfNeeded(
795 browserState->GetPrefs(), 792 browserState->GetPrefs(),
796 ios::TemplateURLServiceFactory::GetForBrowserState(browserState)); 793 ios::TemplateURLServiceFactory::GetForBrowserState(browserState));
797 794
798 if ([TouchToSearchPermissionsMediator isTouchToSearchAvailableOnDevice]) { 795 if ([TouchToSearchPermissionsMediator isTouchToSearchAvailableOnDevice]) {
799 base::scoped_nsobject<TouchToSearchPermissionsMediator> 796 base::scoped_nsobject<TouchToSearchPermissionsMediator>
800 touchToSearchPermissions([[TouchToSearchPermissionsMediator alloc] 797 touchToSearchPermissions([[TouchToSearchPermissionsMediator alloc]
801 initWithBrowserState:browserState]); 798 initWithBrowserState:browserState]);
802 if (experimental_flags::IsForceResetContextualSearchEnabled()) { 799 if (experimental_flags::IsForceResetContextualSearchEnabled()) {
803 [touchToSearchPermissions setPreferenceState:TouchToSearch::UNDECIDED]; 800 [touchToSearchPermissions setPreferenceState:TouchToSearch::UNDECIDED];
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after
1039 - (void)sendQueuedFeedback { 1036 - (void)sendQueuedFeedback {
1040 [[DeferredInitializationRunner sharedInstance] 1037 [[DeferredInitializationRunner sharedInstance]
1041 enqueueBlockNamed:kSendQueuedFeedback 1038 enqueueBlockNamed:kSendQueuedFeedback
1042 block:^{ 1039 block:^{
1043 ios::GetChromeBrowserProvider() 1040 ios::GetChromeBrowserProvider()
1044 ->GetUserFeedbackProvider() 1041 ->GetUserFeedbackProvider()
1045 ->Synchronize(); 1042 ->Synchronize();
1046 }]; 1043 }];
1047 } 1044 }
1048 1045
1049 - (void)setInitialCookiesPolicy:(ios::ChromeBrowserState*)browserState {
1050 DCHECK(browserState);
1051 net::CookieStoreIOS::CookiePolicy policy = net::CookieStoreIOS::BLOCK;
1052
1053 auto settingsFactory =
1054 ios::HostContentSettingsMapFactory::GetForBrowserState(browserState);
1055 DCHECK(settingsFactory);
1056 ContentSetting cookieSetting = settingsFactory->GetDefaultContentSetting(
1057 CONTENT_SETTINGS_TYPE_COOKIES, nullptr);
1058
1059 if (!web::IsAcceptCookieControlSupported()) {
1060 // Override the Accept Cookie policy as ALLOW is the only policy
1061 // supported by //web.
1062 policy = net::CookieStoreIOS::ALLOW;
1063 if (cookieSetting == CONTENT_SETTING_BLOCK) {
1064 settingsFactory->SetDefaultContentSetting(CONTENT_SETTINGS_TYPE_COOKIES,
1065 CONTENT_SETTING_ALLOW);
1066 }
1067 } else {
1068 switch (cookieSetting) {
1069 case CONTENT_SETTING_ALLOW:
1070 policy = net::CookieStoreIOS::ALLOW;
1071 break;
1072 case CONTENT_SETTING_BLOCK:
1073 policy = net::CookieStoreIOS::BLOCK;
1074 break;
1075 default:
1076 NOTREACHED() << "Unsupported cookie policy.";
1077 break;
1078 }
1079 }
1080
1081 web::WebThread::PostTask(
1082 web::WebThread::IO, FROM_HERE,
1083 base::Bind(&net::CookieStoreIOS::SetCookiePolicy, policy));
1084 }
1085
1086 - (void)orientationDidChange:(NSNotification*)notification { 1046 - (void)orientationDidChange:(NSNotification*)notification {
1087 breakpad_helper::SetCurrentOrientation( 1047 breakpad_helper::SetCurrentOrientation(
1088 [[UIApplication sharedApplication] statusBarOrientation], 1048 [[UIApplication sharedApplication] statusBarOrientation],
1089 [[UIDevice currentDevice] orientation]); 1049 [[UIDevice currentDevice] orientation]);
1090 } 1050 }
1091 1051
1092 - (void)registerForOrientationChangeNotifications { 1052 - (void)registerForOrientationChangeNotifications {
1093 // Register to both device orientation and UI orientation did change 1053 // Register to both device orientation and UI orientation did change
1094 // notification as these two events may be triggered independantely. 1054 // notification as these two events may be triggered independantely.
1095 [[NSNotificationCenter defaultCenter] 1055 [[NSNotificationCenter defaultCenter]
(...skipping 1652 matching lines...) Expand 10 before | Expand all | Expand 10 after
2748 }; 2708 };
2749 2709
2750 callbackCounter->IncrementCount(); 2710 callbackCounter->IncrementCount();
2751 [self removeBrowsingDataFromBrowserState:_mainBrowserState 2711 [self removeBrowsingDataFromBrowserState:_mainBrowserState
2752 mask:removeAllMask 2712 mask:removeAllMask
2753 timePeriod:browsing_data::ALL_TIME 2713 timePeriod:browsing_data::ALL_TIME
2754 completionHandler:decrementCallbackCounterCount]; 2714 completionHandler:decrementCallbackCounterCount];
2755 } 2715 }
2756 2716
2757 @end 2717 @end
OLDNEW
« no previous file with comments | « ios/chrome/app/app_delegate.mm ('k') | ios/chrome/app/steps/launch_to_foreground.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698