| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/glue/session_change_processor.h" | 5 #include "chrome/browser/sync/glue/session_change_processor.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 303 ProcessModifiedTabs(modified_tabs); | 303 ProcessModifiedTabs(modified_tabs); |
| 304 } | 304 } |
| 305 | 305 |
| 306 void SessionChangeProcessor::ProcessModifiedTabs( | 306 void SessionChangeProcessor::ProcessModifiedTabs( |
| 307 const std::vector<SyncedTabDelegate*>& modified_tabs) { | 307 const std::vector<SyncedTabDelegate*>& modified_tabs) { |
| 308 // Check if this tab should trigger a session sync refresh. By virtue of | 308 // Check if this tab should trigger a session sync refresh. By virtue of |
| 309 // it being a modified tab, we know the tab is active (so we won't do | 309 // it being a modified tab, we know the tab is active (so we won't do |
| 310 // refreshes just because the refresh page is open in a background tab). | 310 // refreshes just because the refresh page is open in a background tab). |
| 311 if (!modified_tabs.empty()) { | 311 if (!modified_tabs.empty()) { |
| 312 SyncedTabDelegate* tab = modified_tabs.front(); | 312 SyncedTabDelegate* tab = modified_tabs.front(); |
| 313 const content::NavigationEntry* entry = tab->GetActiveEntry(); | 313 const content::NavigationEntry* entry = tab->GetVisibleEntry(); |
| 314 if (!tab->IsBeingDestroyed() && | 314 if (!tab->IsBeingDestroyed() && |
| 315 entry && | 315 entry && |
| 316 entry->GetVirtualURL().is_valid() && | 316 entry->GetVirtualURL().is_valid() && |
| 317 entry->GetVirtualURL().spec() == kNTPOpenTabSyncURL) { | 317 entry->GetVirtualURL().spec() == kNTPOpenTabSyncURL) { |
| 318 DVLOG(1) << "Triggering sync refresh for sessions datatype."; | 318 DVLOG(1) << "Triggering sync refresh for sessions datatype."; |
| 319 const syncer::ModelTypeSet types(syncer::SESSIONS); | 319 const syncer::ModelTypeSet types(syncer::SESSIONS); |
| 320 content::NotificationService::current()->Notify( | 320 content::NotificationService::current()->Notify( |
| 321 chrome::NOTIFICATION_SYNC_REFRESH_LOCAL, | 321 chrome::NOTIFICATION_SYNC_REFRESH_LOCAL, |
| 322 content::Source<Profile>(profile_), | 322 content::Source<Profile>(profile_), |
| 323 content::Details<const syncer::ModelTypeSet>(&types)); | 323 content::Details<const syncer::ModelTypeSet>(&types)); |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 382 ManagedUserService* managed_user_service = | 382 ManagedUserService* managed_user_service = |
| 383 ManagedUserServiceFactory::GetForProfile(profile_); | 383 ManagedUserServiceFactory::GetForProfile(profile_); |
| 384 managed_user_service->AddNavigationBlockedCallback( | 384 managed_user_service->AddNavigationBlockedCallback( |
| 385 base::Bind(&SessionChangeProcessor::OnNavigationBlocked, | 385 base::Bind(&SessionChangeProcessor::OnNavigationBlocked, |
| 386 weak_ptr_factory_.GetWeakPtr())); | 386 weak_ptr_factory_.GetWeakPtr())); |
| 387 } | 387 } |
| 388 #endif | 388 #endif |
| 389 } | 389 } |
| 390 | 390 |
| 391 } // namespace browser_sync | 391 } // namespace browser_sync |
| OLD | NEW |