| 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" |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 //////////////////////////////////////////////////////////////////////////////// | 29 //////////////////////////////////////////////////////////////////////////////// |
| 30 // DetachedWebContentsDelegate will delete web contents when they close. | 30 // DetachedWebContentsDelegate will delete web contents when they close. |
| 31 class FastUnloadController::DetachedWebContentsDelegate | 31 class FastUnloadController::DetachedWebContentsDelegate |
| 32 : public content::WebContentsDelegate { | 32 : public content::WebContentsDelegate { |
| 33 public: | 33 public: |
| 34 DetachedWebContentsDelegate() { } | 34 DetachedWebContentsDelegate() { } |
| 35 ~DetachedWebContentsDelegate() override {} | 35 ~DetachedWebContentsDelegate() override {} |
| 36 | 36 |
| 37 private: | 37 private: |
| 38 // WebContentsDelegate implementation. | 38 // WebContentsDelegate implementation. |
| 39 bool ShouldSuppressDialogs(content::WebContents* source) override { | 39 bool ShouldSuppressDialogs(content::WebContents* source, |
| 40 bool before_unload) override { |
| 40 return true; // Return true so dialogs are suppressed. | 41 return true; // Return true so dialogs are suppressed. |
| 41 } | 42 } |
| 42 | 43 |
| 43 void CloseContents(content::WebContents* source) override { | 44 void CloseContents(content::WebContents* source) override { |
| 44 // Finished detached close. | 45 // Finished detached close. |
| 45 // FastUnloadController will observe | 46 // FastUnloadController will observe |
| 46 // |NOTIFICATION_WEB_CONTENTS_DISCONNECTED|. | 47 // |NOTIFICATION_WEB_CONTENTS_DISCONNECTED|. |
| 47 delete source; | 48 delete source; |
| 48 } | 49 } |
| 49 | 50 |
| (...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 472 } | 473 } |
| 473 } | 474 } |
| 474 | 475 |
| 475 void FastUnloadController::PostTaskForProcessPendingTabs() { | 476 void FastUnloadController::PostTaskForProcessPendingTabs() { |
| 476 base::ThreadTaskRunnerHandle::Get()->PostTask( | 477 base::ThreadTaskRunnerHandle::Get()->PostTask( |
| 477 FROM_HERE, base::Bind(&FastUnloadController::ProcessPendingTabs, | 478 FROM_HERE, base::Bind(&FastUnloadController::ProcessPendingTabs, |
| 478 weak_factory_.GetWeakPtr())); | 479 weak_factory_.GetWeakPtr())); |
| 479 } | 480 } |
| 480 | 481 |
| 481 } // namespace chrome | 482 } // namespace chrome |
| OLD | NEW |