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

Side by Side Diff: chrome/browser/ui/browser_list.cc

Issue 8227038: Sync Promo: Close browser tab when closing promo (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: remove old code Created 9 years, 2 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 (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 666 matching lines...) Expand 10 before | Expand all | Expand 10 after
677 it != BrowserList::end(); 677 it != BrowserList::end();
678 ++it) { 678 ++it) {
679 Browser* browser = *it; 679 Browser* browser = *it;
680 if (browser->window() && browser->window()->GetNativeHandle() == window) 680 if (browser->window() && browser->window()->GetNativeHandle() == window)
681 return browser; 681 return browser;
682 } 682 }
683 return NULL; 683 return NULL;
684 } 684 }
685 685
686 // static 686 // static
687 Browser* BrowserList::FindBrowserWithTabContents(TabContents* tab_contents) {
James Hawkins 2011/10/12 17:34:18 DCHECK(tab_contents).
sail 2011/10/12 17:54:12 Done.
688 for (TabContentsIterator it; !it.done(); ++it) {
689 TabContents* tab = it->tab_contents();
James Hawkins 2011/10/12 17:34:18 if (it->tab_contents() == tab_contents) return i
sail 2011/10/12 17:54:12 Done.
sail 2011/10/12 17:54:12 Done.
690 if (tab == tab_contents)
691 return it.browser();
692 }
693 return NULL;
694 }
695
696 // static
687 size_t BrowserList::GetBrowserCountForType(Profile* profile, 697 size_t BrowserList::GetBrowserCountForType(Profile* profile,
688 bool match_tabbed) { 698 bool match_tabbed) {
689 size_t result = 0; 699 size_t result = 0;
690 for (BrowserList::const_iterator i = BrowserList::begin(); 700 for (BrowserList::const_iterator i = BrowserList::begin();
691 i != BrowserList::end(); ++i) { 701 i != BrowserList::end(); ++i) {
692 if (BrowserMatches(*i, profile, Browser::FEATURE_NONE, 702 if (BrowserMatches(*i, profile, Browser::FEATURE_NONE,
693 match_tabbed ? kMatchTabbed : kMatchAny)) 703 match_tabbed ? kMatchTabbed : kMatchAny))
694 ++result; 704 ++result;
695 } 705 }
696 return result; 706 return result;
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
771 // If no more TabContents from Browsers, check the BackgroundPrintingManager. 781 // If no more TabContents from Browsers, check the BackgroundPrintingManager.
772 while (bg_printing_iterator_ != GetBackgroundPrintingManager()->end()) { 782 while (bg_printing_iterator_ != GetBackgroundPrintingManager()->end()) {
773 cur_ = *bg_printing_iterator_; 783 cur_ = *bg_printing_iterator_;
774 CHECK(cur_); 784 CHECK(cur_);
775 ++bg_printing_iterator_; 785 ++bg_printing_iterator_;
776 return; 786 return;
777 } 787 }
778 // Reached the end - no more TabContents. 788 // Reached the end - no more TabContents.
779 cur_ = NULL; 789 cur_ = NULL;
780 } 790 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698