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_service.h" | 5 #include "chrome/browser/sessions/session_service.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <set> | 8 #include <set> |
9 #include <utility> | 9 #include <utility> |
10 #include <vector> | 10 #include <vector> |
(...skipping 479 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
490 const SessionID& window_id, | 490 const SessionID& window_id, |
491 const SessionID& tab_id, | 491 const SessionID& tab_id, |
492 const std::string& user_agent_override) { | 492 const std::string& user_agent_override) { |
493 if (!ShouldTrackChangesToWindow(window_id)) | 493 if (!ShouldTrackChangesToWindow(window_id)) |
494 return; | 494 return; |
495 | 495 |
496 ScheduleCommand(CreateSetTabUserAgentOverrideCommand( | 496 ScheduleCommand(CreateSetTabUserAgentOverrideCommand( |
497 kCommandSetTabUserAgentOverride, tab_id.id(), user_agent_override)); | 497 kCommandSetTabUserAgentOverride, tab_id.id(), user_agent_override)); |
498 } | 498 } |
499 | 499 |
500 CancelableTaskTracker::TaskId SessionService::GetLastSession( | 500 base::CancelableTaskTracker::TaskId SessionService::GetLastSession( |
501 const SessionCallback& callback, | 501 const SessionCallback& callback, |
502 CancelableTaskTracker* tracker) { | 502 base::CancelableTaskTracker* tracker) { |
503 // OnGotSessionCommands maps the SessionCommands to browser state, then run | 503 // OnGotSessionCommands maps the SessionCommands to browser state, then run |
504 // the callback. | 504 // the callback. |
505 return ScheduleGetLastSessionCommands( | 505 return ScheduleGetLastSessionCommands( |
506 base::Bind(&SessionService::OnGotSessionCommands, | 506 base::Bind(&SessionService::OnGotSessionCommands, |
507 base::Unretained(this), callback), | 507 base::Unretained(this), callback), |
508 tracker); | 508 tracker); |
509 } | 509 } |
510 | 510 |
511 void SessionService::Save() { | 511 void SessionService::Save() { |
512 bool had_commands = !pending_commands().empty(); | 512 bool had_commands = !pending_commands().empty(); |
(...skipping 1263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1776 return; | 1776 return; |
1777 } | 1777 } |
1778 | 1778 |
1779 // Check for any open windows for the current profile that we aren't tracking. | 1779 // Check for any open windows for the current profile that we aren't tracking. |
1780 for (chrome::BrowserIterator it; !it.done(); it.Next()) { | 1780 for (chrome::BrowserIterator it; !it.done(); it.Next()) { |
1781 if ((*it)->profile() == profile()) | 1781 if ((*it)->profile() == profile()) |
1782 return; | 1782 return; |
1783 } | 1783 } |
1784 DeleteSessionOnlyData(profile()); | 1784 DeleteSessionOnlyData(profile()); |
1785 } | 1785 } |
OLD | NEW |