OLD | NEW |
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/glue/session_model_associator.h" | 5 #include "chrome/browser/sync/glue/session_model_associator.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <set> | 8 #include <set> |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 10 matching lines...) Expand all Loading... |
21 #include "chrome/browser/sync/glue/synced_window_delegate.h" | 21 #include "chrome/browser/sync/glue/synced_window_delegate.h" |
22 #include "chrome/browser/sync/internal_api/read_node.h" | 22 #include "chrome/browser/sync/internal_api/read_node.h" |
23 #include "chrome/browser/sync/internal_api/read_transaction.h" | 23 #include "chrome/browser/sync/internal_api/read_transaction.h" |
24 #include "chrome/browser/sync/internal_api/write_node.h" | 24 #include "chrome/browser/sync/internal_api/write_node.h" |
25 #include "chrome/browser/sync/internal_api/write_transaction.h" | 25 #include "chrome/browser/sync/internal_api/write_transaction.h" |
26 #include "chrome/browser/sync/profile_sync_service.h" | 26 #include "chrome/browser/sync/profile_sync_service.h" |
27 #include "chrome/browser/sync/syncable/syncable.h" | 27 #include "chrome/browser/sync/syncable/syncable.h" |
28 #include "chrome/common/chrome_notification_types.h" | 28 #include "chrome/common/chrome_notification_types.h" |
29 #include "chrome/common/url_constants.h" | 29 #include "chrome/common/url_constants.h" |
30 #include "content/browser/tab_contents/navigation_entry.h" | 30 #include "content/browser/tab_contents/navigation_entry.h" |
31 #include "content/common/notification_service.h" | 31 #include "content/public/browser/notification_service.h" |
32 #include "content/public/browser/notification_details.h" | 32 #include "content/public/browser/notification_details.h" |
33 #if defined(OS_LINUX) | 33 #if defined(OS_LINUX) |
34 #include "base/linux_util.h" | 34 #include "base/linux_util.h" |
35 #elif defined(OS_WIN) | 35 #elif defined(OS_WIN) |
36 #include <windows.h> | 36 #include <windows.h> |
37 #endif | 37 #endif |
38 | 38 |
39 namespace browser_sync { | 39 namespace browser_sync { |
40 | 40 |
41 using syncable::SESSIONS; | 41 using syncable::SESSIONS; |
(...skipping 484 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
526 VLOG(1) << "Disassociating local session " << GetCurrentMachineTag(); | 526 VLOG(1) << "Disassociating local session " << GetCurrentMachineTag(); |
527 synced_session_tracker_.Clear(); | 527 synced_session_tracker_.Clear(); |
528 tab_map_.clear(); | 528 tab_map_.clear(); |
529 tab_pool_.clear(); | 529 tab_pool_.clear(); |
530 local_session_syncid_ = sync_api::kInvalidId; | 530 local_session_syncid_ = sync_api::kInvalidId; |
531 current_machine_tag_ = ""; | 531 current_machine_tag_ = ""; |
532 current_session_name_ = ""; | 532 current_session_name_ = ""; |
533 | 533 |
534 // There is no local model stored with which to disassociate, just notify | 534 // There is no local model stored with which to disassociate, just notify |
535 // foreign session handlers. | 535 // foreign session handlers. |
536 NotificationService::current()->Notify( | 536 content::NotificationService::current()->Notify( |
537 chrome::NOTIFICATION_FOREIGN_SESSION_DISABLED, | 537 chrome::NOTIFICATION_FOREIGN_SESSION_DISABLED, |
538 content::Source<Profile>(sync_service_->profile()), | 538 content::Source<Profile>(sync_service_->profile()), |
539 NotificationService::NoDetails()); | 539 content::NotificationService::NoDetails()); |
540 return true; | 540 return true; |
541 } | 541 } |
542 | 542 |
543 void SessionModelAssociator::InitializeCurrentMachineTag( | 543 void SessionModelAssociator::InitializeCurrentMachineTag( |
544 sync_api::WriteTransaction* trans) { | 544 sync_api::WriteTransaction* trans) { |
545 DCHECK(CalledOnValidThread()); | 545 DCHECK(CalledOnValidThread()); |
546 syncable::Directory* dir = trans->GetWrappedWriteTrans()->directory(); | 546 syncable::Directory* dir = trans->GetWrappedWriteTrans()->directory(); |
547 current_machine_tag_ = "session_sync"; | 547 current_machine_tag_ = "session_sync"; |
548 current_machine_tag_.append(dir->cache_guid()); | 548 current_machine_tag_.append(dir->cache_guid()); |
549 VLOG(1) << "Creating machine tag: " << current_machine_tag_; | 549 VLOG(1) << "Creating machine tag: " << current_machine_tag_; |
(...skipping 734 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1284 char computer_name[MAX_COMPUTERNAME_LENGTH + 1]; | 1284 char computer_name[MAX_COMPUTERNAME_LENGTH + 1]; |
1285 DWORD size = sizeof(computer_name); | 1285 DWORD size = sizeof(computer_name); |
1286 if (GetComputerNameA(computer_name, &size)) { | 1286 if (GetComputerNameA(computer_name, &size)) { |
1287 return computer_name; | 1287 return computer_name; |
1288 } | 1288 } |
1289 return std::string(); | 1289 return std::string(); |
1290 } | 1290 } |
1291 #endif | 1291 #endif |
1292 | 1292 |
1293 } // namespace browser_sync | 1293 } // namespace browser_sync |
OLD | NEW |