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

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

Issue 2700523004: Remove docked windows entirely in M59. (Closed)
Patch Set: Rebase Created 3 years, 10 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/session_service_commands.h" 5 #include "components/sessions/core/session_service_commands.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 #include <string.h> 8 #include <string.h>
9 9
10 #include <utility> 10 #include <utility>
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 // Persisted versions of ui::WindowShowState that are written to disk and can 106 // Persisted versions of ui::WindowShowState that are written to disk and can
107 // never change. 107 // never change.
108 enum PersistedWindowShowState { 108 enum PersistedWindowShowState {
109 // SHOW_STATE_DEFAULT (0) never persisted. 109 // SHOW_STATE_DEFAULT (0) never persisted.
110 PERSISTED_SHOW_STATE_NORMAL = 1, 110 PERSISTED_SHOW_STATE_NORMAL = 1,
111 PERSISTED_SHOW_STATE_MINIMIZED = 2, 111 PERSISTED_SHOW_STATE_MINIMIZED = 2,
112 PERSISTED_SHOW_STATE_MAXIMIZED = 3, 112 PERSISTED_SHOW_STATE_MAXIMIZED = 3,
113 // SHOW_STATE_INACTIVE (4) never persisted. 113 // SHOW_STATE_INACTIVE (4) never persisted.
114 PERSISTED_SHOW_STATE_FULLSCREEN = 5, 114 PERSISTED_SHOW_STATE_FULLSCREEN = 5,
115 PERSISTED_SHOW_STATE_DETACHED_DEPRECATED = 6, 115 PERSISTED_SHOW_STATE_DETACHED_DEPRECATED = 6,
116 PERSISTED_SHOW_STATE_DOCKED_DEPRECATED = 7, 116 PERSISTED_SHOW_STATE_END = 6
117 PERSISTED_SHOW_STATE_END = 7
118 }; 117 };
119 118
120 using IdToSessionTab = 119 using IdToSessionTab =
121 std::map<SessionID::id_type, std::unique_ptr<SessionTab>>; 120 std::map<SessionID::id_type, std::unique_ptr<SessionTab>>;
122 using IdToSessionWindow = 121 using IdToSessionWindow =
123 std::map<SessionID::id_type, std::unique_ptr<SessionWindow>>; 122 std::map<SessionID::id_type, std::unique_ptr<SessionWindow>>;
124 123
125 // Assert to ensure PersistedWindowShowState is updated if ui::WindowShowState 124 // Assert to ensure PersistedWindowShowState is updated if ui::WindowShowState
126 // is changed. 125 // is changed.
127 static_assert(ui::SHOW_STATE_END == 126 static_assert(ui::SHOW_STATE_END ==
128 static_cast<ui::WindowShowState>(PERSISTED_SHOW_STATE_END), 127 static_cast<ui::WindowShowState>(PERSISTED_SHOW_STATE_END),
129 "SHOW_STATE_END must equal PERSISTED_SHOW_STATE_END"); 128 "SHOW_STATE_END must equal PERSISTED_SHOW_STATE_END");
130 129
131 // Returns the show state to store to disk based |state|. 130 // Returns the show state to store to disk based |state|.
132 PersistedWindowShowState ShowStateToPersistedShowState( 131 PersistedWindowShowState ShowStateToPersistedShowState(
133 ui::WindowShowState state) { 132 ui::WindowShowState state) {
134 switch (state) { 133 switch (state) {
135 case ui::SHOW_STATE_NORMAL: 134 case ui::SHOW_STATE_NORMAL:
136 return PERSISTED_SHOW_STATE_NORMAL; 135 return PERSISTED_SHOW_STATE_NORMAL;
137 case ui::SHOW_STATE_MINIMIZED: 136 case ui::SHOW_STATE_MINIMIZED:
138 return PERSISTED_SHOW_STATE_MINIMIZED; 137 return PERSISTED_SHOW_STATE_MINIMIZED;
139 case ui::SHOW_STATE_MAXIMIZED: 138 case ui::SHOW_STATE_MAXIMIZED:
140 return PERSISTED_SHOW_STATE_MAXIMIZED; 139 return PERSISTED_SHOW_STATE_MAXIMIZED;
141 case ui::SHOW_STATE_FULLSCREEN: 140 case ui::SHOW_STATE_FULLSCREEN:
142 return PERSISTED_SHOW_STATE_FULLSCREEN; 141 return PERSISTED_SHOW_STATE_FULLSCREEN;
143
144 // TODO(afakhry): Remove Docked Windows in M58.
145 case ui::SHOW_STATE_DOCKED:
146 return PERSISTED_SHOW_STATE_DOCKED_DEPRECATED;
147
148 case ui::SHOW_STATE_DEFAULT: 142 case ui::SHOW_STATE_DEFAULT:
149 case ui::SHOW_STATE_INACTIVE: 143 case ui::SHOW_STATE_INACTIVE:
150 return PERSISTED_SHOW_STATE_NORMAL; 144 return PERSISTED_SHOW_STATE_NORMAL;
151 145
152 case ui::SHOW_STATE_END: 146 case ui::SHOW_STATE_END:
153 break; 147 break;
154 } 148 }
155 NOTREACHED(); 149 NOTREACHED();
156 return PERSISTED_SHOW_STATE_NORMAL; 150 return PERSISTED_SHOW_STATE_NORMAL;
157 } 151 }
158 152
159 // Lints show state values when read back from persited disk. 153 // Lints show state values when read back from persited disk.
160 ui::WindowShowState PersistedShowStateToShowState(int state) { 154 ui::WindowShowState PersistedShowStateToShowState(int state) {
161 switch (state) { 155 switch (state) {
162 case PERSISTED_SHOW_STATE_NORMAL: 156 case PERSISTED_SHOW_STATE_NORMAL:
163 return ui::SHOW_STATE_NORMAL; 157 return ui::SHOW_STATE_NORMAL;
164 case PERSISTED_SHOW_STATE_MINIMIZED: 158 case PERSISTED_SHOW_STATE_MINIMIZED:
165 return ui::SHOW_STATE_MINIMIZED; 159 return ui::SHOW_STATE_MINIMIZED;
166 case PERSISTED_SHOW_STATE_MAXIMIZED: 160 case PERSISTED_SHOW_STATE_MAXIMIZED:
167 return ui::SHOW_STATE_MAXIMIZED; 161 return ui::SHOW_STATE_MAXIMIZED;
168 case PERSISTED_SHOW_STATE_FULLSCREEN: 162 case PERSISTED_SHOW_STATE_FULLSCREEN:
169 return ui::SHOW_STATE_FULLSCREEN; 163 return ui::SHOW_STATE_FULLSCREEN;
170 case PERSISTED_SHOW_STATE_DOCKED_DEPRECATED:
171 return ui::SHOW_STATE_DOCKED;
172 case PERSISTED_SHOW_STATE_DETACHED_DEPRECATED: 164 case PERSISTED_SHOW_STATE_DETACHED_DEPRECATED:
173 return ui::SHOW_STATE_NORMAL; 165 return ui::SHOW_STATE_NORMAL;
174 } 166 }
175 NOTREACHED(); 167 NOTREACHED();
176 return ui::SHOW_STATE_NORMAL; 168 return ui::SHOW_STATE_NORMAL;
177 } 169 }
178 170
179 // Iterates through the vector updating the selected_tab_index of each 171 // Iterates through the vector updating the selected_tab_index of each
180 // SessionWindow based on the actual tabs that were restored. 172 // SessionWindow based on the actual tabs that were restored.
181 void UpdateSelectedTabIndex( 173 void UpdateSelectedTabIndex(
(...skipping 713 matching lines...) Expand 10 before | Expand all | Expand 10 after
895 SortTabsBasedOnVisualOrderAndClear(&windows, valid_windows); 887 SortTabsBasedOnVisualOrderAndClear(&windows, valid_windows);
896 UpdateSelectedTabIndex(valid_windows); 888 UpdateSelectedTabIndex(valid_windows);
897 } 889 }
898 // AddTabsToWindows should have processed all the tabs. 890 // AddTabsToWindows should have processed all the tabs.
899 DCHECK_EQ(0u, tabs.size()); 891 DCHECK_EQ(0u, tabs.size());
900 // SortTabsBasedOnVisualOrderAndClear should have processed all the windows. 892 // SortTabsBasedOnVisualOrderAndClear should have processed all the windows.
901 DCHECK_EQ(0u, windows.size()); 893 DCHECK_EQ(0u, windows.size());
902 } 894 }
903 895
904 } // namespace sessions 896 } // namespace sessions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698