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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 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/browser.h" 5 #include "chrome/browser/ui/browser.h"
6 6
7 #if defined(OS_WIN) 7 #if defined(OS_WIN)
8 #include <windows.h> 8 #include <windows.h>
9 #include <shellapi.h> 9 #include <shellapi.h>
10 #endif // defined(OS_WIN) 10 #endif // defined(OS_WIN)
(...skipping 831 matching lines...) Expand 10 before | Expand all | Expand 10 after
842 842
843 void Browser::UpdateDownloadShelfVisibility(bool visible) { 843 void Browser::UpdateDownloadShelfVisibility(bool visible) {
844 if (GetStatusBubble()) 844 if (GetStatusBubble())
845 GetStatusBubble()->UpdateDownloadShelfVisibility(visible); 845 GetStatusBubble()->UpdateDownloadShelfVisibility(visible);
846 } 846 }
847 847
848 /////////////////////////////////////////////////////////////////////////////// 848 ///////////////////////////////////////////////////////////////////////////////
849 849
850 // static 850 // static
851 bool Browser::RunUnloadEventsHelper(WebContents* contents) { 851 bool Browser::RunUnloadEventsHelper(WebContents* contents) {
852 // If there's a devtools window attached to the web contents,
853 // then we would like to run its beforeunload handlers first.
854 DevToolsWindow* dev_tools_window =
855 DevToolsWindow::GetInstanceForInspectedTab(contents);
856 if (dev_tools_window && dev_tools_window->InspectedPageWillClose()) {
857 return true;
858 }
852 // If the WebContents is not connected yet, then there's no unload 859 // If the WebContents is not connected yet, then there's no unload
853 // handler we can fire even if the WebContents has an unload listener. 860 // handler we can fire even if the WebContents has an unload listener.
854 // One case where we hit this is in a tab that has an infinite loop 861 // One case where we hit this is in a tab that has an infinite loop
855 // before load. 862 // before load.
856 if (contents->NeedToFireBeforeUnload()) { 863 if (contents->NeedToFireBeforeUnload()) {
857 // If the page has unload listeners, then we tell the renderer to fire 864 // If the page has unload listeners, then we tell the renderer to fire
858 // them. Once they have fired, we'll get a message back saying whether 865 // them. Once they have fired, we'll get a message back saying whether
859 // to proceed closing the page or not, which sends us back to this method 866 // to proceed closing the page or not, which sends us back to this method
860 // with the NeedToFireBeforeUnload bit cleared. 867 // with the NeedToFireBeforeUnload bit cleared.
861 contents->GetRenderViewHost()->FirePageBeforeUnload(false); 868 contents->GetRenderViewHost()->FirePageBeforeUnload(false);
(...skipping 577 matching lines...) Expand 10 before | Expand all | Expand 10 after
1439 return false; 1446 return false;
1440 } 1447 }
1441 1448
1442 gfx::Rect Browser::GetRootWindowResizerRect() const { 1449 gfx::Rect Browser::GetRootWindowResizerRect() const {
1443 return window_->GetRootWindowResizerRect(); 1450 return window_->GetRootWindowResizerRect();
1444 } 1451 }
1445 1452
1446 void Browser::BeforeUnloadFired(WebContents* web_contents, 1453 void Browser::BeforeUnloadFired(WebContents* web_contents,
1447 bool proceed, 1454 bool proceed,
1448 bool* proceed_to_fire_unload) { 1455 bool* proceed_to_fire_unload) {
1456 if (is_devtools()) {
1457 DevToolsWindow::HandleBeforeUnload(web_contents,
1458 proceed, proceed_to_fire_unload);
1459 return;
1460 }
1461 DevToolsWindow* dev_tools_window =
1462 DevToolsWindow::GetInstanceForInspectedTab(web_contents);
1463 if (dev_tools_window && !proceed)
1464 dev_tools_window->InspectedPageCancelClose();
1465
1449 if (IsFastTabUnloadEnabled()) { 1466 if (IsFastTabUnloadEnabled()) {
1450 *proceed_to_fire_unload = 1467 *proceed_to_fire_unload =
1451 fast_unload_controller_->BeforeUnloadFired(web_contents, proceed); 1468 fast_unload_controller_->BeforeUnloadFired(web_contents, proceed);
1452 } else { 1469 } else {
1453 *proceed_to_fire_unload = 1470 *proceed_to_fire_unload =
1454 unload_controller_->BeforeUnloadFired(web_contents, proceed); 1471 unload_controller_->BeforeUnloadFired(web_contents, proceed);
1455 } 1472 }
1456 } 1473 }
1457 1474
1458 bool Browser::ShouldFocusLocationBarByDefault(WebContents* source) { 1475 bool Browser::ShouldFocusLocationBarByDefault(WebContents* source) {
(...skipping 841 matching lines...) Expand 10 before | Expand all | Expand 10 after
2300 if (contents && !allow_js_access) { 2317 if (contents && !allow_js_access) {
2301 contents->web_contents()->GetController().LoadURL( 2318 contents->web_contents()->GetController().LoadURL(
2302 target_url, 2319 target_url,
2303 content::Referrer(), 2320 content::Referrer(),
2304 content::PAGE_TRANSITION_LINK, 2321 content::PAGE_TRANSITION_LINK,
2305 std::string()); // No extra headers. 2322 std::string()); // No extra headers.
2306 } 2323 }
2307 2324
2308 return contents != NULL; 2325 return contents != NULL;
2309 } 2326 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698