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_restore.h" | 5 #include "chrome/browser/sessions/session_restore.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <list> | 8 #include <list> |
9 #include <set> | 9 #include <set> |
10 #include <string> | 10 #include <string> |
11 | 11 |
12 #include "base/bind.h" | 12 #include "base/bind.h" |
13 #include "base/bind_helpers.h" | 13 #include "base/bind_helpers.h" |
14 #include "base/callback.h" | 14 #include "base/callback.h" |
15 #include "base/command_line.h" | 15 #include "base/command_line.h" |
16 #include "base/memory/scoped_ptr.h" | 16 #include "base/memory/scoped_ptr.h" |
17 #include "base/memory/scoped_vector.h" | 17 #include "base/memory/scoped_vector.h" |
18 #include "base/metrics/histogram.h" | 18 #include "base/metrics/histogram.h" |
19 #include "base/platform_file.h" | 19 #include "base/platform_file.h" |
20 #include "base/stl_util.h" | 20 #include "base/stl_util.h" |
21 #include "base/strings/stringprintf.h" | 21 #include "base/strings/stringprintf.h" |
| 22 #include "base/task/cancelable_task_tracker.h" |
22 #include "chrome/browser/browser_process.h" | 23 #include "chrome/browser/browser_process.h" |
23 #include "chrome/browser/chrome_notification_types.h" | 24 #include "chrome/browser/chrome_notification_types.h" |
24 #include "chrome/browser/extensions/extension_service.h" | 25 #include "chrome/browser/extensions/extension_service.h" |
25 #include "chrome/browser/performance_monitor/startup_timer.h" | 26 #include "chrome/browser/performance_monitor/startup_timer.h" |
26 #include "chrome/browser/profiles/profile.h" | 27 #include "chrome/browser/profiles/profile.h" |
27 #include "chrome/browser/sessions/session_service.h" | 28 #include "chrome/browser/sessions/session_service.h" |
28 #include "chrome/browser/sessions/session_service_factory.h" | 29 #include "chrome/browser/sessions/session_service_factory.h" |
29 #include "chrome/browser/sessions/session_types.h" | 30 #include "chrome/browser/sessions/session_types.h" |
30 #include "chrome/browser/ui/browser.h" | 31 #include "chrome/browser/ui/browser.h" |
31 #include "chrome/browser/ui/browser_finder.h" | 32 #include "chrome/browser/ui/browser_finder.h" |
32 #include "chrome/browser/ui/browser_navigator.h" | 33 #include "chrome/browser/ui/browser_navigator.h" |
33 #include "chrome/browser/ui/browser_tabrestore.h" | 34 #include "chrome/browser/ui/browser_tabrestore.h" |
34 #include "chrome/browser/ui/browser_tabstrip.h" | 35 #include "chrome/browser/ui/browser_tabstrip.h" |
35 #include "chrome/browser/ui/browser_window.h" | 36 #include "chrome/browser/ui/browser_window.h" |
36 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 37 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
37 #include "chrome/browser/ui/webui/ntp/core_app_launcher_handler.h" | 38 #include "chrome/browser/ui/webui/ntp/core_app_launcher_handler.h" |
38 #include "chrome/common/cancelable_task_tracker.h" | |
39 #include "content/public/browser/child_process_security_policy.h" | 39 #include "content/public/browser/child_process_security_policy.h" |
40 #include "content/public/browser/dom_storage_context.h" | 40 #include "content/public/browser/dom_storage_context.h" |
41 #include "content/public/browser/navigation_controller.h" | 41 #include "content/public/browser/navigation_controller.h" |
42 #include "content/public/browser/notification_registrar.h" | 42 #include "content/public/browser/notification_registrar.h" |
43 #include "content/public/browser/notification_service.h" | 43 #include "content/public/browser/notification_service.h" |
44 #include "content/public/browser/render_process_host.h" | 44 #include "content/public/browser/render_process_host.h" |
45 #include "content/public/browser/render_widget_host.h" | 45 #include "content/public/browser/render_widget_host.h" |
46 #include "content/public/browser/render_widget_host_view.h" | 46 #include "content/public/browser/render_widget_host_view.h" |
47 #include "content/public/browser/session_storage_namespace.h" | 47 #include "content/public/browser/session_storage_namespace.h" |
48 #include "content/public/browser/storage_partition.h" | 48 #include "content/public/browser/storage_partition.h" |
(...skipping 1100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1149 | 1149 |
1150 // If true and there is an error or there are no windows to restore, we | 1150 // If true and there is an error or there are no windows to restore, we |
1151 // create a tabbed browser anyway. This is used on startup to make sure at | 1151 // create a tabbed browser anyway. This is used on startup to make sure at |
1152 // at least one window is created. | 1152 // at least one window is created. |
1153 const bool always_create_tabbed_browser_; | 1153 const bool always_create_tabbed_browser_; |
1154 | 1154 |
1155 // Set of URLs to open in addition to those restored from the session. | 1155 // Set of URLs to open in addition to those restored from the session. |
1156 std::vector<GURL> urls_to_open_; | 1156 std::vector<GURL> urls_to_open_; |
1157 | 1157 |
1158 // Used to get the session. | 1158 // Used to get the session. |
1159 CancelableTaskTracker cancelable_task_tracker_; | 1159 base::CancelableTaskTracker cancelable_task_tracker_; |
1160 | 1160 |
1161 // Responsible for loading the tabs. | 1161 // Responsible for loading the tabs. |
1162 scoped_refptr<TabLoader> tab_loader_; | 1162 scoped_refptr<TabLoader> tab_loader_; |
1163 | 1163 |
1164 // When synchronous we run a nested message loop. To avoid creating windows | 1164 // When synchronous we run a nested message loop. To avoid creating windows |
1165 // from the nested message loop (which can make exiting the nested message | 1165 // from the nested message loop (which can make exiting the nested message |
1166 // loop take a while) we cache the SessionWindows here and create the actual | 1166 // loop take a while) we cache the SessionWindows here and create the actual |
1167 // windows when the nested message loop exits. | 1167 // windows when the nested message loop exits. |
1168 std::vector<SessionWindow*> windows_; | 1168 std::vector<SessionWindow*> windows_; |
1169 SessionID::id_type active_window_id_; | 1169 SessionID::id_type active_window_id_; |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1255 if (!active_session_restorers) | 1255 if (!active_session_restorers) |
1256 return false; | 1256 return false; |
1257 for (std::set<SessionRestoreImpl*>::const_iterator it = | 1257 for (std::set<SessionRestoreImpl*>::const_iterator it = |
1258 active_session_restorers->begin(); | 1258 active_session_restorers->begin(); |
1259 it != active_session_restorers->end(); ++it) { | 1259 it != active_session_restorers->end(); ++it) { |
1260 if ((*it)->synchronous()) | 1260 if ((*it)->synchronous()) |
1261 return true; | 1261 return true; |
1262 } | 1262 } |
1263 return false; | 1263 return false; |
1264 } | 1264 } |
OLD | NEW |