Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "chrome/browser/sessions/session_service_utils.h" | |
| 6 | |
| 7 bool ShouldRestoreWindowOfType(SessionWindow::WindowType window_type, | |
|
sky
2014/10/29 23:14:51
AFAICT the ShouldRestore/RemoveUnusedRestoreWindow
Mr4D (OOO till 08-26)
2014/10/29 23:47:44
Done.
| |
| 8 AppType app_type) { | |
| 9 #if defined(OS_CHROMEOS) | |
| 10 // Restore app popups for ChromeOS alone. | |
| 11 if (window_type == SessionWindow::TYPE_POPUP && app_type == TYPE_APP) | |
| 12 return true; | |
| 13 #endif | |
| 14 | |
| 15 return window_type == SessionWindow::TYPE_TABBED; | |
| 16 } | |
| 17 | |
| 18 void RemoveUnusedRestoreWindows(std::vector<SessionWindow*>* window_list) { | |
| 19 std::vector<SessionWindow*>::iterator i = window_list->begin(); | |
| 20 while (i != window_list->end()) { | |
| 21 SessionWindow* window = *i; | |
| 22 if (!ShouldRestoreWindowOfType(window->type, | |
| 23 window->app_name.empty() ? TYPE_NORMAL : | |
| 24 TYPE_APP)) { | |
| 25 window_list->erase(i); | |
|
sky
2014/10/29 23:14:51
This leaks.
Mr4D (OOO till 08-26)
2014/10/29 23:47:44
Done.
| |
| 26 i = window_list->begin(); | |
| 27 } | |
| 28 } | |
| 29 } | |
| 30 | |
| 31 SessionWindow::WindowType WindowTypeForBrowserType(Browser::Type type) { | |
| 32 switch (type) { | |
| 33 case Browser::TYPE_POPUP: | |
| 34 return SessionWindow::TYPE_POPUP; | |
| 35 case Browser::TYPE_TABBED: | |
| 36 return SessionWindow::TYPE_TABBED; | |
| 37 } | |
| 38 NOTREACHED(); | |
| 39 } | |
| 40 | |
| 41 Browser::Type BrowserTypeForWindowType(SessionWindow::WindowType type) { | |
| 42 switch (type) { | |
| 43 case SessionWindow::TYPE_POPUP: | |
| 44 return Browser::TYPE_POPUP; | |
| 45 case SessionWindow::TYPE_TABBED: | |
| 46 return Browser::TYPE_TABBED; | |
| 47 } | |
| 48 } | |
| OLD | NEW |