Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(238)

Side by Side Diff: chrome/browser/sync/glue/session_model_associator.h

Issue 7977034: Revert 102184 - [Sync] use base::Time in sync (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/memory/weak_ptr.h" 17 #include "base/memory/weak_ptr.h"
18 #include "base/observer_list.h" 18 #include "base/observer_list.h"
19 #include "base/stringprintf.h" 19 #include "base/stringprintf.h"
20 #include "base/threading/non_thread_safe.h" 20 #include "base/threading/non_thread_safe.h"
21 #include "base/time.h"
22 #include "base/utf_string_conversions.h" 21 #include "base/utf_string_conversions.h"
23 #include "chrome/browser/sessions/session_id.h" 22 #include "chrome/browser/sessions/session_id.h"
24 #include "chrome/browser/sessions/session_service.h" 23 #include "chrome/browser/sessions/session_service.h"
25 #include "chrome/browser/sessions/session_types.h" 24 #include "chrome/browser/sessions/session_types.h"
26 #include "chrome/browser/sync/glue/model_associator.h" 25 #include "chrome/browser/sync/glue/model_associator.h"
27 #include "chrome/browser/sync/glue/synced_session_tracker.h" 26 #include "chrome/browser/sync/glue/synced_session_tracker.h"
28 #include "chrome/browser/sync/glue/synced_tab_delegate.h" 27 #include "chrome/browser/sync/glue/synced_tab_delegate.h"
29 #include "chrome/browser/sync/glue/synced_window_delegate.h" 28 #include "chrome/browser/sync/glue/synced_window_delegate.h"
30 #include "chrome/browser/sync/protocol/session_specifics.pb.h" 29 #include "chrome/browser/sync/protocol/session_specifics.pb.h"
31 #include "chrome/browser/sync/syncable/model_type.h" 30 #include "chrome/browser/sync/syncable/model_type.h"
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 133
135 // Returns the tag used to uniquely identify this machine's session in the 134 // Returns the tag used to uniquely identify this machine's session in the
136 // sync model. 135 // sync model.
137 inline const std::string& GetCurrentMachineTag() { 136 inline const std::string& GetCurrentMachineTag() {
138 DCHECK(!current_machine_tag_.empty()); 137 DCHECK(!current_machine_tag_.empty());
139 return current_machine_tag_; 138 return current_machine_tag_;
140 } 139 }
141 140
142 // Load and associate window and tab data for a foreign session 141 // Load and associate window and tab data for a foreign session
143 bool AssociateForeignSpecifics(const sync_pb::SessionSpecifics& specifics, 142 bool AssociateForeignSpecifics(const sync_pb::SessionSpecifics& specifics,
144 const base::Time& modification_time); 143 int64 modification_time);
145 144
146 // Removes a foreign session from our internal bookkeeping. 145 // Removes a foreign session from our internal bookkeeping.
147 void DisassociateForeignSession(const std::string& foreign_session_tag); 146 void DisassociateForeignSession(const std::string& foreign_session_tag);
148 147
149 // Sets |*local_session| to point to the associator's representation of the 148 // Sets |*local_session| to point to the associator's representation of the
150 // local machine. Used primarily for testing. 149 // local machine. Used primarily for testing.
151 bool GetLocalSession(const SyncedSession* * local_session); 150 bool GetLocalSession(const SyncedSession* * local_session);
152 151
153 // Builds a list of all foreign sessions. 152 // Builds a list of all foreign sessions.
154 // Caller does NOT own ForeignSession objects. 153 // Caller does NOT own ForeignSession objects.
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
369 // provided. 368 // provided.
370 static void PopulateSessionHeaderFromSpecifics( 369 static void PopulateSessionHeaderFromSpecifics(
371 const sync_pb::SessionHeader& header_specifics, 370 const sync_pb::SessionHeader& header_specifics,
372 SyncedSession* session_header); 371 SyncedSession* session_header);
373 372
374 // Used to populate a session window from the session specifics window 373 // Used to populate a session window from the session specifics window
375 // provided. Tracks any foreign session data created through |tracker|. 374 // provided. Tracks any foreign session data created through |tracker|.
376 static void PopulateSessionWindowFromSpecifics( 375 static void PopulateSessionWindowFromSpecifics(
377 const std::string& foreign_session_tag, 376 const std::string& foreign_session_tag,
378 const sync_pb::SessionWindow& window, 377 const sync_pb::SessionWindow& window,
379 const base::Time& mtime, 378 const int64 mtime,
380 SessionWindow* session_window, 379 SessionWindow* session_window,
381 SyncedSessionTracker* tracker); 380 SyncedSessionTracker* tracker);
382 381
383 // Used to populate a session tab from the session specifics tab provided. 382 // Used to populate a session tab from the session specifics tab provided.
384 static void PopulateSessionTabFromSpecifics(const sync_pb::SessionTab& tab, 383 static void PopulateSessionTabFromSpecifics(const sync_pb::SessionTab& tab,
385 const base::Time& mtime, 384 const int64 mtime,
386 SessionTab* session_tab); 385 SessionTab* session_tab);
387 386
388 // Used to populate a session tab from the session specifics tab provided. 387 // Used to populate a session tab from the session specifics tab provided.
389 static void AppendSessionTabNavigation( 388 static void AppendSessionTabNavigation(
390 const sync_pb::TabNavigation& navigation, 389 const sync_pb::TabNavigation& navigation,
391 std::vector<TabNavigation>* navigations); 390 std::vector<TabNavigation>* navigations);
392 391
393 // Populates the navigation portion of the session specifics. 392 // Populates the navigation portion of the session specifics.
394 static void PopulateSessionSpecificsNavigation( 393 static void PopulateSessionSpecificsNavigation(
395 const TabNavigation* navigation, 394 const TabNavigation* navigation,
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
459 // is made. 458 // is made.
460 bool waiting_for_change_; 459 bool waiting_for_change_;
461 ScopedRunnableMethodFactory<SessionModelAssociator> test_method_factory_; 460 ScopedRunnableMethodFactory<SessionModelAssociator> test_method_factory_;
462 461
463 DISALLOW_COPY_AND_ASSIGN(SessionModelAssociator); 462 DISALLOW_COPY_AND_ASSIGN(SessionModelAssociator);
464 }; 463 };
465 464
466 } // namespace browser_sync 465 } // namespace browser_sync
467 466
468 #endif // CHROME_BROWSER_SYNC_GLUE_SESSION_MODEL_ASSOCIATOR_H_ 467 #endif // CHROME_BROWSER_SYNC_GLUE_SESSION_MODEL_ASSOCIATOR_H_
OLDNEW
« no previous file with comments | « chrome/browser/sync/glue/session_change_processor.cc ('k') | chrome/browser/sync/glue/session_model_associator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698