OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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> |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 static const char kSessionsTag[] = "google_chrome_sessions"; | 46 static const char kSessionsTag[] = "google_chrome_sessions"; |
47 | 47 |
48 // Contains all logic for associating the Chrome sessions model and | 48 // Contains all logic for associating the Chrome sessions model and |
49 // the sync sessions model. | 49 // the sync sessions model. |
50 class SessionModelAssociator | 50 class SessionModelAssociator |
51 : public PerDataTypeAssociatorInterface<TabContents, size_t>, | 51 : public PerDataTypeAssociatorInterface<TabContents, size_t>, |
52 public base::NonThreadSafe { | 52 public base::NonThreadSafe { |
53 public: | 53 public: |
54 // Does not take ownership of sync_service. | 54 // Does not take ownership of sync_service. |
55 explicit SessionModelAssociator(ProfileSyncService* sync_service); | 55 explicit SessionModelAssociator(ProfileSyncService* sync_service); |
| 56 SessionModelAssociator(ProfileSyncService* sync_service, |
| 57 bool setup_for_test); |
56 virtual ~SessionModelAssociator(); | 58 virtual ~SessionModelAssociator(); |
57 | 59 |
58 // The has_nodes out parameter is set to true if the sync model has | 60 // The has_nodes out parameter is set to true if the sync model has |
59 // nodes other than the permanent tagged nodes. The method may | 61 // nodes other than the permanent tagged nodes. The method may |
60 // return false if an error occurred. | 62 // return false if an error occurred. |
61 virtual bool SyncModelHasUserCreatedNodes(bool* has_nodes); | 63 virtual bool SyncModelHasUserCreatedNodes(bool* has_nodes); |
62 | 64 |
63 // AssociatorInterface and PerDataTypeAssociator Interface implementation. | 65 // AssociatorInterface and PerDataTypeAssociator Interface implementation. |
64 virtual void AbortAssociation() { | 66 virtual void AbortAssociation() { |
65 // No implementation needed, this associator runs on the main thread. | 67 // No implementation needed, this associator runs on the main thread. |
(...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
392 TabLinksMap tab_map_; | 394 TabLinksMap tab_map_; |
393 | 395 |
394 ForeignSessionTracker foreign_session_tracker_; | 396 ForeignSessionTracker foreign_session_tracker_; |
395 | 397 |
396 // Weak pointer. | 398 // Weak pointer. |
397 ProfileSyncService* sync_service_; | 399 ProfileSyncService* sync_service_; |
398 | 400 |
399 // Consumer used to obtain the current session. | 401 // Consumer used to obtain the current session. |
400 CancelableRequestConsumer consumer_; | 402 CancelableRequestConsumer consumer_; |
401 | 403 |
| 404 // To avoid certain checks not applicable to tests. |
| 405 bool setup_for_test_; |
| 406 |
402 DISALLOW_COPY_AND_ASSIGN(SessionModelAssociator); | 407 DISALLOW_COPY_AND_ASSIGN(SessionModelAssociator); |
403 }; | 408 }; |
404 | 409 |
405 } // namespace browser_sync | 410 } // namespace browser_sync |
406 | 411 |
407 #endif // CHROME_BROWSER_SYNC_GLUE_SESSION_MODEL_ASSOCIATOR_H_ | 412 #endif // CHROME_BROWSER_SYNC_GLUE_SESSION_MODEL_ASSOCIATOR_H_ |
OLD | NEW |