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/browser/geolocation/omnibox_geolocation_local_state.mm

Issue 2528003002: [ObjC ARC] Converts ios/chrome/browser/geolocation:geolocation to ARC.Automatically generated ARC… (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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/geolocation/omnibox_geolocation_local_state.h" 5 #import "ios/chrome/browser/geolocation/omnibox_geolocation_local_state.h"
6 6
7 #import <CoreLocation/CoreLocation.h> 7 #import <CoreLocation/CoreLocation.h>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/mac/scoped_nsobject.h" 10 #include "base/mac/scoped_nsobject.h"
11 #include "components/prefs/pref_registry_simple.h" 11 #include "components/prefs/pref_registry_simple.h"
12 #include "components/prefs/pref_service.h" 12 #include "components/prefs/pref_service.h"
13 #include "ios/chrome/browser/application_context.h" 13 #include "ios/chrome/browser/application_context.h"
14 #import "ios/chrome/browser/geolocation/location_manager.h" 14 #import "ios/chrome/browser/geolocation/location_manager.h"
15 #import "ios/chrome/browser/pref_names.h" 15 #import "ios/chrome/browser/pref_names.h"
16 16
17 #if !defined(__has_feature) || !__has_feature(objc_arc)
18 #error "This file requires ARC support."
19 #endif
20
17 @interface OmniboxGeolocationLocalState () { 21 @interface OmniboxGeolocationLocalState () {
18 base::scoped_nsobject<LocationManager> locationManager_; 22 base::scoped_nsobject<LocationManager> locationManager_;
19 } 23 }
20 24
21 - (int)intForPath:(const char*)path; 25 - (int)intForPath:(const char*)path;
22 - (void)setInt:(int)value forPath:(const char*)path; 26 - (void)setInt:(int)value forPath:(const char*)path;
23 - (std::string)stringForPath:(const char*)path; 27 - (std::string)stringForPath:(const char*)path;
24 - (void)setString:(const std::string&)value forPath:(const char*)path; 28 - (void)setString:(const std::string&)value forPath:(const char*)path;
25 29
26 @end 30 @end
27 31
28 @implementation OmniboxGeolocationLocalState 32 @implementation OmniboxGeolocationLocalState
29 33
30 + (void)registerLocalState:(PrefRegistrySimple*)registry { 34 + (void)registerLocalState:(PrefRegistrySimple*)registry {
31 registry->RegisterIntegerPref( 35 registry->RegisterIntegerPref(
32 prefs::kOmniboxGeolocationAuthorizationState, 36 prefs::kOmniboxGeolocationAuthorizationState,
33 geolocation::kAuthorizationStateNotDeterminedWaiting); 37 geolocation::kAuthorizationStateNotDeterminedWaiting);
34 registry->RegisterStringPref( 38 registry->RegisterStringPref(
35 prefs::kOmniboxGeolocationLastAuthorizationAlertVersion, ""); 39 prefs::kOmniboxGeolocationLastAuthorizationAlertVersion, "");
36 } 40 }
37 41
38 - (instancetype)initWithLocationManager:(LocationManager*)locationManager { 42 - (instancetype)initWithLocationManager:(LocationManager*)locationManager {
39 DCHECK(locationManager); 43 DCHECK(locationManager);
40 self = [super init]; 44 self = [super init];
41 if (self) { 45 if (self) {
42 locationManager_.reset([locationManager retain]); 46 locationManager_.reset(locationManager);
43 } 47 }
44 return self; 48 return self;
45 } 49 }
46 50
47 - (instancetype)init { 51 - (instancetype)init {
48 NOTREACHED(); 52 NOTREACHED();
49 return nil; 53 return nil;
50 } 54 }
51 55
52 - (geolocation::AuthorizationState)authorizationState { 56 - (geolocation::AuthorizationState)authorizationState {
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 121
118 - (std::string)stringForPath:(const char*)path { 122 - (std::string)stringForPath:(const char*)path {
119 return GetApplicationContext()->GetLocalState()->GetString(path); 123 return GetApplicationContext()->GetLocalState()->GetString(path);
120 } 124 }
121 125
122 - (void)setString:(const std::string&)value forPath:(const char*)path { 126 - (void)setString:(const std::string&)value forPath:(const char*)path {
123 GetApplicationContext()->GetLocalState()->SetString(path, value); 127 GetApplicationContext()->GetLocalState()->SetString(path, value);
124 } 128 }
125 129
126 @end 130 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698