Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(60)

Side by Side Diff: chrome/browser/sessions/session_types.cc

Issue 672083002: Refactoring of SessionService to get componentized. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixing windows compile problem Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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_types.h" 5 #include "chrome/browser/sessions/session_types.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/stl_util.h" 8 #include "base/stl_util.h"
9 #include "chrome/browser/sessions/session_command.h" 9 #include "chrome/browser/sessions/session_command.h"
10 #include "chrome/browser/ui/browser.h" 10 #include "chrome/browser/ui/browser.h"
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 it = navigations.begin(); it != navigations.end(); ++it) { 52 it = navigations.begin(); it != navigations.end(); ++it) {
53 *sync_data.add_navigation() = it->ToSyncData(); 53 *sync_data.add_navigation() = it->ToSyncData();
54 } 54 }
55 return sync_data; 55 return sync_data;
56 } 56 }
57 57
58 // SessionWindow --------------------------------------------------------------- 58 // SessionWindow ---------------------------------------------------------------
59 59
60 SessionWindow::SessionWindow() 60 SessionWindow::SessionWindow()
61 : selected_tab_index(-1), 61 : selected_tab_index(-1),
62 type(Browser::TYPE_TABBED), 62 type(TYPE_TABBED),
63 is_constrained(true), 63 is_constrained(true),
64 show_state(ui::SHOW_STATE_DEFAULT) { 64 show_state(ui::SHOW_STATE_DEFAULT) {
65 } 65 }
66 66
67 SessionWindow::~SessionWindow() { 67 SessionWindow::~SessionWindow() {
68 STLDeleteElements(&tabs); 68 STLDeleteElements(&tabs);
69 } 69 }
70 70
71 sync_pb::SessionWindow SessionWindow::ToSyncData() const { 71 sync_pb::SessionWindow SessionWindow::ToSyncData() const {
72 sync_pb::SessionWindow sync_data; 72 sync_pb::SessionWindow sync_data;
73 sync_data.set_window_id(window_id.id()); 73 sync_data.set_window_id(window_id.id());
74 sync_data.set_selected_tab_index(selected_tab_index); 74 sync_data.set_selected_tab_index(selected_tab_index);
75 switch (type) { 75 switch (type) {
76 case Browser::TYPE_TABBED: 76 case SessionWindow::TYPE_TABBED:
77 sync_data.set_browser_type( 77 sync_data.set_browser_type(
78 sync_pb::SessionWindow_BrowserType_TYPE_TABBED); 78 sync_pb::SessionWindow_BrowserType_TYPE_TABBED);
79 break; 79 break;
80 case Browser::TYPE_POPUP: 80 case SessionWindow::TYPE_POPUP:
81 sync_data.set_browser_type( 81 sync_data.set_browser_type(
82 sync_pb::SessionWindow_BrowserType_TYPE_POPUP); 82 sync_pb::SessionWindow_BrowserType_TYPE_POPUP);
83 break; 83 break;
84 default: 84 default:
85 NOTREACHED() << "Unhandled browser type."; 85 NOTREACHED() << "Unhandled browser type.";
86 } 86 }
87 87
88 for (size_t i = 0; i < tabs.size(); i++) 88 for (size_t i = 0; i < tabs.size(); i++)
89 sync_data.add_tab(tabs[i]->tab_id.id()); 89 sync_data.add_tab(tabs[i]->tab_id.id());
90 90
91 return sync_data; 91 return sync_data;
92 } 92 }
OLDNEW
« no previous file with comments | « chrome/browser/sessions/session_types.h ('k') | chrome/browser/sync/glue/session_sync_test_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698