| 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/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 Loading... |
| 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 Loading... |
| 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 |
| OLD | NEW |