| 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/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
| 10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 #include "chrome/browser/chromeos/boot_times_loader.h" | 37 #include "chrome/browser/chromeos/boot_times_loader.h" |
| 38 #include "chrome/browser/chromeos/dbus/dbus_thread_manager.h" | 38 #include "chrome/browser/chromeos/dbus/dbus_thread_manager.h" |
| 39 #include "chrome/browser/chromeos/dbus/session_manager_client.h" | 39 #include "chrome/browser/chromeos/dbus/session_manager_client.h" |
| 40 #include "chrome/browser/chromeos/dbus/update_engine_client.h" | 40 #include "chrome/browser/chromeos/dbus/update_engine_client.h" |
| 41 #include "chrome/browser/chromeos/system/runtime_environment.h" | 41 #include "chrome/browser/chromeos/system/runtime_environment.h" |
| 42 #if defined(TOOLKIT_USES_GTK) | 42 #if defined(TOOLKIT_USES_GTK) |
| 43 #include "chrome/browser/chromeos/legacy_window_manager/wm_ipc.h" | 43 #include "chrome/browser/chromeos/legacy_window_manager/wm_ipc.h" |
| 44 #endif | 44 #endif |
| 45 #endif | 45 #endif |
| 46 | 46 |
| 47 using content::WebContents; |
| 48 |
| 47 namespace { | 49 namespace { |
| 48 | 50 |
| 49 // This object is instantiated when the first Browser object is added to the | 51 // This object is instantiated when the first Browser object is added to the |
| 50 // list and delete when the last one is removed. It watches for loads and | 52 // list and delete when the last one is removed. It watches for loads and |
| 51 // creates histograms of some global object counts. | 53 // creates histograms of some global object counts. |
| 52 class BrowserActivityObserver : public content::NotificationObserver { | 54 class BrowserActivityObserver : public content::NotificationObserver { |
| 53 public: | 55 public: |
| 54 BrowserActivityObserver() { | 56 BrowserActivityObserver() { |
| 55 registrar_.Add(this, content::NOTIFICATION_NAV_ENTRY_COMMITTED, | 57 registrar_.Add(this, content::NOTIFICATION_NAV_ENTRY_COMMITTED, |
| 56 content::NotificationService::AllSources()); | 58 content::NotificationService::AllSources()); |
| (...skipping 689 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 746 it != BrowserList::end(); | 748 it != BrowserList::end(); |
| 747 ++it) { | 749 ++it) { |
| 748 Browser* browser = *it; | 750 Browser* browser = *it; |
| 749 if (browser->window() && browser->window()->GetNativeHandle() == window) | 751 if (browser->window() && browser->window()->GetNativeHandle() == window) |
| 750 return browser; | 752 return browser; |
| 751 } | 753 } |
| 752 return NULL; | 754 return NULL; |
| 753 } | 755 } |
| 754 | 756 |
| 755 // static | 757 // static |
| 756 Browser* BrowserList::FindBrowserWithTabContents(TabContents* tab_contents) { | 758 Browser* BrowserList::FindBrowserWithWebContents(WebContents* web_contents) { |
| 757 DCHECK(tab_contents); | 759 DCHECK(web_contents); |
| 758 for (TabContentsIterator it; !it.done(); ++it) { | 760 for (TabContentsIterator it; !it.done(); ++it) { |
| 759 if (it->tab_contents() == tab_contents) | 761 if (it->web_contents() == web_contents) |
| 760 return it.browser(); | 762 return it.browser(); |
| 761 } | 763 } |
| 762 return NULL; | 764 return NULL; |
| 763 } | 765 } |
| 764 | 766 |
| 765 // static | 767 // static |
| 766 BrowserList::const_reverse_iterator BrowserList::begin_last_active() { | 768 BrowserList::const_reverse_iterator BrowserList::begin_last_active() { |
| 767 return last_active_browsers().rbegin(); | 769 return last_active_browsers().rbegin(); |
| 768 } | 770 } |
| 769 | 771 |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 860 // If no more TabContents from Browsers, check the BackgroundPrintingManager. | 862 // If no more TabContents from Browsers, check the BackgroundPrintingManager. |
| 861 while (bg_printing_iterator_ != GetBackgroundPrintingManager()->end()) { | 863 while (bg_printing_iterator_ != GetBackgroundPrintingManager()->end()) { |
| 862 cur_ = *bg_printing_iterator_; | 864 cur_ = *bg_printing_iterator_; |
| 863 CHECK(cur_); | 865 CHECK(cur_); |
| 864 ++bg_printing_iterator_; | 866 ++bg_printing_iterator_; |
| 865 return; | 867 return; |
| 866 } | 868 } |
| 867 // Reached the end - no more TabContents. | 869 // Reached the end - no more TabContents. |
| 868 cur_ = NULL; | 870 cur_ = NULL; |
| 869 } | 871 } |
| OLD | NEW |