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

Side by Side Diff: components/sessions/core/tab_restore_service.cc

Issue 2200993004: Make TabRestoreService::Entry noncopyable and fix up surrounding code. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@tab-test-cleanup
Patch Set: Get session ID from entries, take tabs' active status directly instead of an index Created 4 years, 4 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
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() = default;
19 : id(next_entry_id++), 19 TabRestoreService::Entry::Entry(Type type) : id(next_entry_id++), type(type) {}
20 type(TAB),
21 from_last_session(false) {}
22 20
23 TabRestoreService::Entry::Entry(Type type) 21 TabRestoreService::Tab::Tab() : Entry(TAB) {}
24 : id(next_entry_id++), 22 TabRestoreService::Tab::~Tab() = default;
25 type(type),
26 from_last_session(false) {}
27 23
28 TabRestoreService::Entry::~Entry() {} 24 TabRestoreService::Window::Window() : Entry(WINDOW) {}
29 25 TabRestoreService::Window::~Window() = default;
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 }
39
40 TabRestoreService::Tab::Tab(const TabRestoreService::Tab& tab)
41 : Entry(tab),
42 navigations(tab.navigations),
43 current_navigation_index(tab.current_navigation_index),
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 }
83 26
84 // TabRestoreService ---------------------------------------------------------- 27 // TabRestoreService ----------------------------------------------------------
85 28
86 TabRestoreService::~TabRestoreService() { 29 TabRestoreService::~TabRestoreService() {
87 } 30 }
88 31
89 // PlatformSpecificTabData 32 // PlatformSpecificTabData
90 // ------------------------------------------------------ 33 // ------------------------------------------------------
91 34
92 PlatformSpecificTabData::~PlatformSpecificTabData() {} 35 PlatformSpecificTabData::~PlatformSpecificTabData() {}
93 36
94 } // namespace sessions 37 } // namespace sessions
OLDNEW
« no previous file with comments | « components/sessions/core/tab_restore_service.h ('k') | components/sessions/core/tab_restore_service_helper.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698