| OLD | NEW |
| 1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2009 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 // AuthWatcher watches authentication events and user open and close | 5 // AuthWatcher watches authentication events and user open and close |
| 6 // events and accordingly opens and closes shares. | 6 // events and accordingly opens and closes shares. |
| 7 | 7 |
| 8 #ifndef CHROME_BROWSER_SYNC_ENGINE_AUTH_WATCHER_H_ | 8 #ifndef CHROME_BROWSER_SYNC_ENGINE_AUTH_WATCHER_H_ |
| 9 #define CHROME_BROWSER_SYNC_ENGINE_AUTH_WATCHER_H_ | 9 #define CHROME_BROWSER_SYNC_ENGINE_AUTH_WATCHER_H_ |
| 10 | 10 |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 const std::string& gaia_url, | 80 const std::string& gaia_url, |
| 81 UserSettings* user_settings, | 81 UserSettings* user_settings, |
| 82 GaiaAuthenticator* gaia_auth, | 82 GaiaAuthenticator* gaia_auth, |
| 83 TalkMediator* talk_mediator); | 83 TalkMediator* talk_mediator); |
| 84 ~AuthWatcher(); | 84 ~AuthWatcher(); |
| 85 | 85 |
| 86 // Returns true if the open share has gotten zero updates from the sync | 86 // Returns true if the open share has gotten zero updates from the sync |
| 87 // server (initial sync complete). | 87 // server (initial sync complete). |
| 88 bool LoadDirectoryListAndOpen(const PathString& login); | 88 bool LoadDirectoryListAndOpen(const PathString& login); |
| 89 | 89 |
| 90 typedef EventChannel<AuthWatcherEvent, PThreadMutex> Channel; | 90 typedef EventChannel<AuthWatcherEvent, Lock> Channel; |
| 91 | 91 |
| 92 inline Channel* channel() const { | 92 inline Channel* channel() const { |
| 93 return channel_.get(); | 93 return channel_.get(); |
| 94 } | 94 } |
| 95 | 95 |
| 96 void Authenticate(const std::string& email, const std::string& password, | 96 void Authenticate(const std::string& email, const std::string& password, |
| 97 const std::string& captcha_token, const std::string& captcha_value, | 97 const std::string& captcha_token, const std::string& captcha_value, |
| 98 bool persist_creds_to_disk); | 98 bool persist_creds_to_disk); |
| 99 | 99 |
| 100 void Authenticate(const std::string& email, const std::string& password, | 100 void Authenticate(const std::string& email, const std::string& password, |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 173 // Member function called by AuthenticationThreadStartRoutine. | 173 // Member function called by AuthenticationThreadStartRoutine. |
| 174 void* AuthenticationThreadMain(struct ThreadParams* arg); | 174 void* AuthenticationThreadMain(struct ThreadParams* arg); |
| 175 | 175 |
| 176 scoped_ptr<GaiaAuthenticator> const gaia_; | 176 scoped_ptr<GaiaAuthenticator> const gaia_; |
| 177 syncable::DirectoryManager* const dirman_; | 177 syncable::DirectoryManager* const dirman_; |
| 178 ServerConnectionManager* const scm_; | 178 ServerConnectionManager* const scm_; |
| 179 scoped_ptr<EventListenerHookup> connmgr_hookup_; | 179 scoped_ptr<EventListenerHookup> connmgr_hookup_; |
| 180 AllStatus* const allstatus_; | 180 AllStatus* const allstatus_; |
| 181 // TODO(chron): It is incorrect to make assignments to AtomicWord. | 181 // TODO(chron): It is incorrect to make assignments to AtomicWord. |
| 182 volatile base::subtle::AtomicWord status_; | 182 volatile base::subtle::AtomicWord status_; |
| 183 UserSettings* user_settings_; | 183 UserSettings* const user_settings_; |
| 184 TalkMediator* talk_mediator_; // Interface to the notifications engine. | 184 TalkMediator* talk_mediator_; // Interface to the notifications engine. |
| 185 scoped_ptr<Channel> channel_; | 185 scoped_ptr<Channel> channel_; |
| 186 | 186 |
| 187 // We store our service token in memory as a workaround to the fact that we | 187 // We store our service token in memory as a workaround to the fact that we |
| 188 // don't persist it when the user unchecks "remember me". | 188 // don't persist it when the user unchecks "remember me". |
| 189 // We also include it on outgoing requests. | 189 // We also include it on outgoing requests. |
| 190 std::string sync_service_token_; | 190 std::string sync_service_token_; |
| 191 | 191 |
| 192 PThreadMutex mutex_; | 192 PThreadMutex mutex_; |
| 193 // All members below are protected by the above mutex | 193 // All members below are protected by the above mutex |
| 194 pthread_t thread_; | 194 pthread_t thread_; |
| 195 bool thread_handle_valid_; | 195 bool thread_handle_valid_; |
| 196 bool authenticating_now_; | 196 bool authenticating_now_; |
| 197 AuthWatcherEvent::AuthenticationTrigger current_attempt_trigger_; | 197 AuthWatcherEvent::AuthenticationTrigger current_attempt_trigger_; |
| 198 DISALLOW_COPY_AND_ASSIGN(AuthWatcher); | 198 DISALLOW_COPY_AND_ASSIGN(AuthWatcher); |
| 199 }; | 199 }; |
| 200 | 200 |
| 201 } // namespace browser_sync | 201 } // namespace browser_sync |
| 202 | 202 |
| 203 #endif // CHROME_BROWSER_SYNC_ENGINE_AUTH_WATCHER_H_ | 203 #endif // CHROME_BROWSER_SYNC_ENGINE_AUTH_WATCHER_H_ |
| OLD | NEW |