| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "build/build_config.h" | 5 #include "build/build_config.h" |
| 6 | 6 |
| 7 #include "chrome/browser/sessions/session_service.h" | 7 #include "chrome/browser/sessions/session_service.h" |
| 8 | 8 |
| 9 #include <limits> | 9 #include <limits> |
| 10 | 10 |
| (...skipping 413 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 424 return ScheduleGetCurrentSessionCommands( | 424 return ScheduleGetCurrentSessionCommands( |
| 425 new InternalSessionRequest( | 425 new InternalSessionRequest( |
| 426 NewCallback(this, &SessionService::OnGotSessionCommands), | 426 NewCallback(this, &SessionService::OnGotSessionCommands), |
| 427 callback), consumer); | 427 callback), consumer); |
| 428 } | 428 } |
| 429 } | 429 } |
| 430 | 430 |
| 431 void SessionService::Save() { | 431 void SessionService::Save() { |
| 432 bool had_commands = !pending_commands().empty(); | 432 bool had_commands = !pending_commands().empty(); |
| 433 BaseSessionService::Save(); | 433 BaseSessionService::Save(); |
| 434 if (had_commands) | 434 if (had_commands) { |
| 435 RecordSaveHistogramData(); | 435 RecordSaveHistogramData(); |
| 436 NotificationService::current()->Notify( |
| 437 NotificationType::SESSION_SERVICE_SAVED, |
| 438 NotificationService::AllSources(), |
| 439 NotificationService::NoDetails()); |
| 440 } |
| 436 } | 441 } |
| 437 | 442 |
| 438 | 443 |
| 439 void SessionService::Init() { | 444 void SessionService::Init() { |
| 440 // Register for the notifications we're interested in. | 445 // Register for the notifications we're interested in. |
| 441 registrar_.Add(this, NotificationType::TAB_PARENTED, | 446 registrar_.Add(this, NotificationType::TAB_PARENTED, |
| 442 NotificationService::AllSources()); | 447 NotificationService::AllSources()); |
| 443 registrar_.Add(this, NotificationType::TAB_CLOSED, | 448 registrar_.Add(this, NotificationType::TAB_CLOSED, |
| 444 NotificationService::AllSources()); | 449 NotificationService::AllSources()); |
| 445 registrar_.Add(this, NotificationType::NAV_LIST_PRUNED, | 450 registrar_.Add(this, NotificationType::NAV_LIST_PRUNED, |
| (...skipping 889 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1335 UMA_HISTOGRAM_CUSTOM_TIMES("SessionRestore.LongSavePeriod", | 1340 UMA_HISTOGRAM_CUSTOM_TIMES("SessionRestore.LongSavePeriod", |
| 1336 delta, | 1341 delta, |
| 1337 base::TimeDelta::FromMinutes(10), | 1342 base::TimeDelta::FromMinutes(10), |
| 1338 base::TimeDelta::FromHours(8), | 1343 base::TimeDelta::FromHours(8), |
| 1339 50); | 1344 50); |
| 1340 } | 1345 } |
| 1341 } | 1346 } |
| 1342 | 1347 |
| 1343 last_save_time_ = base::TimeTicks::Now(); | 1348 last_save_time_ = base::TimeTicks::Now(); |
| 1344 } | 1349 } |
| OLD | NEW |