| 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 #ifndef CHROME_BROWSER_SYNC_GLUE_SESSION_MODEL_ASSOCIATOR_H_ | 5 #ifndef CHROME_BROWSER_SYNC_GLUE_SESSION_MODEL_ASSOCIATOR_H_ |
| 6 #define CHROME_BROWSER_SYNC_GLUE_SESSION_MODEL_ASSOCIATOR_H_ | 6 #define CHROME_BROWSER_SYNC_GLUE_SESSION_MODEL_ASSOCIATOR_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <map> | 9 #include <map> |
| 10 #include <string> | 10 #include <string> |
| 11 #include <vector> | 11 #include <vector> |
| 12 | 12 |
| 13 #include "base/basictypes.h" | 13 #include "base/basictypes.h" |
| 14 #include "base/format_macros.h" | 14 #include "base/format_macros.h" |
| 15 #include "base/gtest_prod_util.h" | 15 #include "base/gtest_prod_util.h" |
| 16 #include "base/memory/scoped_vector.h" | 16 #include "base/memory/scoped_vector.h" |
| 17 #include "base/observer_list.h" | 17 #include "base/observer_list.h" |
| 18 #include "base/string_util.h" | 18 #include "base/stringprintf.h" |
| 19 #include "base/threading/non_thread_safe.h" | 19 #include "base/threading/non_thread_safe.h" |
| 20 #include "base/utf_string_conversions.h" | 20 #include "base/utf_string_conversions.h" |
| 21 #include "chrome/browser/sessions/session_id.h" | 21 #include "chrome/browser/sessions/session_id.h" |
| 22 #include "chrome/browser/sessions/session_service.h" | 22 #include "chrome/browser/sessions/session_service.h" |
| 23 #include "chrome/browser/sessions/session_types.h" | 23 #include "chrome/browser/sessions/session_types.h" |
| 24 #include "chrome/browser/sync/engine/syncapi.h" | 24 #include "chrome/browser/sync/engine/syncapi.h" |
| 25 #include "chrome/browser/sync/glue/foreign_session_tracker.h" | 25 #include "chrome/browser/sync/glue/foreign_session_tracker.h" |
| 26 #include "chrome/browser/sync/glue/model_associator.h" | 26 #include "chrome/browser/sync/glue/model_associator.h" |
| 27 #include "chrome/browser/sync/protocol/session_specifics.pb.h" | 27 #include "chrome/browser/sync/protocol/session_specifics.pb.h" |
| 28 #include "chrome/browser/sync/syncable/model_type.h" | 28 #include "chrome/browser/sync/syncable/model_type.h" |
| (...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 300 // SessionTab*'s. | 300 // SessionTab*'s. |
| 301 void DeleteForeignSessions(); | 301 void DeleteForeignSessions(); |
| 302 | 302 |
| 303 // Determine if a window is of a type we're interested in syncing. | 303 // Determine if a window is of a type we're interested in syncing. |
| 304 static bool ShouldSyncWindow(const Browser* browser); | 304 static bool ShouldSyncWindow(const Browser* browser); |
| 305 | 305 |
| 306 // Build a sync tag from tab_node_id. | 306 // Build a sync tag from tab_node_id. |
| 307 static inline std::string TabIdToTag( | 307 static inline std::string TabIdToTag( |
| 308 const std::string machine_tag, | 308 const std::string machine_tag, |
| 309 size_t tab_node_id) { | 309 size_t tab_node_id) { |
| 310 return StringPrintf("%s %"PRIuS"", | 310 return base::StringPrintf("%s %"PRIuS"", machine_tag.c_str(), tab_node_id); |
| 311 machine_tag.c_str(), tab_node_id); | |
| 312 } | 311 } |
| 313 | 312 |
| 314 // Initializes the tag corresponding to this machine. | 313 // Initializes the tag corresponding to this machine. |
| 315 void InitializeCurrentMachineTag(sync_api::WriteTransaction* trans); | 314 void InitializeCurrentMachineTag(sync_api::WriteTransaction* trans); |
| 316 | 315 |
| 317 // Updates the server data based upon the current client session. If no node | 316 // Updates the server data based upon the current client session. If no node |
| 318 // corresponding to this machine exists in the sync model, one is created. | 317 // corresponding to this machine exists in the sync model, one is created. |
| 319 void UpdateSyncModelDataFromClient(); | 318 void UpdateSyncModelDataFromClient(); |
| 320 | 319 |
| 321 // Pulls the current sync model from the sync database and returns true upon | 320 // Pulls the current sync model from the sync database and returns true upon |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 408 | 407 |
| 409 // To avoid certain checks not applicable to tests. | 408 // To avoid certain checks not applicable to tests. |
| 410 bool setup_for_test_; | 409 bool setup_for_test_; |
| 411 | 410 |
| 412 DISALLOW_COPY_AND_ASSIGN(SessionModelAssociator); | 411 DISALLOW_COPY_AND_ASSIGN(SessionModelAssociator); |
| 413 }; | 412 }; |
| 414 | 413 |
| 415 } // namespace browser_sync | 414 } // namespace browser_sync |
| 416 | 415 |
| 417 #endif // CHROME_BROWSER_SYNC_GLUE_SESSION_MODEL_ASSOCIATOR_H_ | 416 #endif // CHROME_BROWSER_SYNC_GLUE_SESSION_MODEL_ASSOCIATOR_H_ |
| OLD | NEW |