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 #include "components/sessions/core/tab_restore_service.h" | 5 #include "components/sessions/core/tab_restore_service.h" |
6 | 6 |
7 namespace sessions { | 7 namespace sessions { |
8 | 8 |
9 // TimeFactory----------------------------------------------------------------- | 9 // TimeFactory----------------------------------------------------------------- |
10 | 10 |
11 TabRestoreService::TimeFactory::~TimeFactory() {} | 11 TabRestoreService::TimeFactory::~TimeFactory() {} |
12 | 12 |
13 // Entry ---------------------------------------------------------------------- | 13 // Entry ---------------------------------------------------------------------- |
14 | 14 |
15 // ID of the next Entry. | 15 // ID of the next Entry. |
16 static SessionID::id_type next_entry_id = 1; | 16 static SessionID::id_type next_entry_id = 1; |
17 | 17 |
18 TabRestoreService::Entry::Entry() | 18 TabRestoreService::Entry::Entry() : id(next_entry_id++) {} |
19 : id(next_entry_id++), | 19 TabRestoreService::Entry::~Entry() = default; |
20 type(TAB), | |
21 from_last_session(false) {} | |
22 | 20 |
23 TabRestoreService::Entry::Entry(Type type) | 21 TabRestoreService::Tab::Tab() = default; |
24 : id(next_entry_id++), | 22 TabRestoreService::Tab::~Tab() = default; |
25 type(type), | 23 TabRestoreService::Type TabRestoreService::Tab::type() const { |
26 from_last_session(false) {} | 24 return TAB; |
27 | |
28 TabRestoreService::Entry::~Entry() {} | |
29 | |
30 // Tab ------------------------------------------------------------------------ | |
31 | |
32 TabRestoreService::Tab::Tab() | |
33 : Entry(TAB), | |
34 current_navigation_index(-1), | |
35 browser_id(0), | |
36 tabstrip_index(-1), | |
37 pinned(false) { | |
38 } | 25 } |
39 | 26 |
40 TabRestoreService::Tab::Tab(const TabRestoreService::Tab& tab) | 27 TabRestoreService::Window::Window() = default; |
41 : Entry(tab), | 28 TabRestoreService::Window::~Window() = default; |
42 navigations(tab.navigations), | 29 TabRestoreService::Type TabRestoreService::Window::type() const { |
43 current_navigation_index(tab.current_navigation_index), | 30 return WINDOW; |
44 browser_id(tab.browser_id), | |
45 tabstrip_index(tab.tabstrip_index), | |
46 pinned(tab.pinned), | |
47 extension_app_id(tab.extension_app_id), | |
48 user_agent_override(tab.user_agent_override) { | |
49 if (tab.platform_data) | |
50 platform_data = tab.platform_data->Clone(); | |
51 } | |
52 | |
53 TabRestoreService::Tab::~Tab() { | |
54 } | |
55 | |
56 TabRestoreService::Tab& TabRestoreService::Tab::operator=( | |
57 const TabRestoreService::Tab& tab) { | |
58 id = tab.id; | |
59 type = tab.type; | |
60 timestamp = tab.timestamp; | |
61 from_last_session = tab.from_last_session; | |
62 navigations = tab.navigations; | |
63 current_navigation_index = tab.current_navigation_index; | |
64 browser_id = tab.browser_id; | |
65 tabstrip_index = tab.tabstrip_index; | |
66 pinned = tab.pinned; | |
67 extension_app_id = tab.extension_app_id; | |
68 user_agent_override = tab.user_agent_override; | |
69 | |
70 if (tab.platform_data) | |
71 platform_data = tab.platform_data->Clone(); | |
72 | |
73 return *this; | |
74 } | |
75 | |
76 // Window --------------------------------------------------------------------- | |
77 | |
78 TabRestoreService::Window::Window() : Entry(WINDOW), selected_tab_index(-1) { | |
79 } | |
80 | |
81 TabRestoreService::Window::~Window() { | |
82 } | 31 } |
83 | 32 |
84 // TabRestoreService ---------------------------------------------------------- | 33 // TabRestoreService ---------------------------------------------------------- |
85 | 34 |
86 TabRestoreService::~TabRestoreService() { | 35 TabRestoreService::~TabRestoreService() { |
87 } | 36 } |
88 | 37 |
89 // PlatformSpecificTabData | 38 // PlatformSpecificTabData |
90 // ------------------------------------------------------ | 39 // ------------------------------------------------------ |
91 | 40 |
92 PlatformSpecificTabData::~PlatformSpecificTabData() {} | 41 PlatformSpecificTabData::~PlatformSpecificTabData() {} |
93 | 42 |
94 } // namespace sessions | 43 } // namespace sessions |
OLD | NEW |