| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_list.h" | 5 #include "chrome/browser/ui/browser_list.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
| 9 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
| 10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
| (...skipping 672 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 683 it != BrowserList::end(); | 683 it != BrowserList::end(); |
| 684 ++it) { | 684 ++it) { |
| 685 Browser* browser = *it; | 685 Browser* browser = *it; |
| 686 if (browser->window() && browser->window()->GetNativeHandle() == window) | 686 if (browser->window() && browser->window()->GetNativeHandle() == window) |
| 687 return browser; | 687 return browser; |
| 688 } | 688 } |
| 689 return NULL; | 689 return NULL; |
| 690 } | 690 } |
| 691 | 691 |
| 692 // static | 692 // static |
| 693 Browser* BrowserList::FindBrowserWithTabContents(TabContents* tab_contents) { |
| 694 DCHECK(tab_contents); |
| 695 for (TabContentsIterator it; !it.done(); ++it) { |
| 696 if (it->tab_contents() == tab_contents) |
| 697 return it.browser(); |
| 698 } |
| 699 return NULL; |
| 700 } |
| 701 |
| 702 // static |
| 693 size_t BrowserList::GetBrowserCountForType(Profile* profile, | 703 size_t BrowserList::GetBrowserCountForType(Profile* profile, |
| 694 bool match_tabbed) { | 704 bool match_tabbed) { |
| 695 size_t result = 0; | 705 size_t result = 0; |
| 696 for (BrowserList::const_iterator i = BrowserList::begin(); | 706 for (BrowserList::const_iterator i = BrowserList::begin(); |
| 697 i != BrowserList::end(); ++i) { | 707 i != BrowserList::end(); ++i) { |
| 698 if (BrowserMatches(*i, profile, Browser::FEATURE_NONE, | 708 if (BrowserMatches(*i, profile, Browser::FEATURE_NONE, |
| 699 match_tabbed ? kMatchTabbed : kMatchAny)) | 709 match_tabbed ? kMatchTabbed : kMatchAny)) |
| 700 ++result; | 710 ++result; |
| 701 } | 711 } |
| 702 return result; | 712 return result; |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 777 // If no more TabContents from Browsers, check the BackgroundPrintingManager. | 787 // If no more TabContents from Browsers, check the BackgroundPrintingManager. |
| 778 while (bg_printing_iterator_ != GetBackgroundPrintingManager()->end()) { | 788 while (bg_printing_iterator_ != GetBackgroundPrintingManager()->end()) { |
| 779 cur_ = *bg_printing_iterator_; | 789 cur_ = *bg_printing_iterator_; |
| 780 CHECK(cur_); | 790 CHECK(cur_); |
| 781 ++bg_printing_iterator_; | 791 ++bg_printing_iterator_; |
| 782 return; | 792 return; |
| 783 } | 793 } |
| 784 // Reached the end - no more TabContents. | 794 // Reached the end - no more TabContents. |
| 785 cur_ = NULL; | 795 cur_ = NULL; |
| 786 } | 796 } |
| OLD | NEW |