Upstreaming browser/ui/uikit_ui_util from iOS.
[chromium-blink-merge.git] / ios / chrome / browser / geolocation / omnibox_geolocation_local_state.h
blob6060b1309037be9206758aca82a542d0d1ad8733
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
3 // found in the LICENSE file.
5 #ifndef IOS_CHROME_BROWSER_GEOLOCATION_OMNIBOX_GEOLOCATION_LOCAL_STATE_H_
6 #define IOS_CHROME_BROWSER_GEOLOCATION_OMNIBOX_GEOLOCATION_LOCAL_STATE_H_
8 #import <Foundation/Foundation.h>
9 #include <string>
11 namespace geolocation {
13 // These constants indicate whether the user has authorized using geolocation
14 // for Omnibox queries.
15 typedef NS_ENUM(int, AuthorizationState) {
16 // Not yet determined and waiting for the load of the first SRP after N
17 // Omnibox queries before soliciting the user's authorization.
18 kAuthorizationStateNotDeterminedWaiting = 0,
19 // Not yet determined and prompting the user with the iOS system location
20 // authorization alert.
21 kAuthorizationStateNotDeterminedSystemPrompt,
22 // The user explicitly denied using geolocation for Omnibox queries.
23 kAuthorizationStateDenied,
24 // The user has authorized using geolocation for Omnibox queries.
25 kAuthorizationStateAuthorized,
28 } // geolocation
30 @class LocationManager;
31 class PrefRegistrySimple;
33 // Manages local state preferences for using geolocation for Omnibox queries.
34 @interface OmniboxGeolocationLocalState : NSObject
36 // Registers local state preferences.
37 + (void)registerLocalState:(PrefRegistrySimple*)registry;
39 // AuthorizationState value stored in local state that records whether user has
40 // authorized using geolocation for Omnibox queries or the progress towards
41 // soliciting the user's authorization.
42 @property(nonatomic, assign) geolocation::AuthorizationState authorizationState;
44 // String value stored in local state that records the application version when
45 // we last showed the authorization alert.
46 @property(nonatomic, assign) std::string lastAuthorizationAlertVersion;
48 // Designated initializer.
49 - (instancetype)initWithLocationManager:(LocationManager*)locationManager
50 NS_DESIGNATED_INITIALIZER;
52 - (instancetype)init NS_UNAVAILABLE;
54 @end
56 #endif // IOS_CHROME_BROWSER_GEOLOCATION_OMNIBOX_GEOLOCATION_LOCAL_STATE_H_