Chromium Code Reviews| 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/base_session_service.h" | 5 #include "chrome/browser/sessions/base_session_service.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/pickle.h" | 9 #include "base/pickle.h" |
| 10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 180 | 180 |
| 181 pickle.WriteInt(entry.GetTransitionType()); | 181 pickle.WriteInt(entry.GetTransitionType()); |
| 182 int type_mask = entry.GetHasPostData() ? TabNavigation::HAS_POST_DATA : 0; | 182 int type_mask = entry.GetHasPostData() ? TabNavigation::HAS_POST_DATA : 0; |
| 183 pickle.WriteInt(type_mask); | 183 pickle.WriteInt(type_mask); |
| 184 | 184 |
| 185 WriteStringToPickle(pickle, &bytes_written, max_state_size, | 185 WriteStringToPickle(pickle, &bytes_written, max_state_size, |
| 186 entry.GetReferrer().url.is_valid() ? | 186 entry.GetReferrer().url.is_valid() ? |
| 187 entry.GetReferrer().url.spec() : std::string()); | 187 entry.GetReferrer().url.spec() : std::string()); |
| 188 pickle.WriteInt(entry.GetReferrer().policy); | 188 pickle.WriteInt(entry.GetReferrer().policy); |
| 189 | 189 |
| 190 WriteStringToPickle(pickle, &bytes_written, max_state_size, | |
| 191 entry.GetOriginalRequestURL().is_valid() ? | |
| 192 entry.GetOriginalRequestURL().spec() : std::string()); | |
| 193 | |
| 190 // Adding more data? Be sure and update TabRestoreService too. | 194 // Adding more data? Be sure and update TabRestoreService too. |
|
Charlie Reis
2012/04/10 01:37:28
Do we need to update TabRestoreService?
gone
2012/04/10 17:41:34
I'm fairly certain that that code path snakes all
Charlie Reis
2012/04/11 20:31:01
Yeah, I can't figure out what this comment is refe
sky
2012/04/11 21:20:26
I copied that comment when promoting code from Ses
gone
2012/04/12 18:13:35
Removed.
| |
| 191 return new SessionCommand(command_id, pickle); | 195 return new SessionCommand(command_id, pickle); |
| 192 } | 196 } |
| 193 | 197 |
| 194 SessionCommand* BaseSessionService::CreateSetTabExtensionAppIDCommand( | 198 SessionCommand* BaseSessionService::CreateSetTabExtensionAppIDCommand( |
| 195 SessionID::id_type command_id, | 199 SessionID::id_type command_id, |
| 196 SessionID::id_type tab_id, | 200 SessionID::id_type tab_id, |
| 197 const std::string& extension_id) { | 201 const std::string& extension_id) { |
| 198 // Use pickle to handle marshalling. | 202 // Use pickle to handle marshalling. |
| 199 Pickle pickle; | 203 Pickle pickle; |
| 200 pickle.WriteInt(tab_id); | 204 pickle.WriteInt(tab_id); |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 259 // the default policy if the property is not present. | 263 // the default policy if the property is not present. |
| 260 int policy_int; | 264 int policy_int; |
| 261 WebReferrerPolicy policy; | 265 WebReferrerPolicy policy; |
| 262 if (pickle->ReadInt(&iterator, &policy_int)) | 266 if (pickle->ReadInt(&iterator, &policy_int)) |
| 263 policy = static_cast<WebReferrerPolicy>(policy_int); | 267 policy = static_cast<WebReferrerPolicy>(policy_int); |
| 264 else | 268 else |
| 265 policy = WebKit::WebReferrerPolicyDefault; | 269 policy = WebKit::WebReferrerPolicyDefault; |
| 266 navigation->referrer_ = content::Referrer( | 270 navigation->referrer_ = content::Referrer( |
| 267 referrer_spec.empty() ? GURL() : GURL(referrer_spec), | 271 referrer_spec.empty() ? GURL() : GURL(referrer_spec), |
| 268 policy); | 272 policy); |
| 273 | |
| 274 // If the original URL can't be found, leave it empty. | |
| 275 std::string url_spec; | |
| 276 if (!pickle->ReadString(&iterator, &url_spec)) | |
| 277 url_spec = ""; | |
|
sky
2012/04/11 21:20:26
= std::string()
gone
2012/04/12 18:13:35
Done.
| |
| 278 navigation->set_original_request_url(GURL(url_spec)); | |
| 269 } | 279 } |
| 270 | 280 |
| 271 navigation->virtual_url_ = GURL(url_spec); | 281 navigation->virtual_url_ = GURL(url_spec); |
| 272 return true; | 282 return true; |
| 273 } | 283 } |
| 274 | 284 |
| 275 bool BaseSessionService::RestoreSetTabExtensionAppIDCommand( | 285 bool BaseSessionService::RestoreSetTabExtensionAppIDCommand( |
| 276 const SessionCommand& command, | 286 const SessionCommand& command, |
| 277 SessionID::id_type* tab_id, | 287 SessionID::id_type* tab_id, |
| 278 std::string* extension_app_id) { | 288 std::string* extension_app_id) { |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 322 if (profile_ && BrowserThread::IsMessageLoopValid(BrowserThread::FILE)) { | 332 if (profile_ && BrowserThread::IsMessageLoopValid(BrowserThread::FILE)) { |
| 323 return BrowserThread::PostTask(BrowserThread::FILE, from_here, task); | 333 return BrowserThread::PostTask(BrowserThread::FILE, from_here, task); |
| 324 } else { | 334 } else { |
| 325 // Fall back to executing on the main thread if the file thread | 335 // Fall back to executing on the main thread if the file thread |
| 326 // has gone away (around shutdown time) or if we're running as | 336 // has gone away (around shutdown time) or if we're running as |
| 327 // part of a unit test that does not set profile_. | 337 // part of a unit test that does not set profile_. |
| 328 task.Run(); | 338 task.Run(); |
| 329 return true; | 339 return true; |
| 330 } | 340 } |
| 331 } | 341 } |
| OLD | NEW |