Chromium Code Reviews| 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/unload_controller.h" | 5 #include "chrome/browser/ui/unload_controller.h" |
| 6 | 6 |
| 7 #include "base/location.h" | 7 #include "base/location.h" |
| 8 #include "base/single_thread_task_runner.h" | 8 #include "base/single_thread_task_runner.h" |
| 9 #include "base/threading/thread_task_runner_handle.h" | 9 #include "base/threading/thread_task_runner_handle.h" |
| 10 #include "chrome/browser/chrome_notification_types.h" | 10 #include "chrome/browser/chrome_notification_types.h" |
| 11 #include "chrome/browser/devtools/devtools_window.h" | 11 #include "chrome/browser/devtools/devtools_window.h" |
| 12 #include "chrome/browser/ui/browser.h" | 12 #include "chrome/browser/ui/browser.h" |
| 13 #include "chrome/browser/ui/browser_list.h" | |
| 13 #include "chrome/browser/ui/browser_tabstrip.h" | 14 #include "chrome/browser/ui/browser_tabstrip.h" |
| 14 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 15 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| 15 #include "content/public/browser/notification_service.h" | 16 #include "content/public/browser/notification_service.h" |
| 16 #include "content/public/browser/notification_source.h" | 17 #include "content/public/browser/notification_source.h" |
| 17 #include "content/public/browser/notification_types.h" | 18 #include "content/public/browser/notification_types.h" |
| 18 #include "content/public/browser/render_view_host.h" | 19 #include "content/public/browser/render_view_host.h" |
| 19 #include "content/public/browser/web_contents.h" | 20 #include "content/public/browser/web_contents.h" |
| 20 #include "extensions/features/features.h" | 21 #include "extensions/features/features.h" |
| 21 | 22 |
| 22 #if BUILDFLAG(ENABLE_EXTENSIONS) | 23 #if BUILDFLAG(ENABLE_EXTENSIONS) |
| (...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 215 DevToolsWindow::OnPageCloseCanceled(*it); | 216 DevToolsWindow::OnPageCloseCanceled(*it); |
| 216 } | 217 } |
| 217 tabs_needing_unload_fired_.clear(); | 218 tabs_needing_unload_fired_.clear(); |
| 218 if (is_calling_before_unload_handlers()) { | 219 if (is_calling_before_unload_handlers()) { |
| 219 base::Callback<void(bool)> on_close_confirmed = on_close_confirmed_; | 220 base::Callback<void(bool)> on_close_confirmed = on_close_confirmed_; |
| 220 on_close_confirmed_.Reset(); | 221 on_close_confirmed_.Reset(); |
| 221 on_close_confirmed.Run(false); | 222 on_close_confirmed.Run(false); |
| 222 } | 223 } |
| 223 is_attempting_to_close_browser_ = false; | 224 is_attempting_to_close_browser_ = false; |
| 224 | 225 |
| 226 BrowserList::NotifyBrowserCloseCancelled(browser_); | |
| 227 | |
| 225 content::NotificationService::current()->Notify( | 228 content::NotificationService::current()->Notify( |
| 226 chrome::NOTIFICATION_BROWSER_CLOSE_CANCELLED, | 229 chrome::NOTIFICATION_BROWSER_CLOSE_CANCELLED, |
| 227 content::Source<Browser>(browser_), | 230 content::Source<Browser>(browser_), |
|
sky
2017/03/31 14:23:41
Is it possible to remove this notification now?
Alexey Seren
2017/04/02 12:02:35
This notification is used in several places in chr
| |
| 228 content::NotificationService::NoDetails()); | 231 content::NotificationService::NoDetails()); |
| 229 } | 232 } |
| 230 | 233 |
| 231 //////////////////////////////////////////////////////////////////////////////// | 234 //////////////////////////////////////////////////////////////////////////////// |
| 232 // UnloadController, content::NotificationObserver implementation: | 235 // UnloadController, content::NotificationObserver implementation: |
| 233 | 236 |
| 234 void UnloadController::Observe(int type, | 237 void UnloadController::Observe(int type, |
| 235 const content::NotificationSource& source, | 238 const content::NotificationSource& source, |
| 236 const content::NotificationDetails& details) { | 239 const content::NotificationDetails& details) { |
| 237 DCHECK_EQ(content::NOTIFICATION_WEB_CONTENTS_DISCONNECTED, type); | 240 DCHECK_EQ(content::NOTIFICATION_WEB_CONTENTS_DISCONNECTED, type); |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 394 if (weak_factory_.HasWeakPtrs()) | 397 if (weak_factory_.HasWeakPtrs()) |
| 395 return; | 398 return; |
| 396 base::ThreadTaskRunnerHandle::Get()->PostTask( | 399 base::ThreadTaskRunnerHandle::Get()->PostTask( |
| 397 FROM_HERE, base::Bind(&UnloadController::ProcessPendingTabs, | 400 FROM_HERE, base::Bind(&UnloadController::ProcessPendingTabs, |
| 398 weak_factory_.GetWeakPtr(), false)); | 401 weak_factory_.GetWeakPtr(), false)); |
| 399 } | 402 } |
| 400 } | 403 } |
| 401 } | 404 } |
| 402 | 405 |
| 403 } // namespace chrome | 406 } // namespace chrome |
| OLD | NEW |