| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 <algorithm> | 5 #include <algorithm> |
| 6 | 6 |
| 7 #include "base/gfx/point.h" | 7 #include "base/gfx/point.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "chrome/browser/browser.h" | 9 #include "chrome/browser/browser.h" |
| 10 #include "chrome/browser/browser_about_handler.h" | 10 #include "chrome/browser/browser_about_handler.h" |
| (...skipping 515 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 526 | 526 |
| 527 bool TabStripModel::InternalCloseTabContentsAt(int index, | 527 bool TabStripModel::InternalCloseTabContentsAt(int index, |
| 528 bool create_historical_tab) { | 528 bool create_historical_tab) { |
| 529 TabContents* detached_contents = GetContentsAt(index); | 529 TabContents* detached_contents = GetContentsAt(index); |
| 530 | 530 |
| 531 if (TabHasUnloadListener(index)) { | 531 if (TabHasUnloadListener(index)) { |
| 532 // If the page has unload listeners, then we tell the renderer to fire | 532 // If the page has unload listeners, then we tell the renderer to fire |
| 533 // them. Once they have fired, we'll get a message back saying whether | 533 // them. Once they have fired, we'll get a message back saying whether |
| 534 // to proceed closing the page or not, which sends us back to this method | 534 // to proceed closing the page or not, which sends us back to this method |
| 535 // with the HasUnloadListener bit cleared. | 535 // with the HasUnloadListener bit cleared. |
| 536 WebContents* web_contents = GetContentsAt(index)->AsWebContents(); | 536 WebContents* web_contents = detached_contents->AsWebContents(); |
| 537 // If we hit this code path, the tab had better be a WebContents tab. | 537 // If we hit this code path, the tab had better be a WebContents tab. |
| 538 DCHECK(web_contents); | 538 DCHECK(web_contents); |
| 539 web_contents->render_view_host()->FirePageBeforeUnload(); | 539 web_contents->render_view_host()->FirePageBeforeUnload(); |
| 540 return false; | 540 return false; |
| 541 } | 541 } |
| 542 | 542 |
| 543 // TODO: Now that we know the tab has no unload/beforeunload listeners, | 543 // TODO: Now that we know the tab has no unload/beforeunload listeners, |
| 544 // we should be able to do a fast shutdown of the RenderViewProcess. | 544 // we should be able to do a fast shutdown of the RenderViewProcess. |
| 545 // Make sure that we actually do. | 545 // Make sure that we actually do. |
| 546 | 546 |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 603 } | 603 } |
| 604 | 604 |
| 605 // static | 605 // static |
| 606 bool TabStripModel::OpenerMatches(TabContentsData* data, | 606 bool TabStripModel::OpenerMatches(TabContentsData* data, |
| 607 NavigationController* opener, | 607 NavigationController* opener, |
| 608 bool use_group) { | 608 bool use_group) { |
| 609 return data->opener == opener || (use_group && data->group == opener); | 609 return data->opener == opener || (use_group && data->group == opener); |
| 610 } | 610 } |
| 611 | 611 |
| 612 | 612 |
| OLD | NEW |