| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_restore_delegate.h" | 5 #include "chrome/browser/sessions/session_restore_delegate.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <utility> |
| 8 | 9 |
| 9 #include "base/macros.h" | 10 #include "base/macros.h" |
| 10 #include "base/metrics/field_trial.h" | 11 #include "base/metrics/field_trial.h" |
| 11 #include "chrome/browser/sessions/session_restore_stats_collector.h" | 12 #include "chrome/browser/sessions/session_restore_stats_collector.h" |
| 12 #include "chrome/browser/sessions/tab_loader.h" | 13 #include "chrome/browser/sessions/tab_loader.h" |
| 13 #include "chrome/common/url_constants.h" | 14 #include "chrome/common/url_constants.h" |
| 14 #include "components/favicon/content/content_favicon_driver.h" | 15 #include "components/favicon/content/content_favicon_driver.h" |
| 15 #include "content/public/browser/web_contents.h" | 16 #include "content/public/browser/web_contents.h" |
| 16 | 17 |
| 17 namespace { | 18 namespace { |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 if (!trial || trial->group_name() != "DontRestoreBackgroundTabs") { | 91 if (!trial || trial->group_name() != "DontRestoreBackgroundTabs") { |
| 91 TabLoader::RestoreTabs(tabs, restore_started); | 92 TabLoader::RestoreTabs(tabs, restore_started); |
| 92 } else { | 93 } else { |
| 93 // A TabLoader will not be used for this session restore, so manually create | 94 // A TabLoader will not be used for this session restore, so manually create |
| 94 // and use a SessionRestoreStatsCollector, normally owned by the TabLoader. | 95 // and use a SessionRestoreStatsCollector, normally owned by the TabLoader. |
| 95 scoped_ptr<SessionRestoreStatsCollector::StatsReportingDelegate> | 96 scoped_ptr<SessionRestoreStatsCollector::StatsReportingDelegate> |
| 96 reporting_delegate( | 97 reporting_delegate( |
| 97 new SessionRestoreStatsCollector::UmaStatsReportingDelegate()); | 98 new SessionRestoreStatsCollector::UmaStatsReportingDelegate()); |
| 98 scoped_refptr<SessionRestoreStatsCollector> stats_collector = | 99 scoped_refptr<SessionRestoreStatsCollector> stats_collector = |
| 99 new SessionRestoreStatsCollector(restore_started, | 100 new SessionRestoreStatsCollector(restore_started, |
| 100 reporting_delegate.Pass()); | 101 std::move(reporting_delegate)); |
| 101 stats_collector->TrackTabs(tabs); | 102 stats_collector->TrackTabs(tabs); |
| 102 for (const auto& restored_tab : tabs) { | 103 for (const auto& restored_tab : tabs) { |
| 103 if (!restored_tab.is_active()) { | 104 if (!restored_tab.is_active()) { |
| 104 // Non-active tabs aren't being loaded, so mark them as deferred. | 105 // Non-active tabs aren't being loaded, so mark them as deferred. |
| 105 auto tab_controller = &restored_tab.contents()->GetController(); | 106 auto tab_controller = &restored_tab.contents()->GetController(); |
| 106 stats_collector->DeferTab(tab_controller); | 107 stats_collector->DeferTab(tab_controller); |
| 107 } | 108 } |
| 108 } | 109 } |
| 109 } | 110 } |
| 110 } | 111 } |
| OLD | NEW |