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

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

Issue 3340007: Revert "FBTF: Move the TabRestoreService::Observer into its own file." (Closed) Base URL: http://src.chromium.org/git/chromium.git
Patch Set: Created 10 years, 3 months 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
« no previous file with comments | « chrome/browser/sessions/session_types.h ('k') | chrome/browser/sessions/tab_restore_service.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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/string_util.h" 7 #include "base/string_util.h"
8 #include "chrome/browser/browser.h" 8 #include "chrome/browser/browser.h"
9 #include "chrome/browser/tab_contents/navigation_controller.h" 9 #include "chrome/browser/tab_contents/navigation_controller.h"
10 #include "chrome/browser/tab_contents/navigation_entry.h" 10 #include "chrome/browser/tab_contents/navigation_entry.h"
11 11
12 // TabNavigation -------------------------------------------------------------- 12 // TabNavigation --------------------------------------------------------------
13 13
14 TabNavigation::TabNavigation()
15 : transition_(PageTransition::TYPED),
16 type_mask_(0),
17 index_(-1) {
18 }
19
20 TabNavigation::TabNavigation(int index,
21 const GURL& virtual_url,
22 const GURL& referrer,
23 const string16& title,
24 const std::string& state,
25 PageTransition::Type transition)
26 : virtual_url_(virtual_url),
27 referrer_(referrer),
28 title_(title),
29 state_(state),
30 transition_(transition),
31 type_mask_(0),
32 index_(index) {
33 }
34
35 TabNavigation::TabNavigation(const TabNavigation& tab)
36 : virtual_url_(tab.virtual_url_),
37 referrer_(tab.referrer_),
38 title_(tab.title_),
39 state_(tab.state_),
40 transition_(tab.transition_),
41 type_mask_(tab.type_mask_),
42 index_(tab.index_) {
43 }
44
45 TabNavigation::~TabNavigation() {
46 }
47
48 TabNavigation& TabNavigation::operator=(const TabNavigation& tab) {
49 virtual_url_ = tab.virtual_url_;
50 referrer_ = tab.referrer_;
51 title_ = tab.title_;
52 state_ = tab.state_;
53 transition_ = tab.transition_;
54 type_mask_ = tab.type_mask_;
55 index_ = tab.index_;
56 return *this;
57 }
58
59 // static 14 // static
60 NavigationEntry* TabNavigation::ToNavigationEntry(int page_id, 15 NavigationEntry* TabNavigation::ToNavigationEntry(int page_id,
61 Profile *profile) const { 16 Profile *profile) const {
62 NavigationEntry* entry = NavigationController::CreateNavigationEntry( 17 NavigationEntry* entry = NavigationController::CreateNavigationEntry(
63 virtual_url_, 18 virtual_url_,
64 referrer_, 19 referrer_,
65 // Use a transition type of reload so that we don't incorrectly 20 // Use a transition type of reload so that we don't incorrectly
66 // increase the typed count. 21 // increase the typed count.
67 PageTransition::RELOAD, 22 PageTransition::RELOAD,
68 profile); 23 profile);
69 24
70 entry->set_page_id(page_id); 25 entry->set_page_id(page_id);
71 entry->set_title(title_); 26 entry->set_title(title_);
72 entry->set_content_state(state_); 27 entry->set_content_state(state_);
73 entry->set_has_post_data(type_mask_ & TabNavigation::HAS_POST_DATA); 28 entry->set_has_post_data(type_mask_ & TabNavigation::HAS_POST_DATA);
74 29
75 return entry; 30 return entry;
76 } 31 }
77 32
78 void TabNavigation::SetFromNavigationEntry(const NavigationEntry& entry) { 33 void TabNavigation::SetFromNavigationEntry(const NavigationEntry& entry) {
79 virtual_url_ = entry.virtual_url(); 34 virtual_url_ = entry.virtual_url();
80 referrer_ = entry.referrer(); 35 referrer_ = entry.referrer();
81 title_ = entry.title(); 36 title_ = entry.title();
82 state_ = entry.content_state(); 37 state_ = entry.content_state();
83 transition_ = entry.transition_type(); 38 transition_ = entry.transition_type();
84 type_mask_ = entry.has_post_data() ? TabNavigation::HAS_POST_DATA : 0; 39 type_mask_ = entry.has_post_data() ? TabNavigation::HAS_POST_DATA : 0;
85 } 40 }
86 41
87 // SessionTab -----------------------------------------------------------------
88
89 SessionTab::SessionTab()
90 : tab_visual_index(-1),
91 current_navigation_index(-1),
92 pinned(false) {
93 }
94
95 SessionTab::~SessionTab() {
96 }
97
98 // SessionWindow --------------------------------------------------------------- 42 // SessionWindow ---------------------------------------------------------------
99 43
100 SessionWindow::SessionWindow() 44 SessionWindow::SessionWindow()
101 : selected_tab_index(-1), 45 : selected_tab_index(-1),
102 type(Browser::TYPE_NORMAL), 46 type(Browser::TYPE_NORMAL),
103 is_constrained(true), 47 is_constrained(true),
104 is_maximized(false) { 48 is_maximized(false) {
105 } 49 }
106 50
107 SessionWindow::~SessionWindow() { 51 SessionWindow::~SessionWindow() {
108 STLDeleteElements(&tabs); 52 STLDeleteElements(&tabs);
109 } 53 }
110 54
111 // ForeignSession -------------------------------------------------------------- 55 // ForeignSession --------------------------------------------------------------
112 56
113 ForeignSession::ForeignSession() : foreign_tession_tag("invalid") { 57 ForeignSession::ForeignSession() : foreign_tession_tag("invalid") {
114 } 58 }
115 59
116 ForeignSession::~ForeignSession() { 60 ForeignSession::~ForeignSession() {
117 STLDeleteElements(&windows); 61 STLDeleteElements(&windows);
118 } 62 }
119 63
OLDNEW
« no previous file with comments | « chrome/browser/sessions/session_types.h ('k') | chrome/browser/sessions/tab_restore_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698