Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(680)

Side by Side Diff: chrome/browser/sessions/session_restore.cc

Issue 8983010: Convert WebContents to return a content::NavigationController instead of the implementation. Upda... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: fix mac Created 8 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 <vector> 10 #include <vector>
(...skipping 13 matching lines...) Expand all
24 #include "chrome/browser/sessions/session_service_factory.h" 24 #include "chrome/browser/sessions/session_service_factory.h"
25 #include "chrome/browser/sessions/session_types.h" 25 #include "chrome/browser/sessions/session_types.h"
26 #include "chrome/browser/tabs/tab_strip_model.h" 26 #include "chrome/browser/tabs/tab_strip_model.h"
27 #include "chrome/browser/ui/browser.h" 27 #include "chrome/browser/ui/browser.h"
28 #include "chrome/browser/ui/browser_list.h" 28 #include "chrome/browser/ui/browser_list.h"
29 #include "chrome/browser/ui/browser_navigator.h" 29 #include "chrome/browser/ui/browser_navigator.h"
30 #include "chrome/browser/ui/browser_window.h" 30 #include "chrome/browser/ui/browser_window.h"
31 #include "chrome/common/chrome_notification_types.h" 31 #include "chrome/common/chrome_notification_types.h"
32 #include "content/browser/renderer_host/render_widget_host.h" 32 #include "content/browser/renderer_host/render_widget_host.h"
33 #include "content/browser/renderer_host/render_widget_host_view.h" 33 #include "content/browser/renderer_host/render_widget_host_view.h"
34 #include "content/browser/tab_contents/navigation_controller.h"
35 #include "content/browser/tab_contents/tab_contents.h" 34 #include "content/browser/tab_contents/tab_contents.h"
36 #include "content/browser/tab_contents/tab_contents_view.h" 35 #include "content/browser/tab_contents/tab_contents_view.h"
36 #include "content/public/browser/navigation_controller.h"
37 #include "content/public/browser/notification_registrar.h" 37 #include "content/public/browser/notification_registrar.h"
38 #include "content/public/browser/notification_service.h" 38 #include "content/public/browser/notification_service.h"
39 #include "net/base/network_change_notifier.h" 39 #include "net/base/network_change_notifier.h"
40 40
41 #if defined(OS_CHROMEOS) 41 #if defined(OS_CHROMEOS)
42 #include "chrome/browser/chromeos/boot_times_loader.h" 42 #include "chrome/browser/chromeos/boot_times_loader.h"
43 #endif 43 #endif
44 44
45 using content::WebContents; 45 using content::WebContents;
46 46
(...skipping 15 matching lines...) Expand all
62 // 62 //
63 // This is not part of SessionRestoreImpl so that synchronous destruction 63 // This is not part of SessionRestoreImpl so that synchronous destruction
64 // of SessionRestoreImpl doesn't have timing problems. 64 // of SessionRestoreImpl doesn't have timing problems.
65 class TabLoader : public content::NotificationObserver, 65 class TabLoader : public content::NotificationObserver,
66 public net::NetworkChangeNotifier::OnlineStateObserver { 66 public net::NetworkChangeNotifier::OnlineStateObserver {
67 public: 67 public:
68 explicit TabLoader(base::TimeTicks restore_started); 68 explicit TabLoader(base::TimeTicks restore_started);
69 virtual ~TabLoader(); 69 virtual ~TabLoader();
70 70
71 // Schedules a tab for loading. 71 // Schedules a tab for loading.
72 void ScheduleLoad(NavigationController* controller); 72 void ScheduleLoad(content::NavigationController* controller);
73 73
74 // Notifies the loader that a tab has been scheduled for loading through 74 // Notifies the loader that a tab has been scheduled for loading through
75 // some other mechanism. 75 // some other mechanism.
76 void TabIsLoading(NavigationController* controller); 76 void TabIsLoading(content::NavigationController* controller);
77 77
78 // Invokes |LoadNextTab| to load a tab. 78 // Invokes |LoadNextTab| to load a tab.
79 // 79 //
80 // This must be invoked once to start loading. 80 // This must be invoked once to start loading.
81 void StartLoading(); 81 void StartLoading();
82 82
83 private: 83 private:
84 typedef std::set<content::NavigationController*> TabsLoading; 84 typedef std::set<content::NavigationController*> TabsLoading;
85 typedef std::list<content::NavigationController*> TabsToLoad; 85 typedef std::list<content::NavigationController*> TabsToLoad;
86 typedef std::set<RenderWidgetHost*> RenderWidgetHostSet; 86 typedef std::set<RenderWidgetHost*> RenderWidgetHostSet;
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 tab_count_(0), 161 tab_count_(0),
162 restore_started_(restore_started) { 162 restore_started_(restore_started) {
163 } 163 }
164 164
165 TabLoader::~TabLoader() { 165 TabLoader::~TabLoader() {
166 DCHECK((got_first_paint_ || render_widget_hosts_to_paint_.empty()) && 166 DCHECK((got_first_paint_ || render_widget_hosts_to_paint_.empty()) &&
167 tabs_loading_.empty() && tabs_to_load_.empty()); 167 tabs_loading_.empty() && tabs_to_load_.empty());
168 net::NetworkChangeNotifier::RemoveOnlineStateObserver(this); 168 net::NetworkChangeNotifier::RemoveOnlineStateObserver(this);
169 } 169 }
170 170
171 void TabLoader::ScheduleLoad(NavigationController* controller) { 171 void TabLoader::ScheduleLoad(content::NavigationController* controller) {
172 DCHECK(controller); 172 DCHECK(controller);
173 DCHECK(find(tabs_to_load_.begin(), tabs_to_load_.end(), controller) == 173 DCHECK(find(tabs_to_load_.begin(), tabs_to_load_.end(), controller) ==
174 tabs_to_load_.end()); 174 tabs_to_load_.end());
175 tabs_to_load_.push_back(controller); 175 tabs_to_load_.push_back(controller);
176 RegisterForNotifications(controller); 176 RegisterForNotifications(controller);
177 } 177 }
178 178
179 void TabLoader::TabIsLoading(NavigationController* controller) { 179 void TabLoader::TabIsLoading(content::NavigationController* controller) {
180 DCHECK(controller); 180 DCHECK(controller);
181 DCHECK(find(tabs_loading_.begin(), tabs_loading_.end(), controller) == 181 DCHECK(find(tabs_loading_.begin(), tabs_loading_.end(), controller) ==
182 tabs_loading_.end()); 182 tabs_loading_.end());
183 tabs_loading_.insert(controller); 183 tabs_loading_.insert(controller);
184 RenderWidgetHost* render_widget_host = GetRenderWidgetHost(controller); 184 RenderWidgetHost* render_widget_host = GetRenderWidgetHost(controller);
185 DCHECK(render_widget_host); 185 DCHECK(render_widget_host);
186 render_widget_hosts_loading_.insert(render_widget_host); 186 render_widget_hosts_loading_.insert(render_widget_host);
187 RegisterForNotifications(controller); 187 RegisterForNotifications(controller);
188 } 188 }
189 189
(...skipping 712 matching lines...) Expand 10 before | Expand all | Expand 10 after
902 std::vector<GURL> gurls; 902 std::vector<GURL> gurls;
903 SessionRestoreImpl restorer(profile, 903 SessionRestoreImpl restorer(profile,
904 static_cast<Browser*>(NULL), true, false, true, gurls); 904 static_cast<Browser*>(NULL), true, false, true, gurls);
905 restorer.RestoreForeignTab(tab); 905 restorer.RestoreForeignTab(tab);
906 } 906 }
907 907
908 // static 908 // static
909 bool SessionRestore::IsRestoring() { 909 bool SessionRestore::IsRestoring() {
910 return restoring; 910 return restoring;
911 } 911 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698