Chromium Code Reviews| 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 #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/compiler_specific.h" | 14 #include "base/compiler_specific.h" |
| 15 #include "base/format_macros.h" | 15 #include "base/format_macros.h" |
| 16 #include "base/gtest_prod_util.h" | 16 #include "base/gtest_prod_util.h" |
| 17 #include "base/memory/weak_ptr.h" | 17 #include "base/memory/weak_ptr.h" |
| 18 #include "base/stringprintf.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/time.h" | 20 #include "base/time.h" |
| 21 #include "base/utf_string_conversions.h" | 21 #include "base/utf_string_conversions.h" |
| 22 #include "chrome/browser/sessions/session_id.h" | 22 #include "chrome/browser/sessions/session_id.h" |
| 23 #include "chrome/browser/sessions/session_service.h" | 23 #include "chrome/browser/sessions/session_service.h" |
| 24 #include "chrome/browser/sessions/session_types.h" | 24 #include "chrome/browser/sessions/session_types.h" |
| 25 #include "chrome/browser/sync/glue/model_associator.h" | 25 #include "chrome/browser/sync/glue/model_associator.h" |
| 26 #include "chrome/browser/sync/glue/synced_session_tracker.h" | 26 #include "chrome/browser/sync/glue/synced_session_tracker.h" |
| 27 #include "chrome/browser/sync/glue/synced_tab_delegate.h" | 27 #include "chrome/browser/sync/glue/synced_tab_delegate.h" |
| 28 #include "chrome/browser/sync/glue/synced_window_delegate.h" | 28 #include "chrome/browser/sync/glue/synced_window_delegate.h" |
| 29 #include "chrome/browser/sync/protocol/session_specifics.pb.h" | |
| 29 #include "chrome/browser/sync/syncable/model_type.h" | 30 #include "chrome/browser/sync/syncable/model_type.h" |
| 30 | 31 |
| 31 class Profile; | 32 class Profile; |
| 32 class ProfileSyncService; | 33 class ProfileSyncService; |
| 33 | 34 |
| 34 namespace sync_api { | 35 namespace sync_api { |
| 35 class BaseTransaction; | 36 class BaseTransaction; |
| 36 class ReadNode; | 37 class ReadNode; |
| 37 class WriteTransaction; | 38 class WriteTransaction; |
| 38 } // namespace sync_api | 39 } // namespace sync_api |
| (...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 420 // Returns true if this tab belongs to this profile and belongs to a window, | 421 // Returns true if this tab belongs to this profile and belongs to a window, |
| 421 // false otherwise. | 422 // false otherwise. |
| 422 bool IsValidTab(const SyncedTabDelegate& tab) const; | 423 bool IsValidTab(const SyncedTabDelegate& tab) const; |
| 423 | 424 |
| 424 // Having a valid entry is defined as the url being valid and and having a | 425 // Having a valid entry is defined as the url being valid and and having a |
| 425 // syncable scheme (non chrome:// and file:// url's). In other words, we don't | 426 // syncable scheme (non chrome:// and file:// url's). In other words, we don't |
| 426 // want to sync a tab that is nothing but chrome:// and file:// navigations or | 427 // want to sync a tab that is nothing but chrome:// and file:// navigations or |
| 427 // invalid url's. | 428 // invalid url's. |
| 428 bool TabHasValidEntry(const SyncedTabDelegate& tab) const; | 429 bool TabHasValidEntry(const SyncedTabDelegate& tab) const; |
| 429 | 430 |
| 431 // Returns the type of the device hosting this session. | |
| 432 sync_pb::SessionHeader::DeviceType GetLocalDeviceType(); | |
|
Nicolas Zea
2012/03/14 18:27:14
Does this have to be exposed via header? If so, pe
Yaron
2012/03/14 19:01:01
Done.
| |
| 433 | |
| 430 // For testing only. | 434 // For testing only. |
| 431 void QuitLoopForSubtleTesting(); | 435 void QuitLoopForSubtleTesting(); |
| 432 | 436 |
| 433 // Unique client tag. | 437 // Unique client tag. |
| 434 std::string current_machine_tag_; | 438 std::string current_machine_tag_; |
| 435 | 439 |
| 436 // User-visible machine name. | 440 // User-visible machine name. |
| 437 std::string current_session_name_; | 441 std::string current_session_name_; |
| 438 | 442 |
| 439 // Pool of all used/available sync nodes associated with tabs. | 443 // Pool of all used/available sync nodes associated with tabs. |
| (...skipping 25 matching lines...) Expand all Loading... | |
| 465 | 469 |
| 466 // Profile being synced. | 470 // Profile being synced. |
| 467 const Profile* const profile_; | 471 const Profile* const profile_; |
| 468 | 472 |
| 469 DISALLOW_COPY_AND_ASSIGN(SessionModelAssociator); | 473 DISALLOW_COPY_AND_ASSIGN(SessionModelAssociator); |
| 470 }; | 474 }; |
| 471 | 475 |
| 472 } // namespace browser_sync | 476 } // namespace browser_sync |
| 473 | 477 |
| 474 #endif // CHROME_BROWSER_SYNC_GLUE_SESSION_MODEL_ASSOCIATOR_H_ | 478 #endif // CHROME_BROWSER_SYNC_GLUE_SESSION_MODEL_ASSOCIATOR_H_ |
| OLD | NEW |