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/devtools/devtools_window.h" | 5 #include "chrome/browser/devtools/devtools_window.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/json/json_reader.h" | 10 #include "base/json/json_reader.h" |
(...skipping 752 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
763 window->main_web_contents_->DispatchBeforeUnload(); | 763 window->main_web_contents_->DispatchBeforeUnload(); |
764 } | 764 } |
765 return true; | 765 return true; |
766 } | 766 } |
767 | 767 |
768 // static | 768 // static |
769 bool DevToolsWindow::NeedsToInterceptBeforeUnload( | 769 bool DevToolsWindow::NeedsToInterceptBeforeUnload( |
770 WebContents* contents) { | 770 WebContents* contents) { |
771 DevToolsWindow* window = | 771 DevToolsWindow* window = |
772 DevToolsWindow::GetInstanceForInspectedWebContents(contents); | 772 DevToolsWindow::GetInstanceForInspectedWebContents(contents); |
773 return window && !window->intercepted_page_beforeunload_; | 773 return window && !window->intercepted_page_beforeunload_ && |
774 window->life_stage_ != kClosing; | |
Michael K. (Yandex Team)
2017/03/01 13:48:52
On closing NeedsToInterceptBeforeUnload(..) should
dgozman
2017/03/01 19:39:48
Should we do |window->life_stage_ == kLoadComplete
Michael K. (Yandex Team)
2017/03/02 04:28:47
I think you are right.
I'll make a new patchset.
| |
774 } | 775 } |
775 | 776 |
776 // static | 777 // static |
777 bool DevToolsWindow::HasFiredBeforeUnloadEventForDevToolsBrowser( | 778 bool DevToolsWindow::HasFiredBeforeUnloadEventForDevToolsBrowser( |
778 Browser* browser) { | 779 Browser* browser) { |
779 DCHECK(browser->is_devtools()); | 780 DCHECK(browser->is_devtools()); |
780 // When FastUnloadController is used, devtools frontend will be detached | 781 // When FastUnloadController is used, devtools frontend will be detached |
781 // from the browser window at this point which means we've already fired | 782 // from the browser window at this point which means we've already fired |
782 // beforeunload. | 783 // beforeunload. |
783 if (browser->tab_strip_model()->empty()) | 784 if (browser->tab_strip_model()->empty()) |
(...skipping 625 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1409 bool DevToolsWindow::ReloadInspectedWebContents(bool bypass_cache) { | 1410 bool DevToolsWindow::ReloadInspectedWebContents(bool bypass_cache) { |
1410 // Only route reload via front-end if the agent is attached. | 1411 // Only route reload via front-end if the agent is attached. |
1411 WebContents* wc = GetInspectedWebContents(); | 1412 WebContents* wc = GetInspectedWebContents(); |
1412 if (!wc || wc->GetCrashedStatus() != base::TERMINATION_STATUS_STILL_RUNNING) | 1413 if (!wc || wc->GetCrashedStatus() != base::TERMINATION_STATUS_STILL_RUNNING) |
1413 return false; | 1414 return false; |
1414 base::FundamentalValue bypass_cache_value(bypass_cache); | 1415 base::FundamentalValue bypass_cache_value(bypass_cache); |
1415 bindings_->CallClientFunction("DevToolsAPI.reloadInspectedPage", | 1416 bindings_->CallClientFunction("DevToolsAPI.reloadInspectedPage", |
1416 &bypass_cache_value, nullptr, nullptr); | 1417 &bypass_cache_value, nullptr, nullptr); |
1417 return true; | 1418 return true; |
1418 } | 1419 } |
OLD | NEW |