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

Side by Side Diff: components/sync_sessions/task_tracker.h

Issue 2776633003: Add taskid for navigation, created in session sync (Closed)
Patch Set: Created 3 years, 9 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
OLDNEW
(Empty)
1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef COMPONENTS_SYNC_SESSIONS_TASK_TRACKER_H_
6 #define COMPONENTS_SYNC_SESSIONS_TASK_TRACKER_H_
7
8 #include <stddef.h>
9
10 #include <map>
11 #include <memory>
12 #include <vector>
13
14 #include "base/time/time.h"
15 #include "components/sessions/core/session_id.h"
16 #include "components/sessions/core/session_types.h"
17 #include "components/sync_sessions/synced_tab_delegate.h"
18 #include "ui/base/page_transition_types.h"
19
20 namespace sync_sessions {
21
22 // Tracks tasks of a tab.
Patrick Noland 2017/03/24 20:51:57 Can you expand this comment? It's not currently ex
shenchao 2017/03/25 23:53:13 Done.
23 class TabTasks {
24 public:
25 TabTasks();
26 virtual ~TabTasks();
27
28 // Return task id as a vector of int64_t for |nav_index|-th navigation of the
29 // tab.
30 std::vector<int64_t> GetTaskIdAtNav(int nav_index) const;
Patrick Noland 2017/03/24 20:51:57 AtIndex or at AtNavIndex would be more descriptive
shenchao 2017/03/25 23:53:13 Done.
31
32 int GetNavigationsNum() const { return ids_.size(); }
Patrick Noland 2017/03/24 20:51:57 count or size would be more descriptive than Num
shenchao 2017/03/25 23:53:13 Done.
33
34 // Updates the current task of the tab, given current navigation index of the
35 // tab as |current_nav_index|, and its transition |current_nav_transition|. If
36 // a new task is created, its id is (its parent task id, |new_id|).
37 void UpdateTask(int current_nav_index,
38 ui::PageTransition current_nav_transition,
39 int64_t new_id);
Patrick Noland 2017/03/24 20:51:57 I'm a little confused that new_id is supplied as a
shenchao 2017/03/25 23:53:13 Done. I did that to make test easy but agree it wa
40
41 private:
42 std::vector<int64_t> ids_;
43 int current_task_index_ = -1;
44 };
45
46 // Tracks tasks of current session.
47 class TaskTracker {
48 public:
49 TaskTracker();
50 virtual ~TaskTracker();
51 // Returns a TabTasks pointer, which is owned by this object, for the tab of
52 // given |tab_id|.
53 TabTasks* GetTabTasks(SessionID::id_type tab_id);
54
55 private:
56 std::map<SessionID::id_type, std::unique_ptr<TabTasks>> local_tab_tasks_map_;
57 };
58
59 } // namespace sync_sessions
60
61 #endif // COMPONENTS_SYNC_SESSIONS_TASK_TRACKER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698