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

Side by Side Diff: chrome/browser/sessions/session_service.cc

Issue 14663010: Save and restore State for ShellWindows, including panels (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 7 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) 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 "chrome/browser/sessions/session_service.h" 5 #include "chrome/browser/sessions/session_service.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <set> 8 #include <set>
9 #include <utility> 9 #include <utility>
10 #include <vector> 10 #include <vector>
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 bool pinned_state; 133 bool pinned_state;
134 }; 134 };
135 135
136 // Returns the show state to store to disk based |state|. 136 // Returns the show state to store to disk based |state|.
137 ui::WindowShowState AdjustShowState(ui::WindowShowState state) { 137 ui::WindowShowState AdjustShowState(ui::WindowShowState state) {
138 switch (state) { 138 switch (state) {
139 case ui::SHOW_STATE_NORMAL: 139 case ui::SHOW_STATE_NORMAL:
140 case ui::SHOW_STATE_MINIMIZED: 140 case ui::SHOW_STATE_MINIMIZED:
141 case ui::SHOW_STATE_MAXIMIZED: 141 case ui::SHOW_STATE_MAXIMIZED:
142 case ui::SHOW_STATE_FULLSCREEN: 142 case ui::SHOW_STATE_FULLSCREEN:
143 case ui::SHOW_STATE_DETACHED:
143 return state; 144 return state;
144 145
145 case ui::SHOW_STATE_DEFAULT: 146 case ui::SHOW_STATE_DEFAULT:
146 case ui::SHOW_STATE_INACTIVE: 147 case ui::SHOW_STATE_INACTIVE:
147 case ui::SHOW_STATE_END: 148 case ui::SHOW_STATE_END:
148 return ui::SHOW_STATE_NORMAL; 149 return ui::SHOW_STATE_NORMAL;
149 } 150 }
150 return ui::SHOW_STATE_NORMAL; 151 return ui::SHOW_STATE_NORMAL;
151 } 152 }
152 153
(...skipping 1188 matching lines...) Expand 10 before | Expand all | Expand 10 after
1341 } 1342 }
1342 1343
1343 void SessionService::BuildCommandsForBrowser( 1344 void SessionService::BuildCommandsForBrowser(
1344 Browser* browser, 1345 Browser* browser,
1345 std::vector<SessionCommand*>* commands, 1346 std::vector<SessionCommand*>* commands,
1346 IdToRange* tab_to_available_range, 1347 IdToRange* tab_to_available_range,
1347 std::set<SessionID::id_type>* windows_to_track) { 1348 std::set<SessionID::id_type>* windows_to_track) {
1348 DCHECK(browser && commands); 1349 DCHECK(browser && commands);
1349 DCHECK(browser->session_id().id()); 1350 DCHECK(browser->session_id().id());
1350 1351
1351 ui::WindowShowState show_state = ui::SHOW_STATE_NORMAL;
1352 if (browser->window()->IsMaximized())
1353 show_state = ui::SHOW_STATE_MAXIMIZED;
1354 else if (browser->window()->IsMinimized())
1355 show_state = ui::SHOW_STATE_MINIMIZED;
1356
1357 commands->push_back( 1352 commands->push_back(
1358 CreateSetWindowBoundsCommand(browser->session_id(), 1353 CreateSetWindowBoundsCommand(browser->session_id(),
1359 browser->window()->GetRestoredBounds(), 1354 browser->window()->GetRestoredBounds(),
1360 show_state)); 1355 browser->window()->GetRestoredState()));
1361 1356
1362 commands->push_back(CreateSetWindowTypeCommand( 1357 commands->push_back(CreateSetWindowTypeCommand(
1363 browser->session_id(), WindowTypeForBrowserType(browser->type()))); 1358 browser->session_id(), WindowTypeForBrowserType(browser->type())));
1364 1359
1365 if (!browser->app_name().empty()) { 1360 if (!browser->app_name().empty()) {
1366 commands->push_back(CreateSetWindowAppNameCommand( 1361 commands->push_back(CreateSetWindowAppNameCommand(
1367 kCommandSetWindowAppName, 1362 kCommandSetWindowAppName,
1368 browser->session_id().id(), 1363 browser->session_id().id(),
1369 browser->app_name())); 1364 browser->app_name()));
1370 } 1365 }
(...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after
1761 contents->GetController().GetDefaultSessionStorageNamespace(); 1756 contents->GetController().GetDefaultSessionStorageNamespace();
1762 session_storage_namespace->SetShouldPersist(false); 1757 session_storage_namespace->SetShouldPersist(false);
1763 SessionTabHelper* session_tab_helper = 1758 SessionTabHelper* session_tab_helper =
1764 SessionTabHelper::FromWebContents(contents); 1759 SessionTabHelper::FromWebContents(contents);
1765 TabClosed(session_tab_helper->window_id(), 1760 TabClosed(session_tab_helper->window_id(),
1766 session_tab_helper->session_id(), 1761 session_tab_helper->session_id(),
1767 contents->GetClosedByUserGesture()); 1762 contents->GetClosedByUserGesture());
1768 RecordSessionUpdateHistogramData(content::NOTIFICATION_WEB_CONTENTS_DESTROYED, 1763 RecordSessionUpdateHistogramData(content::NOTIFICATION_WEB_CONTENTS_DESTROYED,
1769 &last_updated_tab_closed_time_); 1764 &last_updated_tab_closed_time_);
1770 } 1765 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/shell_window_geometry_cache_unittest.cc ('k') | chrome/browser/ui/base_window.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698