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

Unified Diff: chrome/browser/ui/browser.cc

Issue 23835007: DevTools: Do not close devtools if there are dirty files in workspace (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: reupload Created 7 years, 3 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/browser.cc
diff --git a/chrome/browser/ui/browser.cc b/chrome/browser/ui/browser.cc
index 2056b53aa9aa3ad4c4a564706690a838d6fa7325..410194c876efed43998f1cbb5a3adcedd684f1f7 100644
--- a/chrome/browser/ui/browser.cc
+++ b/chrome/browser/ui/browser.cc
@@ -849,6 +849,13 @@ void Browser::UpdateDownloadShelfVisibility(bool visible) {
// static
bool Browser::RunUnloadEventsHelper(WebContents* contents) {
+ // If there's a devtools window attached to the web contents,
+ // then we would like to run its beforeunload handlers first.
+ DevToolsWindow* dev_tools_window =
+ DevToolsWindow::GetInstanceForInspectedTab(contents);
+ if (dev_tools_window && dev_tools_window->InspectedPageWillClose()) {
+ return true;
+ }
// If the WebContents is not connected yet, then there's no unload
// handler we can fire even if the WebContents has an unload listener.
// One case where we hit this is in a tab that has an infinite loop
@@ -1446,6 +1453,16 @@ gfx::Rect Browser::GetRootWindowResizerRect() const {
void Browser::BeforeUnloadFired(WebContents* web_contents,
bool proceed,
bool* proceed_to_fire_unload) {
+ if (is_devtools()) {
+ DevToolsWindow::HandleBeforeUnload(web_contents,
+ proceed, proceed_to_fire_unload);
+ return;
+ }
+ DevToolsWindow* dev_tools_window =
+ DevToolsWindow::GetInstanceForInspectedTab(web_contents);
+ if (dev_tools_window && !proceed)
+ dev_tools_window->InspectedPageCancelClose();
+
if (IsFastTabUnloadEnabled()) {
*proceed_to_fire_unload =
fast_unload_controller_->BeforeUnloadFired(web_contents, proceed);

Powered by Google App Engine
This is Rietveld 408576698