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 "chrome/browser/tabs/tab_strip_model.h" | 5 #include "chrome/browser/tabs/tab_strip_model.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
10 #include "chrome/browser/metrics/user_metrics.h" | 10 #include "chrome/browser/metrics/user_metrics.h" |
(...skipping 497 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
508 | 508 |
509 bool TabStripModel::IsNewTabAtEndOfTabStrip(TabContents* contents) const { | 509 bool TabStripModel::IsNewTabAtEndOfTabStrip(TabContents* contents) const { |
510 return LowerCaseEqualsASCII(contents->GetURL().spec(), | 510 return LowerCaseEqualsASCII(contents->GetURL().spec(), |
511 chrome::kChromeUINewTabURL) && | 511 chrome::kChromeUINewTabURL) && |
512 contents == GetContentsAt(count() - 1) && | 512 contents == GetContentsAt(count() - 1) && |
513 contents->controller().entry_count() == 1; | 513 contents->controller().entry_count() == 1; |
514 } | 514 } |
515 | 515 |
516 bool TabStripModel::InternalCloseTabContentsAt(int index, | 516 bool TabStripModel::InternalCloseTabContentsAt(int index, |
517 bool create_historical_tab) { | 517 bool create_historical_tab) { |
518 if (!delegate_->CanCloseContentsAt(index)) | |
519 return false; | |
520 | |
521 TabContents* detached_contents = GetContentsAt(index); | 518 TabContents* detached_contents = GetContentsAt(index); |
522 | 519 |
523 if (delegate_->RunUnloadListenerBeforeClosing(detached_contents)) | 520 if (delegate_->RunUnloadListenerBeforeClosing(detached_contents)) |
524 return false; | 521 return false; |
525 | 522 |
526 // TODO: Now that we know the tab has no unload/beforeunload listeners, | 523 // TODO: Now that we know the tab has no unload/beforeunload listeners, |
527 // we should be able to do a fast shutdown of the RenderViewProcess. | 524 // we should be able to do a fast shutdown of the RenderViewProcess. |
528 // Make sure that we actually do. | 525 // Make sure that we actually do. |
529 | 526 |
530 FOR_EACH_OBSERVER(TabStripModelObserver, observers_, | 527 FOR_EACH_OBSERVER(TabStripModelObserver, observers_, |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
568 int index = GetIndexOfTabContents(contents); | 565 int index = GetIndexOfTabContents(contents); |
569 contents_data_.at(index)->opener = &opener->controller(); | 566 contents_data_.at(index)->opener = &opener->controller(); |
570 } | 567 } |
571 | 568 |
572 // static | 569 // static |
573 bool TabStripModel::OpenerMatches(const TabContentsData* data, | 570 bool TabStripModel::OpenerMatches(const TabContentsData* data, |
574 const NavigationController* opener, | 571 const NavigationController* opener, |
575 bool use_group) { | 572 bool use_group) { |
576 return data->opener == opener || (use_group && data->group == opener); | 573 return data->opener == opener || (use_group && data->group == opener); |
577 } | 574 } |
OLD | NEW |