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

Side by Side Diff: chrome/browser/android/search_geolocation/search_geolocation_service.h

Issue 2633103002: Add a unittest for SearchGeolocationService (Closed)
Patch Set: Add a unittest for SearchGeolocationService Created 3 years, 11 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
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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 #ifndef CHROME_BROWSER_ANDROID_SEARCH_GEOLOCATION_SEARCH_GEOLOCATION_SERVICE_H_ 5 #ifndef CHROME_BROWSER_ANDROID_SEARCH_GEOLOCATION_SEARCH_GEOLOCATION_SERVICE_H_
6 #define CHROME_BROWSER_ANDROID_SEARCH_GEOLOCATION_SEARCH_GEOLOCATION_SERVICE_H_ 6 #define CHROME_BROWSER_ANDROID_SEARCH_GEOLOCATION_SEARCH_GEOLOCATION_SERVICE_H_
7 7
8 #include "base/callback_forward.h" 8 #include "base/callback_forward.h"
9 #include "base/memory/singleton.h" 9 #include "base/memory/singleton.h"
10 #include "components/content_settings/core/common/content_settings.h" 10 #include "components/content_settings/core/common/content_settings.h"
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 private: 59 private:
60 friend struct base::DefaultSingletonTraits<Factory>; 60 friend struct base::DefaultSingletonTraits<Factory>;
61 61
62 Factory(); 62 Factory();
63 ~Factory() override; 63 ~Factory() override;
64 64
65 // BrowserContextKeyedServiceFactory 65 // BrowserContextKeyedServiceFactory
66 bool ServiceIsCreatedWithBrowserContext() const override; 66 bool ServiceIsCreatedWithBrowserContext() const override;
67 KeyedService* BuildServiceInstanceFor( 67 KeyedService* BuildServiceInstanceFor(
68 content::BrowserContext* profile) const override; 68 content::BrowserContext* profile) const override;
69 void RegisterProfilePrefs(
70 user_prefs::PrefRegistrySyncable* registry) override;
69 }; 71 };
70 72
71 static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry);
72
73 explicit SearchGeolocationService(Profile* profile); 73 explicit SearchGeolocationService(Profile* profile);
74 74
75 // Returns whether the DSE geolocation setting is applicable for geolocation 75 // Returns whether the DSE geolocation setting is applicable for geolocation
76 // requests for the given top level origin. 76 // requests for the given top level origin.
77 bool UseDSEGeolocationSetting(const url::Origin& requesting_origin); 77 bool UseDSEGeolocationSetting(const url::Origin& requesting_origin);
78 78
79 // Returns the DSE geolocation setting, after applying any updates needed to 79 // Returns the DSE geolocation setting, after applying any updates needed to
80 // make it valid. 80 // make it valid.
81 bool GetDSEGeolocationSetting(); 81 bool GetDSEGeolocationSetting();
82 82
83 // Changes the DSE geolocation setting. 83 // Changes the DSE geolocation setting.
84 void SetDSEGeolocationSetting(bool setting); 84 void SetDSEGeolocationSetting(bool setting);
85 85
86 // KeyedService: 86 // KeyedService:
87 void Shutdown() override; 87 void Shutdown() override;
88 88
89 private: 89 private:
90 friend class SearchGeolocationServiceTest;
90 struct PrefValue; 91 struct PrefValue;
91 92
92 ~SearchGeolocationService() override; 93 ~SearchGeolocationService() override;
93 94
94 // When the DSE CCTLD changes (either by changing their DSE or by changing 95 // When the DSE CCTLD changes (either by changing their DSE or by changing
95 // their CCTLD, and their DSE supports geolocation: 96 // their CCTLD, and their DSE supports geolocation:
96 // * If the DSE CCTLD origin permission is BLOCK, but the DSE geolocation 97 // * If the DSE CCTLD origin permission is BLOCK, but the DSE geolocation
97 // setting is on, change the DSE geolocation setting to off 98 // setting is on, change the DSE geolocation setting to off
98 // * If the DSE CCTLD origin permission is ALLOW, but the DSE geolocation 99 // * If the DSE CCTLD origin permission is ALLOW, but the DSE geolocation
99 // setting is off, reset the DSE CCTLD origin permission to ASK. 100 // setting is off, reset the DSE CCTLD origin permission to ASK.
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 void SetSearchEngineDelegateForTest( 144 void SetSearchEngineDelegateForTest(
144 std::unique_ptr<SearchEngineDelegate> delegate); 145 std::unique_ptr<SearchEngineDelegate> delegate);
145 146
146 Profile* profile_; 147 Profile* profile_;
147 PrefService* pref_service_; 148 PrefService* pref_service_;
148 HostContentSettingsMap* host_content_settings_map_; 149 HostContentSettingsMap* host_content_settings_map_;
149 std::unique_ptr<SearchEngineDelegate> delegate_; 150 std::unique_ptr<SearchEngineDelegate> delegate_;
150 }; 151 };
151 152
152 #endif // CHROME_BROWSER_ANDROID_SEARCH_GEOLOCATION_SEARCH_GEOLOCATION_SERVICE_ H_ 153 #endif // CHROME_BROWSER_ANDROID_SEARCH_GEOLOCATION_SEARCH_GEOLOCATION_SERVICE_ H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698