Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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_restore.h" | 5 #include "chrome/browser/sessions/session_restore.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <list> | 8 #include <list> |
| 9 #include <set> | 9 #include <set> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 375 | 375 |
| 376 // After the for loop this contains the last TABBED_BROWSER. Is null if no | 376 // After the for loop this contains the last TABBED_BROWSER. Is null if no |
| 377 // tabbed browsers exist. | 377 // tabbed browsers exist. |
| 378 Browser* last_browser = nullptr; | 378 Browser* last_browser = nullptr; |
| 379 bool has_tabbed_browser = false; | 379 bool has_tabbed_browser = false; |
| 380 | 380 |
| 381 // After the for loop, this contains the browser to activate, if one of the | 381 // After the for loop, this contains the browser to activate, if one of the |
| 382 // windows has the same id as specified in active_window_id. | 382 // windows has the same id as specified in active_window_id. |
| 383 Browser* browser_to_activate = nullptr; | 383 Browser* browser_to_activate = nullptr; |
| 384 | 384 |
| 385 // Determine if there is a visible window. | 385 // Determine if there is a visible window, or if the active window exists. |
| 386 // Even if all windows are ui::SHOW_STATE_MINIMIZED, if one of them is the | |
| 387 // active window it will be made visible by the call to | |
| 388 // browser_to_activate->window()->Activate() later on in this method. | |
| 386 bool has_visible_browser = false; | 389 bool has_visible_browser = false; |
| 387 for (std::vector<sessions::SessionWindow*>::iterator i = windows->begin(); | 390 for (std::vector<sessions::SessionWindow*>::iterator i = windows->begin(); |
| 388 i != windows->end(); ++i) { | 391 i != windows->end(); ++i) { |
| 389 if ((*i)->show_state != ui::SHOW_STATE_MINIMIZED) | 392 if ((*i)->show_state != ui::SHOW_STATE_MINIMIZED || |
| 393 (*i)->window_id.id() == active_window_id) | |
|
sky
2015/09/28 14:54:05
How is that the active window is in a minimized st
shrike
2015/09/28 17:53:41
As browser windows become active, SessionService::
sky
2015/09/28 19:04:01
Ok, makes sense.
| |
| 390 has_visible_browser = true; | 394 has_visible_browser = true; |
| 391 } | 395 } |
| 392 | 396 |
| 393 for (std::vector<sessions::SessionWindow*>::iterator i = windows->begin(); | 397 for (std::vector<sessions::SessionWindow*>::iterator i = windows->begin(); |
| 394 i != windows->end(); ++i) { | 398 i != windows->end(); ++i) { |
| 395 Browser* browser = nullptr; | 399 Browser* browser = nullptr; |
| 396 if (!has_tabbed_browser && | 400 if (!has_tabbed_browser && |
| 397 (*i)->type == sessions::SessionWindow::TYPE_TABBED) | 401 (*i)->type == sessions::SessionWindow::TYPE_TABBED) |
| 398 has_tabbed_browser = true; | 402 has_tabbed_browser = true; |
| 399 if (i == windows->begin() && | 403 if (i == windows->begin() && |
| (...skipping 458 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 858 if (prioritize_tabs == "mru") | 862 if (prioritize_tabs == "mru") |
| 859 return SMART_RESTORE_MODE_MRU; | 863 return SMART_RESTORE_MODE_MRU; |
| 860 if (prioritize_tabs == "simple") | 864 if (prioritize_tabs == "simple") |
| 861 return SMART_RESTORE_MODE_SIMPLE; | 865 return SMART_RESTORE_MODE_SIMPLE; |
| 862 return SMART_RESTORE_MODE_OFF; | 866 return SMART_RESTORE_MODE_OFF; |
| 863 } | 867 } |
| 864 | 868 |
| 865 // static | 869 // static |
| 866 base::CallbackList<void(int)>* | 870 base::CallbackList<void(int)>* |
| 867 SessionRestore::on_session_restored_callbacks_ = nullptr; | 871 SessionRestore::on_session_restored_callbacks_ = nullptr; |
| OLD | NEW |