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

Side by Side Diff: chrome/browser/ui/browser_tab_strip_model_delegate.cc

Issue 1321713005: Abstract WebContents/NavigationController from core TabRestore code (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Response to review Created 5 years, 3 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
OLDNEW
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/ui/browser_tab_strip_model_delegate.h" 5 #include "chrome/browser/ui/browser_tab_strip_model_delegate.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/message_loop/message_loop.h" 9 #include "base/message_loop/message_loop.h"
10 #include "chrome/browser/profiles/profile.h" 10 #include "chrome/browser/profiles/profile.h"
11 #include "chrome/browser/sessions/tab_restore_service.h" 11 #include "chrome/browser/sessions/tab_restore_service.h"
12 #include "chrome/browser/sessions/tab_restore_service_factory.h" 12 #include "chrome/browser/sessions/tab_restore_service_factory.h"
13 #include "chrome/browser/task_management/web_contents_tags.h" 13 #include "chrome/browser/task_management/web_contents_tags.h"
14 #include "chrome/browser/ui/browser.h" 14 #include "chrome/browser/ui/browser.h"
15 #include "chrome/browser/ui/browser_commands.h" 15 #include "chrome/browser/ui/browser_commands.h"
16 #include "chrome/browser/ui/browser_navigator.h" 16 #include "chrome/browser/ui/browser_navigator.h"
17 #include "chrome/browser/ui/browser_tabstrip.h" 17 #include "chrome/browser/ui/browser_tabstrip.h"
18 #include "chrome/browser/ui/browser_window.h" 18 #include "chrome/browser/ui/browser_window.h"
19 #include "chrome/browser/ui/fast_unload_controller.h" 19 #include "chrome/browser/ui/fast_unload_controller.h"
20 #include "chrome/browser/ui/tab_helpers.h" 20 #include "chrome/browser/ui/tab_helpers.h"
21 #include "chrome/browser/ui/tabs/tab_strip_model.h" 21 #include "chrome/browser/ui/tabs/tab_strip_model.h"
22 #include "chrome/browser/ui/unload_controller.h" 22 #include "chrome/browser/ui/unload_controller.h"
23 #include "chrome/common/chrome_switches.h" 23 #include "chrome/common/chrome_switches.h"
24 #include "components/sessions/content/content_live_tab.h"
24 #include "content/public/browser/site_instance.h" 25 #include "content/public/browser/site_instance.h"
25 #include "content/public/browser/web_contents.h" 26 #include "content/public/browser/web_contents.h"
26 #include "content/public/browser/web_contents_delegate.h" 27 #include "content/public/browser/web_contents_delegate.h"
27 #include "ipc/ipc_message.h" 28 #include "ipc/ipc_message.h"
28 29
29 namespace chrome { 30 namespace chrome {
30 31
31 //////////////////////////////////////////////////////////////////////////////// 32 ////////////////////////////////////////////////////////////////////////////////
32 // BrowserTabStripModelDelegate, public: 33 // BrowserTabStripModelDelegate, public:
33 34
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 // profiles. 112 // profiles.
112 if (!browser_->profile() || browser_->profile()->IsOffTheRecord()) 113 if (!browser_->profile() || browser_->profile()->IsOffTheRecord())
113 return; 114 return;
114 115
115 TabRestoreService* service = 116 TabRestoreService* service =
116 TabRestoreServiceFactory::GetForProfile(browser_->profile()); 117 TabRestoreServiceFactory::GetForProfile(browser_->profile());
117 118
118 // We only create historical tab entries for tabbed browser windows. 119 // We only create historical tab entries for tabbed browser windows.
119 if (service && browser_->CanSupportWindowFeature(Browser::FEATURE_TABSTRIP)) { 120 if (service && browser_->CanSupportWindowFeature(Browser::FEATURE_TABSTRIP)) {
120 service->CreateHistoricalTab( 121 service->CreateHistoricalTab(
121 contents, 122 sessions::ContentLiveTab::FromWebContents(contents),
122 browser_->tab_strip_model()->GetIndexOfWebContents(contents)); 123 browser_->tab_strip_model()->GetIndexOfWebContents(contents));
123 } 124 }
124 } 125 }
125 126
126 bool BrowserTabStripModelDelegate::RunUnloadListenerBeforeClosing( 127 bool BrowserTabStripModelDelegate::RunUnloadListenerBeforeClosing(
127 content::WebContents* contents) { 128 content::WebContents* contents) {
128 if (base::CommandLine::ForCurrentProcess()->HasSwitch( 129 if (base::CommandLine::ForCurrentProcess()->HasSwitch(
129 switches::kEnableFastUnload)) { 130 switches::kEnableFastUnload)) {
130 return chrome::FastUnloadController::RunUnloadEventsHelper(contents); 131 return chrome::FastUnloadController::RunUnloadEventsHelper(contents);
131 } 132 }
(...skipping 27 matching lines...) Expand all
159 } 160 }
160 161
161 //////////////////////////////////////////////////////////////////////////////// 162 ////////////////////////////////////////////////////////////////////////////////
162 // BrowserTabStripModelDelegate, private: 163 // BrowserTabStripModelDelegate, private:
163 164
164 void BrowserTabStripModelDelegate::CloseFrame() { 165 void BrowserTabStripModelDelegate::CloseFrame() {
165 browser_->window()->Close(); 166 browser_->window()->Close();
166 } 167 }
167 168
168 } // namespace chrome 169 } // namespace chrome
OLDNEW
« no previous file with comments | « chrome/browser/ui/browser_tab_restore_service_delegate.cc ('k') | chrome/browser/ui/tab_helpers.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698