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 "components/sessions/core/persistent_tab_restore_service.h" | 5 #include "components/sessions/core/persistent_tab_restore_service.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 #include <string.h> | 9 #include <string.h> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 490 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 501 } | 501 } |
| 502 } | 502 } |
| 503 | 503 |
| 504 // static | 504 // static |
| 505 std::unique_ptr<SessionCommand> | 505 std::unique_ptr<SessionCommand> |
| 506 PersistentTabRestoreService::Delegate::CreateWindowCommand( | 506 PersistentTabRestoreService::Delegate::CreateWindowCommand( |
| 507 SessionID::id_type id, | 507 SessionID::id_type id, |
| 508 int selected_tab_index, | 508 int selected_tab_index, |
| 509 int num_tabs, | 509 int num_tabs, |
| 510 base::Time timestamp) { | 510 base::Time timestamp) { |
| 511 WindowPayload2 payload; | 511 WindowPayload2 payload; |
|
sky
2017/05/12 02:42:06
Doesn't this need to be updated?
chrisha
2017/06/28 18:30:42
Indeed it does.
| |
| 512 // |timestamp| is aligned on a 16 byte boundary, leaving 4 bytes of | 512 // |timestamp| is aligned on a 16 byte boundary, leaving 4 bytes of |
| 513 // uninitialized memory in the struct. | 513 // uninitialized memory in the struct. |
| 514 memset(&payload, 0, sizeof(payload)); | 514 memset(&payload, 0, sizeof(payload)); |
| 515 payload.window_id = id; | 515 payload.window_id = id; |
| 516 payload.selected_tab_index = selected_tab_index; | 516 payload.selected_tab_index = selected_tab_index; |
| 517 payload.num_tabs = num_tabs; | 517 payload.num_tabs = num_tabs; |
| 518 payload.timestamp = timestamp.ToInternalValue(); | 518 payload.timestamp = timestamp.ToInternalValue(); |
| 519 | 519 |
| 520 std::unique_ptr<SessionCommand> command( | 520 std::unique_ptr<SessionCommand> command( |
| 521 new SessionCommand(kCommandWindow, sizeof(payload))); | 521 new SessionCommand(kCommandWindow, sizeof(payload))); |
| (...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 826 tab.timestamp = base::Time(); | 826 tab.timestamp = base::Time(); |
| 827 } | 827 } |
| 828 } | 828 } |
| 829 if (window->tabs.empty()) | 829 if (window->tabs.empty()) |
| 830 return false; | 830 return false; |
| 831 | 831 |
| 832 window->selected_tab_index = | 832 window->selected_tab_index = |
| 833 std::min(session_window->selected_tab_index, | 833 std::min(session_window->selected_tab_index, |
| 834 static_cast<int>(window->tabs.size() - 1)); | 834 static_cast<int>(window->tabs.size() - 1)); |
| 835 window->timestamp = base::Time(); | 835 window->timestamp = base::Time(); |
| 836 window->bounds = session_window->bounds; | |
| 837 window->show_state = session_window->show_state; | |
| 838 window->workspace = session_window->workspace; | |
| 836 return true; | 839 return true; |
| 837 } | 840 } |
| 838 | 841 |
| 839 void PersistentTabRestoreService::Delegate::LoadStateChanged() { | 842 void PersistentTabRestoreService::Delegate::LoadStateChanged() { |
| 840 if ((load_state_ & (LOADED_LAST_TABS | LOADED_LAST_SESSION)) != | 843 if ((load_state_ & (LOADED_LAST_TABS | LOADED_LAST_SESSION)) != |
| 841 (LOADED_LAST_TABS | LOADED_LAST_SESSION)) { | 844 (LOADED_LAST_TABS | LOADED_LAST_SESSION)) { |
| 842 // Still waiting on previous session or previous tabs. | 845 // Still waiting on previous session or previous tabs. |
| 843 return; | 846 return; |
| 844 } | 847 } |
| 845 | 848 |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 964 | 967 |
| 965 TabRestoreService::Entries* PersistentTabRestoreService::mutable_entries() { | 968 TabRestoreService::Entries* PersistentTabRestoreService::mutable_entries() { |
| 966 return &helper_.entries_; | 969 return &helper_.entries_; |
| 967 } | 970 } |
| 968 | 971 |
| 969 void PersistentTabRestoreService::PruneEntries() { | 972 void PersistentTabRestoreService::PruneEntries() { |
| 970 helper_.PruneEntries(); | 973 helper_.PruneEntries(); |
| 971 } | 974 } |
| 972 | 975 |
| 973 } // namespace sessions | 976 } // namespace sessions |
| OLD | NEW |