| 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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 : selected_tab_index(-1), |
| 69 type(TYPE_TABBED), | 69 type(TYPE_TABBED), |
| 70 is_constrained(true), | 70 is_constrained(true), |
| 71 show_state(ui::SHOW_STATE_DEFAULT) { | 71 show_state(ui::SHOW_STATE_DEFAULT) {} |
| 72 } | |
| 73 | 72 |
| 74 SessionWindow::~SessionWindow() { | 73 SessionWindow::~SessionWindow() { |
| 75 STLDeleteElements(&tabs); | 74 STLDeleteElements(&tabs); |
| 76 } | 75 } |
| 77 | 76 |
| 78 sync_pb::SessionWindow SessionWindow::ToSyncData() const { | 77 sync_pb::SessionWindow SessionWindow::ToSyncData() const { |
| 79 sync_pb::SessionWindow sync_data; | 78 sync_pb::SessionWindow sync_data; |
| 80 sync_data.set_window_id(window_id.id()); | 79 sync_data.set_window_id(window_id.id()); |
| 81 sync_data.set_selected_tab_index(selected_tab_index); | 80 sync_data.set_selected_tab_index(selected_tab_index); |
| 82 switch (type) { | 81 switch (type) { |
| 83 case SessionWindow::TYPE_TABBED: | 82 case SessionWindow::TYPE_TABBED: |
| 84 sync_data.set_browser_type( | 83 sync_data.set_browser_type( |
| 85 sync_pb::SessionWindow_BrowserType_TYPE_TABBED); | 84 sync_pb::SessionWindow_BrowserType_TYPE_TABBED); |
| 86 break; | 85 break; |
| 87 case SessionWindow::TYPE_POPUP: | 86 case SessionWindow::TYPE_POPUP: |
| 88 sync_data.set_browser_type( | 87 sync_data.set_browser_type( |
| 89 sync_pb::SessionWindow_BrowserType_TYPE_POPUP); | 88 sync_pb::SessionWindow_BrowserType_TYPE_POPUP); |
| 90 break; | 89 break; |
| 91 default: | 90 default: |
| 92 NOTREACHED() << "Unhandled browser type."; | 91 NOTREACHED() << "Unhandled browser type."; |
| 93 } | 92 } |
| 94 | 93 |
| 95 for (size_t i = 0; i < tabs.size(); i++) | 94 for (size_t i = 0; i < tabs.size(); i++) |
| 96 sync_data.add_tab(tabs[i]->tab_id.id()); | 95 sync_data.add_tab(tabs[i]->tab_id.id()); |
| 97 | 96 |
| 98 return sync_data; | 97 return sync_data; |
| 99 } | 98 } |
| 100 | 99 |
| 101 } // namespace sessions | 100 } // namespace sessions |
| OLD | NEW |