Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(591)

Side by Side Diff: chrome/browser/devtools/devtools_window.cc

Issue 2695233003: Fix unload controller. (Closed)
Patch Set: Fix review note. Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | chrome/browser/lifetime/browser_close_manager_browsertest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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_ == kLoadCompleted;
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
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 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/lifetime/browser_close_manager_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698