BookmarkManager: Fix 'new folder text field size changes on clicking it' issue.
[chromium-blink-merge.git] / chrome / browser / sync / test / integration / p2p_sync_refresher.cc
blobfe62d3cba1833a897e936d563785bb4c693d8c62
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "chrome/browser/sync/test/integration/p2p_sync_refresher.h"
7 #include "chrome/browser/chrome_notification_types.h"
8 #include "chrome/browser/sync/profile_sync_service.h"
9 #include "chrome/browser/sync/test/integration/sync_datatype_helper.h"
10 #include "chrome/browser/sync/test/integration/sync_test.h"
11 #include "content/public/browser/notification_service.h"
12 #include "sync/internal_api/public/sessions/sync_session_snapshot.h"
14 P2PSyncRefresher::P2PSyncRefresher(ProfileSyncService* sync_service)
15 : sync_service_(sync_service){
16 sync_service_->AddObserver(this);
19 P2PSyncRefresher::~P2PSyncRefresher() {
20 sync_service_->RemoveObserver(this);
23 void P2PSyncRefresher::OnStateChanged() {}
25 void P2PSyncRefresher::OnSyncCycleCompleted() {
26 const syncer::sessions::SyncSessionSnapshot& snap =
27 sync_service_->GetLastSessionSnapshot();
28 bool is_notifiable_commit =
29 (snap.model_neutral_state().num_successful_commits > 0);
30 if (is_notifiable_commit) {
31 syncer::ModelTypeSet model_types =
32 snap.model_neutral_state().commit_request_types;
33 SyncTest* test = sync_datatype_helper::test();
34 for (int i = 0; i < test->num_clients(); ++i) {
35 if (sync_service_->profile() != test->GetProfile(i))
36 test->TriggerSyncForModelTypes(i, model_types);