| OLD | NEW |
| 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/base_session_service.h" | 5 #include "chrome/browser/sessions/base_session_service.h" |
| 6 | 6 |
| 7 #include "base/pickle.h" | 7 #include "base/pickle.h" |
| 8 #include "base/stl_util-inl.h" | 8 #include "base/stl_util-inl.h" |
| 9 #include "base/thread.h" | 9 #include "base/thread.h" |
| 10 #include "chrome/browser/browser_process.h" | 10 #include "chrome/browser/browser_process.h" |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 // keep the url. | 149 // keep the url. |
| 150 | 150 |
| 151 // Bound the string data (which is variable length) to | 151 // Bound the string data (which is variable length) to |
| 152 // |max_state_size bytes| bytes. | 152 // |max_state_size bytes| bytes. |
| 153 static const SessionCommand::size_type max_state_size = | 153 static const SessionCommand::size_type max_state_size = |
| 154 std::numeric_limits<SessionCommand::size_type>::max() - 1024; | 154 std::numeric_limits<SessionCommand::size_type>::max() - 1024; |
| 155 | 155 |
| 156 int bytes_written = 0; | 156 int bytes_written = 0; |
| 157 | 157 |
| 158 WriteStringToPickle(pickle, &bytes_written, max_state_size, | 158 WriteStringToPickle(pickle, &bytes_written, max_state_size, |
| 159 entry.display_url().spec()); | 159 entry.virtual_url().spec()); |
| 160 | 160 |
| 161 WriteString16ToPickle(pickle, &bytes_written, max_state_size, entry.title()); | 161 WriteString16ToPickle(pickle, &bytes_written, max_state_size, entry.title()); |
| 162 | 162 |
| 163 if (entry.has_post_data()) { | 163 if (entry.has_post_data()) { |
| 164 // Remove the form data, it may contain sensitive information. | 164 // Remove the form data, it may contain sensitive information. |
| 165 WriteStringToPickle(pickle, &bytes_written, max_state_size, | 165 WriteStringToPickle(pickle, &bytes_written, max_state_size, |
| 166 webkit_glue::RemoveFormDataFromHistoryState(entry.content_state())); | 166 webkit_glue::RemoveFormDataFromHistoryState(entry.content_state())); |
| 167 } else { | 167 } else { |
| 168 WriteStringToPickle(pickle, &bytes_written, max_state_size, | 168 WriteStringToPickle(pickle, &bytes_written, max_state_size, |
| 169 entry.content_state()); | 169 entry.content_state()); |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 208 pickle->ReadString(&iterator, &referrer_spec); | 208 pickle->ReadString(&iterator, &referrer_spec); |
| 209 if (!referrer_spec.empty()) | 209 if (!referrer_spec.empty()) |
| 210 navigation->referrer_ = GURL(referrer_spec); | 210 navigation->referrer_ = GURL(referrer_spec); |
| 211 } | 211 } |
| 212 | 212 |
| 213 navigation->url_ = GURL(url_spec); | 213 navigation->url_ = GURL(url_spec); |
| 214 return true; | 214 return true; |
| 215 } | 215 } |
| 216 | 216 |
| 217 bool BaseSessionService::ShouldTrackEntry(const NavigationEntry& entry) { | 217 bool BaseSessionService::ShouldTrackEntry(const NavigationEntry& entry) { |
| 218 return entry.display_url().is_valid(); | 218 return entry.virtual_url().is_valid(); |
| 219 } | 219 } |
| 220 | 220 |
| 221 bool BaseSessionService::ShouldTrackEntry(const TabNavigation& navigation) { | 221 bool BaseSessionService::ShouldTrackEntry(const TabNavigation& navigation) { |
| 222 return navigation.url().is_valid(); | 222 return navigation.url().is_valid(); |
| 223 } | 223 } |
| 224 | 224 |
| 225 BaseSessionService::Handle BaseSessionService::ScheduleGetLastSessionCommands( | 225 BaseSessionService::Handle BaseSessionService::ScheduleGetLastSessionCommands( |
| 226 InternalGetCommandsRequest* request, | 226 InternalGetCommandsRequest* request, |
| 227 CancelableRequestConsumerBase* consumer) { | 227 CancelableRequestConsumerBase* consumer) { |
| 228 scoped_refptr<InternalGetCommandsRequest> request_wrapper(request); | 228 scoped_refptr<InternalGetCommandsRequest> request_wrapper(request); |
| 229 AddRequest(request, consumer); | 229 AddRequest(request, consumer); |
| 230 if (backend_thread()) { | 230 if (backend_thread()) { |
| 231 backend_thread()->message_loop()->PostTask(FROM_HERE, NewRunnableMethod( | 231 backend_thread()->message_loop()->PostTask(FROM_HERE, NewRunnableMethod( |
| 232 backend(), &SessionBackend::ReadLastSessionCommands, request)); | 232 backend(), &SessionBackend::ReadLastSessionCommands, request)); |
| 233 } else { | 233 } else { |
| 234 backend()->ReadLastSessionCommands(request); | 234 backend()->ReadLastSessionCommands(request); |
| 235 } | 235 } |
| 236 return request->handle(); | 236 return request->handle(); |
| 237 } | 237 } |
| OLD | NEW |