| 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/session_types.h" | 5 #include "components/sessions/core/session_types.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "base/stl_util.h" | 9 #include "base/stl_util.h" |
| 10 #include "components/sessions/core/session_command.h" | 10 #include "components/sessions/core/session_command.h" |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 } | 58 } |
| 59 for (const variations::VariationID variation_id : variation_ids) { | 59 for (const variations::VariationID variation_id : variation_ids) { |
| 60 sync_data.add_variation_id(variation_id); | 60 sync_data.add_variation_id(variation_id); |
| 61 } | 61 } |
| 62 return sync_data; | 62 return sync_data; |
| 63 } | 63 } |
| 64 | 64 |
| 65 // SessionWindow --------------------------------------------------------------- | 65 // SessionWindow --------------------------------------------------------------- |
| 66 | 66 |
| 67 SessionWindow::SessionWindow() | 67 SessionWindow::SessionWindow() |
| 68 : selected_tab_index(-1), | 68 : workspace_id(-1), |
| 69 selected_tab_index(-1), |
| 69 type(TYPE_TABBED), | 70 type(TYPE_TABBED), |
| 70 is_constrained(true), | 71 is_constrained(true), |
| 71 show_state(ui::SHOW_STATE_DEFAULT) { | 72 show_state(ui::SHOW_STATE_DEFAULT) {} |
| 72 } | |
| 73 | 73 |
| 74 SessionWindow::~SessionWindow() { | 74 SessionWindow::~SessionWindow() { |
| 75 STLDeleteElements(&tabs); | 75 STLDeleteElements(&tabs); |
| 76 } | 76 } |
| 77 | 77 |
| 78 sync_pb::SessionWindow SessionWindow::ToSyncData() const { | 78 sync_pb::SessionWindow SessionWindow::ToSyncData() const { |
| 79 sync_pb::SessionWindow sync_data; | 79 sync_pb::SessionWindow sync_data; |
| 80 sync_data.set_window_id(window_id.id()); | 80 sync_data.set_window_id(window_id.id()); |
| 81 sync_data.set_selected_tab_index(selected_tab_index); | 81 sync_data.set_selected_tab_index(selected_tab_index); |
| 82 switch (type) { | 82 switch (type) { |
| 83 case SessionWindow::TYPE_TABBED: | 83 case SessionWindow::TYPE_TABBED: |
| 84 sync_data.set_browser_type( | 84 sync_data.set_browser_type( |
| 85 sync_pb::SessionWindow_BrowserType_TYPE_TABBED); | 85 sync_pb::SessionWindow_BrowserType_TYPE_TABBED); |
| 86 break; | 86 break; |
| 87 case SessionWindow::TYPE_POPUP: | 87 case SessionWindow::TYPE_POPUP: |
| 88 sync_data.set_browser_type( | 88 sync_data.set_browser_type( |
| 89 sync_pb::SessionWindow_BrowserType_TYPE_POPUP); | 89 sync_pb::SessionWindow_BrowserType_TYPE_POPUP); |
| 90 break; | 90 break; |
| 91 default: | 91 default: |
| 92 NOTREACHED() << "Unhandled browser type."; | 92 NOTREACHED() << "Unhandled browser type."; |
| 93 } | 93 } |
| 94 | 94 |
| 95 for (size_t i = 0; i < tabs.size(); i++) | 95 for (size_t i = 0; i < tabs.size(); i++) |
| 96 sync_data.add_tab(tabs[i]->tab_id.id()); | 96 sync_data.add_tab(tabs[i]->tab_id.id()); |
| 97 | 97 |
| 98 return sync_data; | 98 return sync_data; |
| 99 } | 99 } |
| 100 | 100 |
| 101 } // namespace sessions | 101 } // namespace sessions |
| OLD | NEW |