OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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_CHROMEOS_ARC_ARC_AUTH_SERVICE_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_ARC_ARC_AUTH_SERVICE_H_ |
6 #define CHROME_BROWSER_CHROMEOS_ARC_ARC_AUTH_SERVICE_H_ | 6 #define CHROME_BROWSER_CHROMEOS_ARC_ARC_AUTH_SERVICE_H_ |
7 | 7 |
8 #include <ostream> | 8 #include <ostream> |
9 | 9 |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
11 #include "base/observer_list.h" | 11 #include "base/observer_list.h" |
12 #include "base/threading/thread_checker.h" | 12 #include "base/threading/thread_checker.h" |
13 #include "components/arc/arc_bridge_service.h" | 13 #include "components/arc/arc_bridge_service.h" |
14 #include "components/arc/arc_service.h" | 14 #include "components/arc/arc_service.h" |
15 #include "components/arc/auth/arc_auth_fetcher.h" | 15 #include "components/arc/auth/arc_auth_fetcher.h" |
16 #include "components/arc/common/auth.mojom.h" | 16 #include "components/arc/common/auth.mojom.h" |
| 17 #include "components/prefs/pref_change_registrar.h" |
17 #include "components/syncable_prefs/pref_service_syncable_observer.h" | 18 #include "components/syncable_prefs/pref_service_syncable_observer.h" |
18 #include "components/syncable_prefs/synced_pref_observer.h" | 19 #include "components/syncable_prefs/synced_pref_observer.h" |
19 #include "google_apis/gaia/gaia_auth_consumer.h" | 20 #include "google_apis/gaia/gaia_auth_consumer.h" |
20 #include "google_apis/gaia/ubertoken_fetcher.h" | 21 #include "google_apis/gaia/ubertoken_fetcher.h" |
21 #include "mojo/public/cpp/bindings/binding.h" | 22 #include "mojo/public/cpp/bindings/binding.h" |
22 | 23 |
23 class GaiaAuthFetcher; | 24 class GaiaAuthFetcher; |
24 class Profile; | 25 class Profile; |
25 | 26 |
26 namespace content { | 27 namespace content { |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 void ShutdownBridgeAndShowUI(UIPage page, const base::string16& status); | 164 void ShutdownBridgeAndShowUI(UIPage page, const base::string16& status); |
164 void OnOptInPreferenceChanged(); | 165 void OnOptInPreferenceChanged(); |
165 void FetchAuthCode(); | 166 void FetchAuthCode(); |
166 | 167 |
167 // Unowned pointer. Keeps current profile. | 168 // Unowned pointer. Keeps current profile. |
168 Profile* profile_ = nullptr; | 169 Profile* profile_ = nullptr; |
169 // Owned by content::BrowserContent. Used to isolate cookies for auth server | 170 // Owned by content::BrowserContent. Used to isolate cookies for auth server |
170 // communication and shared with Arc OptIn UI platform app. | 171 // communication and shared with Arc OptIn UI platform app. |
171 content::StoragePartition* storage_partition_ = nullptr; | 172 content::StoragePartition* storage_partition_ = nullptr; |
172 | 173 |
| 174 // Registrar used to monitor ARC enabled state. |
| 175 PrefChangeRegistrar pref_change_registrar_; |
| 176 |
173 mojo::Binding<AuthHost> binding_; | 177 mojo::Binding<AuthHost> binding_; |
174 base::ThreadChecker thread_checker_; | 178 base::ThreadChecker thread_checker_; |
175 State state_ = State::STOPPED; | 179 State state_ = State::STOPPED; |
176 base::ObserverList<Observer> observer_list_; | 180 base::ObserverList<Observer> observer_list_; |
177 scoped_ptr<ArcAuthFetcher> auth_fetcher_; | 181 scoped_ptr<ArcAuthFetcher> auth_fetcher_; |
178 scoped_ptr<GaiaAuthFetcher> merger_fetcher_; | 182 scoped_ptr<GaiaAuthFetcher> merger_fetcher_; |
179 scoped_ptr<UbertokenFetcher> ubertoken_fethcher_; | 183 scoped_ptr<UbertokenFetcher> ubertoken_fethcher_; |
180 std::string auth_code_; | 184 std::string auth_code_; |
181 GetAuthCodeCallback auth_callback_; | 185 GetAuthCodeCallback auth_callback_; |
182 bool initial_opt_in_ = false; | 186 bool initial_opt_in_ = false; |
183 bool context_prepared_ = false; | 187 bool context_prepared_ = false; |
184 UIPage ui_page_ = UIPage::NO_PAGE; | 188 UIPage ui_page_ = UIPage::NO_PAGE; |
185 base::string16 ui_page_status_; | 189 base::string16 ui_page_status_; |
186 | 190 |
187 DISALLOW_COPY_AND_ASSIGN(ArcAuthService); | 191 DISALLOW_COPY_AND_ASSIGN(ArcAuthService); |
188 }; | 192 }; |
189 | 193 |
190 std::ostream& operator<<(std::ostream& os, const ArcAuthService::State& state); | 194 std::ostream& operator<<(std::ostream& os, const ArcAuthService::State& state); |
191 | 195 |
192 } // namespace arc | 196 } // namespace arc |
193 | 197 |
194 #endif // CHROME_BROWSER_CHROMEOS_ARC_ARC_AUTH_SERVICE_H_ | 198 #endif // CHROME_BROWSER_CHROMEOS_ARC_ARC_AUTH_SERVICE_H_ |
OLD | NEW |