| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_SYNC_PROFILE_SYNC_SERVICE_H_ | 5 #ifndef CHROME_BROWSER_SYNC_PROFILE_SYNC_SERVICE_H_ |
| 6 #define CHROME_BROWSER_SYNC_PROFILE_SYNC_SERVICE_H_ | 6 #define CHROME_BROWSER_SYNC_PROFILE_SYNC_SERVICE_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 #include <map> | 10 #include <map> |
| 11 | 11 |
| 12 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
| 13 #include "base/gtest_prod_util.h" | 13 #include "base/gtest_prod_util.h" |
| 14 #include "base/observer_list.h" | 14 #include "base/observer_list.h" |
| 15 #include "base/scoped_ptr.h" | 15 #include "base/scoped_ptr.h" |
| 16 #include "base/string16.h" |
| 16 #include "base/time.h" | 17 #include "base/time.h" |
| 17 #include "chrome/browser/google_service_auth_error.h" | 18 #include "chrome/browser/google_service_auth_error.h" |
| 18 #include "chrome/browser/pref_member.h" | 19 #include "chrome/browser/pref_member.h" |
| 19 #include "chrome/browser/sync/glue/data_type_controller.h" | 20 #include "chrome/browser/sync/glue/data_type_controller.h" |
| 20 #include "chrome/browser/sync/glue/data_type_manager.h" | 21 #include "chrome/browser/sync/glue/data_type_manager.h" |
| 21 #include "chrome/browser/sync/glue/sync_backend_host.h" | 22 #include "chrome/browser/sync/glue/sync_backend_host.h" |
| 22 #include "chrome/browser/sync/notification_method.h" | 23 #include "chrome/browser/sync/notification_method.h" |
| 23 #include "chrome/browser/sync/profile_sync_service_observer.h" | 24 #include "chrome/browser/sync/profile_sync_service_observer.h" |
| 24 #include "chrome/browser/sync/sync_setup_wizard.h" | 25 #include "chrome/browser/sync/sync_setup_wizard.h" |
| 25 #include "chrome/browser/sync/syncable/model_type.h" | 26 #include "chrome/browser/sync/syncable/model_type.h" |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 178 // to open the dialog to easily ensure only one is ever showing. | 179 // to open the dialog to easily ensure only one is ever showing. |
| 179 bool SetupInProgress() const; | 180 bool SetupInProgress() const; |
| 180 bool WizardIsVisible() const { | 181 bool WizardIsVisible() const { |
| 181 return wizard_.IsVisible(); | 182 return wizard_.IsVisible(); |
| 182 } | 183 } |
| 183 void ShowLoginDialog(gfx::NativeWindow parent_window); | 184 void ShowLoginDialog(gfx::NativeWindow parent_window); |
| 184 | 185 |
| 185 void ShowChooseDataTypes(gfx::NativeWindow parent_window); | 186 void ShowChooseDataTypes(gfx::NativeWindow parent_window); |
| 186 | 187 |
| 187 // Pretty-printed strings for a given StatusSummary. | 188 // Pretty-printed strings for a given StatusSummary. |
| 188 static std::wstring BuildSyncStatusSummaryText( | 189 static std::string BuildSyncStatusSummaryText( |
| 189 const browser_sync::SyncBackendHost::StatusSummary& summary); | 190 const browser_sync::SyncBackendHost::StatusSummary& summary); |
| 190 | 191 |
| 191 // Returns true if the SyncBackendHost has told us it's ready to accept | 192 // Returns true if the SyncBackendHost has told us it's ready to accept |
| 192 // changes. | 193 // changes. |
| 193 // TODO(timsteele): What happens if the bookmark model is loaded, a change | 194 // TODO(timsteele): What happens if the bookmark model is loaded, a change |
| 194 // takes place, and the backend isn't initialized yet? | 195 // takes place, and the backend isn't initialized yet? |
| 195 bool sync_initialized() const { return backend_initialized_; } | 196 bool sync_initialized() const { return backend_initialized_; } |
| 196 bool unrecoverable_error_detected() const { | 197 bool unrecoverable_error_detected() const { |
| 197 return unrecoverable_error_detected_; | 198 return unrecoverable_error_detected_; |
| 198 } | 199 } |
| (...skipping 10 matching lines...) Expand all Loading... |
| 209 } | 210 } |
| 210 | 211 |
| 211 // A timestamp marking the last time the service observed a transition from | 212 // A timestamp marking the last time the service observed a transition from |
| 212 // the SYNCING state to the READY state. Note that this does not reflect the | 213 // the SYNCING state to the READY state. Note that this does not reflect the |
| 213 // last time we polled the server to see if there were any changes; the | 214 // last time we polled the server to see if there were any changes; the |
| 214 // timestamp is only snapped when syncing takes place and we download or | 215 // timestamp is only snapped when syncing takes place and we download or |
| 215 // upload some bookmark entity. | 216 // upload some bookmark entity. |
| 216 const base::Time& last_synced_time() const { return last_synced_time_; } | 217 const base::Time& last_synced_time() const { return last_synced_time_; } |
| 217 | 218 |
| 218 // Returns a user-friendly string form of last synced time (in minutes). | 219 // Returns a user-friendly string form of last synced time (in minutes). |
| 219 std::wstring GetLastSyncedTimeString() const; | 220 string16 GetLastSyncedTimeString() const; |
| 220 | 221 |
| 221 // Returns the authenticated username of the sync user, or empty if none | 222 // Returns the authenticated username of the sync user, or empty if none |
| 222 // exists. It will only exist if the authentication service provider (e.g | 223 // exists. It will only exist if the authentication service provider (e.g |
| 223 // GAIA) has confirmed the username is authentic. | 224 // GAIA) has confirmed the username is authentic. |
| 224 virtual string16 GetAuthenticatedUsername() const; | 225 virtual string16 GetAuthenticatedUsername() const; |
| 225 | 226 |
| 226 const std::string& last_attempted_user_email() const { | 227 const std::string& last_attempted_user_email() const { |
| 227 return last_attempted_user_email_; | 228 return last_attempted_user_email_; |
| 228 } | 229 } |
| 229 | 230 |
| (...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 441 | 442 |
| 442 // This allows us to gracefully handle an ABORTED return code from the | 443 // This allows us to gracefully handle an ABORTED return code from the |
| 443 // DataTypeManager in the event that the server informed us to cease and | 444 // DataTypeManager in the event that the server informed us to cease and |
| 444 // desist syncing immediately. | 445 // desist syncing immediately. |
| 445 bool expect_sync_configuration_aborted_; | 446 bool expect_sync_configuration_aborted_; |
| 446 | 447 |
| 447 DISALLOW_COPY_AND_ASSIGN(ProfileSyncService); | 448 DISALLOW_COPY_AND_ASSIGN(ProfileSyncService); |
| 448 }; | 449 }; |
| 449 | 450 |
| 450 #endif // CHROME_BROWSER_SYNC_PROFILE_SYNC_SERVICE_H_ | 451 #endif // CHROME_BROWSER_SYNC_PROFILE_SYNC_SERVICE_H_ |
| OLD | NEW |