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

Side by Side Diff: ios/chrome/browser/ui/sync/sync_util.mm

Issue 2939433002: [ObjC ARC] Converts ios/chrome/browser/ui/sync:sync to ARC. (Closed)
Patch Set: Created 3 years, 6 months 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/browser/ui/sync/sync_error_infobar_delegate.mm ('k') | no next file » | 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/browser/ui/sync/sync_util.h" 5 #import "ios/chrome/browser/ui/sync/sync_util.h"
6 6
7 #include "base/metrics/histogram_macros.h" 7 #include "base/metrics/histogram_macros.h"
8 #include "components/infobars/core/infobar_manager.h" 8 #include "components/infobars/core/infobar_manager.h"
9 #include "components/strings/grit/components_strings.h" 9 #include "components/strings/grit/components_strings.h"
10 #import "ios/chrome/browser/browser_state/chrome_browser_state.h" 10 #import "ios/chrome/browser/browser_state/chrome_browser_state.h"
11 #include "ios/chrome/browser/sync/sync_setup_service.h" 11 #include "ios/chrome/browser/sync/sync_setup_service.h"
12 #include "ios/chrome/browser/sync/sync_setup_service_factory.h" 12 #include "ios/chrome/browser/sync/sync_setup_service_factory.h"
13 #import "ios/chrome/browser/tabs/tab.h" 13 #import "ios/chrome/browser/tabs/tab.h"
14 #import "ios/chrome/browser/ui/commands/generic_chrome_command.h" 14 #import "ios/chrome/browser/ui/commands/generic_chrome_command.h"
15 #include "ios/chrome/browser/ui/commands/ios_command_ids.h" 15 #include "ios/chrome/browser/ui/commands/ios_command_ids.h"
16 #import "ios/chrome/browser/ui/commands/show_signin_command.h" 16 #import "ios/chrome/browser/ui/commands/show_signin_command.h"
17 #include "ios/chrome/browser/ui/sync/sync_error_infobar_delegate.h" 17 #include "ios/chrome/browser/ui/sync/sync_error_infobar_delegate.h"
18 #include "ios/chrome/grit/ios_chromium_strings.h" 18 #include "ios/chrome/grit/ios_chromium_strings.h"
19 #include "ios/chrome/grit/ios_strings.h" 19 #include "ios/chrome/grit/ios_strings.h"
20 #include "ui/base/l10n/l10n_util.h" 20 #include "ui/base/l10n/l10n_util.h"
21 21
22 #if !defined(__has_feature) || !__has_feature(objc_arc)
23 #error "This file requires ARC support."
24 #endif
25
22 namespace { 26 namespace {
23 // Enumerated constants for logging when a sign-in error infobar was shown 27 // Enumerated constants for logging when a sign-in error infobar was shown
24 // to the user. This was added for crbug/265352 to quantify how often this 28 // to the user. This was added for crbug/265352 to quantify how often this
25 // bug shows up in the wild. The logged histogram count should be interpreted 29 // bug shows up in the wild. The logged histogram count should be interpreted
26 // as a ratio of the number of active sync users. 30 // as a ratio of the number of active sync users.
27 enum { 31 enum {
28 SYNC_SIGN_IN_NEEDS_UPDATE = 1, 32 SYNC_SIGN_IN_NEEDS_UPDATE = 1,
29 SYNC_SERVICE_UNAVAILABLE, 33 SYNC_SERVICE_UNAVAILABLE,
30 SYNC_NEEDS_PASSPHRASE, 34 SYNC_NEEDS_PASSPHRASE,
31 SYNC_UNRECOVERABLE_ERROR, 35 SYNC_UNRECOVERABLE_ERROR,
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 106
103 GenericChromeCommand* GetSyncCommandForBrowserState( 107 GenericChromeCommand* GetSyncCommandForBrowserState(
104 ios::ChromeBrowserState* browserState) { 108 ios::ChromeBrowserState* browserState) {
105 SyncSetupService* syncSetupService = 109 SyncSetupService* syncSetupService =
106 SyncSetupServiceFactory::GetForBrowserState(browserState); 110 SyncSetupServiceFactory::GetForBrowserState(browserState);
107 DCHECK(syncSetupService); 111 DCHECK(syncSetupService);
108 SyncSetupService::SyncServiceState syncState = 112 SyncSetupService::SyncServiceState syncState =
109 syncSetupService->GetSyncServiceState(); 113 syncSetupService->GetSyncServiceState();
110 switch (syncState) { 114 switch (syncState) {
111 case SyncSetupService::kSyncServiceSignInNeedsUpdate: 115 case SyncSetupService::kSyncServiceSignInNeedsUpdate:
112 return [[[ShowSigninCommand alloc] 116 return [[ShowSigninCommand alloc]
113 initWithOperation:AUTHENTICATION_OPERATION_REAUTHENTICATE 117 initWithOperation:AUTHENTICATION_OPERATION_REAUTHENTICATE
114 accessPoint:signin_metrics::AccessPoint::ACCESS_POINT_UNKNOWN] 118 accessPoint:signin_metrics::AccessPoint::ACCESS_POINT_UNKNOWN];
115 autorelease];
116 case SyncSetupService::kSyncServiceNeedsPassphrase: 119 case SyncSetupService::kSyncServiceNeedsPassphrase:
117 return [[[GenericChromeCommand alloc] 120 return [[GenericChromeCommand alloc]
118 initWithTag:IDC_SHOW_SYNC_PASSPHRASE_SETTINGS] autorelease]; 121 initWithTag:IDC_SHOW_SYNC_PASSPHRASE_SETTINGS];
119 case SyncSetupService::kSyncServiceCouldNotConnect: 122 case SyncSetupService::kSyncServiceCouldNotConnect:
120 case SyncSetupService::kSyncServiceServiceUnavailable: 123 case SyncSetupService::kSyncServiceServiceUnavailable:
121 case SyncSetupService::kSyncServiceUnrecoverableError: 124 case SyncSetupService::kSyncServiceUnrecoverableError:
122 case SyncSetupService::kNoSyncServiceError: 125 case SyncSetupService::kNoSyncServiceError:
123 return [[[GenericChromeCommand alloc] initWithTag:IDC_SHOW_SYNC_SETTINGS] 126 return [[GenericChromeCommand alloc] initWithTag:IDC_SHOW_SYNC_SETTINGS];
124 autorelease];
125 } 127 }
126 } 128 }
127 129
128 bool displaySyncErrors(ios::ChromeBrowserState* browser_state, Tab* tab) { 130 bool displaySyncErrors(ios::ChromeBrowserState* browser_state, Tab* tab) {
129 // Avoid displaying sync errors on incognito tabs. 131 // Avoid displaying sync errors on incognito tabs.
130 if (browser_state->IsOffTheRecord()) 132 if (browser_state->IsOffTheRecord())
131 return false; 133 return false;
132 134
133 SyncSetupService* syncSetupService = 135 SyncSetupService* syncSetupService =
134 SyncSetupServiceFactory::GetForBrowserState(browser_state); 136 SyncSetupServiceFactory::GetForBrowserState(browser_state);
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 return true; 175 return true;
174 case SyncSetupService::kSyncServiceSignInNeedsUpdate: 176 case SyncSetupService::kSyncServiceSignInNeedsUpdate:
175 case SyncSetupService::kSyncServiceNeedsPassphrase: 177 case SyncSetupService::kSyncServiceNeedsPassphrase:
176 case SyncSetupService::kSyncServiceUnrecoverableError: 178 case SyncSetupService::kSyncServiceUnrecoverableError:
177 return false; 179 return false;
178 } 180 }
179 } 181 }
180 182
181 } // namespace sync 183 } // namespace sync
182 } // namespace ios_internal 184 } // namespace ios_internal
OLDNEW
« no previous file with comments | « ios/chrome/browser/ui/sync/sync_error_infobar_delegate.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698