OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/fast_unload_controller.h" | 5 #include "chrome/browser/ui/fast_unload_controller.h" |
6 | 6 |
7 #include "base/location.h" | 7 #include "base/location.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/macros.h" | 9 #include "base/macros.h" |
10 #include "base/single_thread_task_runner.h" | 10 #include "base/single_thread_task_runner.h" |
11 #include "base/threading/thread_task_runner_handle.h" | 11 #include "base/threading/thread_task_runner_handle.h" |
12 #include "chrome/browser/chrome_notification_types.h" | 12 #include "chrome/browser/chrome_notification_types.h" |
13 #include "chrome/browser/devtools/devtools_window.h" | 13 #include "chrome/browser/devtools/devtools_window.h" |
14 #include "chrome/browser/ui/browser.h" | 14 #include "chrome/browser/ui/browser.h" |
| 15 #include "chrome/browser/ui/browser_list.h" |
15 #include "chrome/browser/ui/browser_tabstrip.h" | 16 #include "chrome/browser/ui/browser_tabstrip.h" |
16 #include "chrome/browser/ui/tab_contents/core_tab_helper.h" | 17 #include "chrome/browser/ui/tab_contents/core_tab_helper.h" |
17 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 18 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
18 #include "chrome/browser/ui/tabs/tab_strip_model_delegate.h" | 19 #include "chrome/browser/ui/tabs/tab_strip_model_delegate.h" |
19 #include "chrome/browser/ui/unload_controller_web_contents_delegate.h" | 20 #include "chrome/browser/ui/unload_controller_web_contents_delegate.h" |
20 #include "content/public/browser/notification_service.h" | 21 #include "content/public/browser/notification_service.h" |
21 #include "content/public/browser/notification_source.h" | 22 #include "content/public/browser/notification_source.h" |
22 #include "content/public/browser/notification_types.h" | 23 #include "content/public/browser/notification_types.h" |
23 #include "content/public/browser/render_view_host.h" | 24 #include "content/public/browser/render_view_host.h" |
24 #include "content/public/browser/web_contents.h" | 25 #include "content/public/browser/web_contents.h" |
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
259 // No need to clear tabs_needing_unload_ack_. Those tabs are already detached. | 260 // No need to clear tabs_needing_unload_ack_. Those tabs are already detached. |
260 | 261 |
261 if (is_calling_before_unload_handlers()) { | 262 if (is_calling_before_unload_handlers()) { |
262 base::Callback<void(bool)> on_close_confirmed = on_close_confirmed_; | 263 base::Callback<void(bool)> on_close_confirmed = on_close_confirmed_; |
263 on_close_confirmed_.Reset(); | 264 on_close_confirmed_.Reset(); |
264 on_close_confirmed.Run(false); | 265 on_close_confirmed.Run(false); |
265 } | 266 } |
266 | 267 |
267 is_attempting_to_close_browser_ = false; | 268 is_attempting_to_close_browser_ = false; |
268 | 269 |
| 270 BrowserList::NotifyBrowserCloseCancelled(browser_); |
| 271 |
269 content::NotificationService::current()->Notify( | 272 content::NotificationService::current()->Notify( |
270 chrome::NOTIFICATION_BROWSER_CLOSE_CANCELLED, | 273 chrome::NOTIFICATION_BROWSER_CLOSE_CANCELLED, |
271 content::Source<Browser>(browser_), | 274 content::Source<Browser>(browser_), |
272 content::NotificationService::NoDetails()); | 275 content::NotificationService::NoDetails()); |
273 } | 276 } |
274 | 277 |
275 //////////////////////////////////////////////////////////////////////////////// | 278 //////////////////////////////////////////////////////////////////////////////// |
276 // FastUnloadController, content::NotificationObserver implementation: | 279 // FastUnloadController, content::NotificationObserver implementation: |
277 | 280 |
278 void FastUnloadController::Observe( | 281 void FastUnloadController::Observe( |
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
489 } | 492 } |
490 } | 493 } |
491 | 494 |
492 void FastUnloadController::PostTaskForProcessPendingTabs() { | 495 void FastUnloadController::PostTaskForProcessPendingTabs() { |
493 base::ThreadTaskRunnerHandle::Get()->PostTask( | 496 base::ThreadTaskRunnerHandle::Get()->PostTask( |
494 FROM_HERE, base::Bind(&FastUnloadController::ProcessPendingTabs, | 497 FROM_HERE, base::Bind(&FastUnloadController::ProcessPendingTabs, |
495 weak_factory_.GetWeakPtr(), false)); | 498 weak_factory_.GetWeakPtr(), false)); |
496 } | 499 } |
497 | 500 |
498 } // namespace chrome | 501 } // namespace chrome |
OLD | NEW |