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

Side by Side Diff: chrome/browser/sync/profile_sync_service.cc

Issue 8511064: GAIA Profile info prototype (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: test Created 9 years, 1 month 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/sync/internal_api/sync_manager.cc ('k') | chrome/browser/sync/signin_manager.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 #include "chrome/browser/sync/profile_sync_service.h" 5 #include "chrome/browser/sync/profile_sync_service.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cstddef> 8 #include <cstddef>
9 #include <map> 9 #include <map>
10 #include <set> 10 #include <set>
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 #include "chrome/common/chrome_switches.h" 54 #include "chrome/common/chrome_switches.h"
55 #include "chrome/common/chrome_version_info.h" 55 #include "chrome/common/chrome_version_info.h"
56 #include "chrome/common/net/gaia/gaia_constants.h" 56 #include "chrome/common/net/gaia/gaia_constants.h"
57 #include "chrome/common/time_format.h" 57 #include "chrome/common/time_format.h"
58 #include "chrome/common/url_constants.h" 58 #include "chrome/common/url_constants.h"
59 #include "content/public/browser/notification_details.h" 59 #include "content/public/browser/notification_details.h"
60 #include "content/public/browser/notification_source.h" 60 #include "content/public/browser/notification_source.h"
61 #include "grit/generated_resources.h" 61 #include "grit/generated_resources.h"
62 #include "net/base/cookie_monster.h" 62 #include "net/base/cookie_monster.h"
63 #include "ui/base/l10n/l10n_util.h" 63 #include "ui/base/l10n/l10n_util.h"
64 #include "chrome/browser/profiles/profile_impl.h"
64 65
65 using browser_sync::ChangeProcessor; 66 using browser_sync::ChangeProcessor;
66 using browser_sync::DataTypeController; 67 using browser_sync::DataTypeController;
67 using browser_sync::DataTypeManager; 68 using browser_sync::DataTypeManager;
68 using browser_sync::JsBackend; 69 using browser_sync::JsBackend;
69 using browser_sync::JsController; 70 using browser_sync::JsController;
70 using browser_sync::JsEventDetails; 71 using browser_sync::JsEventDetails;
71 using browser_sync::JsEventHandler; 72 using browser_sync::JsEventHandler;
72 using browser_sync::SyncBackendHost; 73 using browser_sync::SyncBackendHost;
73 using browser_sync::SyncProtocolError; 74 using browser_sync::SyncProtocolError;
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after
340 } 341 }
341 342
342 void ProfileSyncService::OnSyncConfigureDone( 343 void ProfileSyncService::OnSyncConfigureDone(
343 DataTypeManager::ConfigureResult result) { 344 DataTypeManager::ConfigureResult result) {
344 if (failed_datatypes_handler_.UpdateFailedDatatypes(result)) { 345 if (failed_datatypes_handler_.UpdateFailedDatatypes(result)) {
345 ReconfigureDatatypeManager(); 346 ReconfigureDatatypeManager();
346 } 347 }
347 } 348 }
348 349
349 void ProfileSyncService::StartUp() { 350 void ProfileSyncService::StartUp() {
351 fprintf(stderr, "%s\n", __func__);
350 // Don't start up multiple times. 352 // Don't start up multiple times.
351 if (backend_.get()) { 353 if (backend_.get()) {
352 VLOG(1) << "Skipping bringing up backend host."; 354 VLOG(1) << "Skipping bringing up backend host.";
353 return; 355 return;
354 } 356 }
355 357
356 DCHECK(AreCredentialsAvailable()); 358 DCHECK(AreCredentialsAvailable());
357 359
358 last_synced_time_ = sync_prefs_.GetLastSyncedTime(); 360 last_synced_time_ = sync_prefs_.GetLastSyncedTime();
359 361
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
462 464
463 NotifyObservers(); 465 NotifyObservers();
464 } 466 }
465 467
466 bool ProfileSyncService::HasSyncSetupCompleted() const { 468 bool ProfileSyncService::HasSyncSetupCompleted() const {
467 return sync_prefs_.HasSyncSetupCompleted(); 469 return sync_prefs_.HasSyncSetupCompleted();
468 } 470 }
469 471
470 void ProfileSyncService::SetSyncSetupCompleted() { 472 void ProfileSyncService::SetSyncSetupCompleted() {
471 sync_prefs_.SetSyncSetupCompleted(); 473 sync_prefs_.SetSyncSetupCompleted();
474 if (profile()) {
475 ProfileImpl* profile_impl = static_cast<ProfileImpl*>(profile());
476 profile_impl->UpdateGAIAProfileInfo();
477 }
472 } 478 }
473 479
474 void ProfileSyncService::UpdateLastSyncedTime() { 480 void ProfileSyncService::UpdateLastSyncedTime() {
475 last_synced_time_ = base::Time::Now(); 481 last_synced_time_ = base::Time::Now();
476 sync_prefs_.SetLastSyncedTime(last_synced_time_); 482 sync_prefs_.SetLastSyncedTime(last_synced_time_);
483 fprintf(stderr, "%s\n", __func__);
477 } 484 }
478 485
479 void ProfileSyncService::NotifyObservers() { 486 void ProfileSyncService::NotifyObservers() {
480 FOR_EACH_OBSERVER(Observer, observers_, OnStateChanged()); 487 FOR_EACH_OBSERVER(Observer, observers_, OnStateChanged());
481 // TODO(akalin): Make an Observer subclass that listens and does the 488 // TODO(akalin): Make an Observer subclass that listens and does the
482 // event routing. 489 // event routing.
483 sync_js_controller_.HandleJsEvent( 490 sync_js_controller_.HandleJsEvent(
484 "onServiceStateChanged", JsEventDetails()); 491 "onServiceStateChanged", JsEventDetails());
485 } 492 }
486 493
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
606 // any new session data. TODO(zea): Have this be a notification the session 613 // any new session data. TODO(zea): Have this be a notification the session
607 // model associator listens too. Also consider somehow plumbing the current 614 // model associator listens too. Also consider somehow plumbing the current
608 // server time as last reported by CheckServerReachable, so we don't have to 615 // server time as last reported by CheckServerReachable, so we don't have to
609 // rely on the local clock, which may be off significantly. 616 // rely on the local clock, which may be off significantly.
610 MessageLoop::current()->PostTask(FROM_HERE, 617 MessageLoop::current()->PostTask(FROM_HERE,
611 base::Bind(&browser_sync::SessionModelAssociator::DeleteStaleSessions, 618 base::Bind(&browser_sync::SessionModelAssociator::DeleteStaleSessions,
612 GetSessionModelAssociator()->AsWeakPtr())); 619 GetSessionModelAssociator()->AsWeakPtr()));
613 } 620 }
614 VLOG(2) << "Notifying observers sync cycle completed"; 621 VLOG(2) << "Notifying observers sync cycle completed";
615 NotifyObservers(); 622 NotifyObservers();
623
624 fprintf(stderr, "%s - updating gaia profile info\n", __func__);
625 if (profile()) {
626 ProfileImpl* profile_impl = static_cast<ProfileImpl*>(profile());
627 profile_impl->UpdateGAIAProfileInfo();
628 }
616 } 629 }
617 630
618 // TODO(sync): eventually support removing datatypes too. 631 // TODO(sync): eventually support removing datatypes too.
619 void ProfileSyncService::OnDataTypesChanged( 632 void ProfileSyncService::OnDataTypesChanged(
620 const syncable::ModelTypeSet& to_add) { 633 const syncable::ModelTypeSet& to_add) {
621 // If this is a first time sync for a client, this will be called before 634 // If this is a first time sync for a client, this will be called before
622 // OnBackendInitialized() to ensure the new datatypes are available at sync 635 // OnBackendInitialized() to ensure the new datatypes are available at sync
623 // setup. As a result, the migrator won't exist yet. This is fine because for 636 // setup. As a result, the migrator won't exist yet. This is fine because for
624 // first time sync cases we're only concerned with making the datatype 637 // first time sync cases we're only concerned with making the datatype
625 // available. 638 // available.
(...skipping 917 matching lines...) Expand 10 before | Expand all | Expand 10 after
1543 << "Unrecoverable error."; 1556 << "Unrecoverable error.";
1544 } else { 1557 } else {
1545 VLOG(0) << "ConfigureDataTypeManager not invoked because backend is not " 1558 VLOG(0) << "ConfigureDataTypeManager not invoked because backend is not "
1546 << "initialized"; 1559 << "initialized";
1547 } 1560 }
1548 } 1561 }
1549 1562
1550 const FailedDatatypesHandler& ProfileSyncService::failed_datatypes_handler() { 1563 const FailedDatatypesHandler& ProfileSyncService::failed_datatypes_handler() {
1551 return failed_datatypes_handler_; 1564 return failed_datatypes_handler_;
1552 } 1565 }
OLDNEW
« no previous file with comments | « chrome/browser/sync/internal_api/sync_manager.cc ('k') | chrome/browser/sync/signin_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698