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