OLD | NEW |
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/string_util.h" | 7 #include "base/string_util.h" |
8 #include "chrome/browser/profiles/profile.h" | 8 #include "chrome/browser/profiles/profile.h" |
9 #include "chrome/browser/ui/browser.h" | 9 #include "chrome/browser/ui/browser.h" |
10 #include "content/public/browser/navigation_controller.h" | 10 #include "content/public/browser/navigation_controller.h" |
(...skipping 27 matching lines...) Expand all Loading... |
38 } | 38 } |
39 | 39 |
40 TabNavigation::TabNavigation(const TabNavigation& tab) | 40 TabNavigation::TabNavigation(const TabNavigation& tab) |
41 : virtual_url_(tab.virtual_url_), | 41 : virtual_url_(tab.virtual_url_), |
42 referrer_(tab.referrer_), | 42 referrer_(tab.referrer_), |
43 title_(tab.title_), | 43 title_(tab.title_), |
44 state_(tab.state_), | 44 state_(tab.state_), |
45 transition_(tab.transition_), | 45 transition_(tab.transition_), |
46 type_mask_(tab.type_mask_), | 46 type_mask_(tab.type_mask_), |
47 post_id_(-1), | 47 post_id_(-1), |
48 index_(tab.index_) { | 48 index_(tab.index_), |
| 49 original_request_url_(tab.original_request_url_) { |
49 } | 50 } |
50 | 51 |
51 TabNavigation::~TabNavigation() { | 52 TabNavigation::~TabNavigation() { |
52 } | 53 } |
53 | 54 |
54 TabNavigation& TabNavigation::operator=(const TabNavigation& tab) { | 55 TabNavigation& TabNavigation::operator=(const TabNavigation& tab) { |
55 virtual_url_ = tab.virtual_url_; | 56 virtual_url_ = tab.virtual_url_; |
56 referrer_ = tab.referrer_; | 57 referrer_ = tab.referrer_; |
57 title_ = tab.title_; | 58 title_ = tab.title_; |
58 state_ = tab.state_; | 59 state_ = tab.state_; |
59 transition_ = tab.transition_; | 60 transition_ = tab.transition_; |
60 type_mask_ = tab.type_mask_; | 61 type_mask_ = tab.type_mask_; |
61 post_id_ = tab.post_id_; | 62 post_id_ = tab.post_id_; |
62 index_ = tab.index_; | 63 index_ = tab.index_; |
| 64 original_request_url_ = tab.original_request_url_; |
63 return *this; | 65 return *this; |
64 } | 66 } |
65 | 67 |
66 // static | 68 // static |
67 NavigationEntry* TabNavigation::ToNavigationEntry( | 69 NavigationEntry* TabNavigation::ToNavigationEntry( |
68 int page_id, Profile *profile) const { | 70 int page_id, Profile *profile) const { |
69 NavigationEntry* entry = content::NavigationController::CreateNavigationEntry( | 71 NavigationEntry* entry = content::NavigationController::CreateNavigationEntry( |
70 virtual_url_, | 72 virtual_url_, |
71 referrer_, | 73 referrer_, |
72 // Use a transition type of reload so that we don't incorrectly | 74 // Use a transition type of reload so that we don't incorrectly |
73 // increase the typed count. | 75 // increase the typed count. |
74 content::PAGE_TRANSITION_RELOAD, | 76 content::PAGE_TRANSITION_RELOAD, |
75 false, | 77 false, |
76 // The extra headers are not sync'ed across sessions. | 78 // The extra headers are not sync'ed across sessions. |
77 std::string(), | 79 std::string(), |
78 profile); | 80 profile); |
79 | 81 |
80 entry->SetPageID(page_id); | 82 entry->SetPageID(page_id); |
81 entry->SetTitle(title_); | 83 entry->SetTitle(title_); |
82 entry->SetContentState(state_); | 84 entry->SetContentState(state_); |
83 entry->SetHasPostData(type_mask_ & TabNavigation::HAS_POST_DATA); | 85 entry->SetHasPostData(type_mask_ & TabNavigation::HAS_POST_DATA); |
84 entry->SetPostID(post_id_); | 86 entry->SetPostID(post_id_); |
| 87 entry->SetOriginalRequestURL(original_request_url_); |
85 | 88 |
86 return entry; | 89 return entry; |
87 } | 90 } |
88 | 91 |
89 void TabNavigation::SetFromNavigationEntry(const NavigationEntry& entry) { | 92 void TabNavigation::SetFromNavigationEntry(const NavigationEntry& entry) { |
90 virtual_url_ = entry.GetVirtualURL(); | 93 virtual_url_ = entry.GetVirtualURL(); |
91 referrer_ = entry.GetReferrer(); | 94 referrer_ = entry.GetReferrer(); |
92 title_ = entry.GetTitle(); | 95 title_ = entry.GetTitle(); |
93 state_ = entry.GetContentState(); | 96 state_ = entry.GetContentState(); |
94 transition_ = entry.GetTransitionType(); | 97 transition_ = entry.GetTransitionType(); |
95 type_mask_ = entry.GetHasPostData() ? TabNavigation::HAS_POST_DATA : 0; | 98 type_mask_ = entry.GetHasPostData() ? TabNavigation::HAS_POST_DATA : 0; |
96 post_id_ = entry.GetPostID(); | 99 post_id_ = entry.GetPostID(); |
| 100 original_request_url_ = entry.GetOriginalRequestURL(); |
97 } | 101 } |
98 | 102 |
99 // static | 103 // static |
100 void TabNavigation::CreateNavigationEntriesFromTabNavigations( | 104 void TabNavigation::CreateNavigationEntriesFromTabNavigations( |
101 Profile* profile, | 105 Profile* profile, |
102 const std::vector<TabNavigation>& navigations, | 106 const std::vector<TabNavigation>& navigations, |
103 std::vector<NavigationEntry*>* entries) { | 107 std::vector<NavigationEntry*>* entries) { |
104 int page_id = 0; | 108 int page_id = 0; |
105 for (std::vector<TabNavigation>::const_iterator i = | 109 for (std::vector<TabNavigation>::const_iterator i = |
106 navigations.begin(); i != navigations.end(); ++i, ++page_id) { | 110 navigations.begin(); i != navigations.end(); ++i, ++page_id) { |
(...skipping 17 matching lines...) Expand all Loading... |
124 SessionWindow::SessionWindow() | 128 SessionWindow::SessionWindow() |
125 : selected_tab_index(-1), | 129 : selected_tab_index(-1), |
126 type(Browser::TYPE_TABBED), | 130 type(Browser::TYPE_TABBED), |
127 is_constrained(true), | 131 is_constrained(true), |
128 show_state(ui::SHOW_STATE_DEFAULT) { | 132 show_state(ui::SHOW_STATE_DEFAULT) { |
129 } | 133 } |
130 | 134 |
131 SessionWindow::~SessionWindow() { | 135 SessionWindow::~SessionWindow() { |
132 STLDeleteElements(&tabs); | 136 STLDeleteElements(&tabs); |
133 } | 137 } |
OLD | NEW |