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

Unified Diff: chrome/browser/devtools/devtools_window.cc

Issue 12210063: Make devtools_window.cc multi-desktop aware. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: NOTREACHED if both browser_ and inspected_web_contents_ are NULL. Created 7 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/devtools/devtools_window.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/devtools/devtools_window.cc
diff --git a/chrome/browser/devtools/devtools_window.cc b/chrome/browser/devtools/devtools_window.cc
index 48783235d1cfe257f720d7228b43419a22283e74..1cedaea9bdc196333e08bdc181cdbaa83a5f18e0 100644
--- a/chrome/browser/devtools/devtools_window.cc
+++ b/chrome/browser/devtools/devtools_window.cc
@@ -24,9 +24,10 @@
#include "chrome/browser/themes/theme_service.h"
#include "chrome/browser/themes/theme_service_factory.h"
#include "chrome/browser/ui/browser.h"
-#include "chrome/browser/ui/browser_list.h"
+#include "chrome/browser/ui/browser_iterator.h"
#include "chrome/browser/ui/browser_list_impl.h"
#include "chrome/browser/ui/browser_window.h"
+#include "chrome/browser/ui/host_desktop.h"
#include "chrome/browser/ui/tabs/tab_strip_model.h"
#include "chrome/common/chrome_notification_types.h"
#include "chrome/common/chrome_switches.h"
@@ -415,34 +416,8 @@ bool DevToolsWindow::FindInspectedBrowserAndTabIndex(Browser** browser,
if (!inspected_web_contents_)
return false;
- bool found = FindInspectedBrowserAndTabIndexFromBrowserList(
- chrome::BrowserListImpl::GetInstance(chrome::HOST_DESKTOP_TYPE_NATIVE),
- browser,
- tab);
- // On Windows 8 we can have the desktop environment and the ASH environment
- // active concurrently. If we fail to find the inspected web contents in the
- // native browser list, then we should look in the ASH browser list.
-#if defined(OS_WIN) && defined(USE_AURA)
- if (!found) {
- found = FindInspectedBrowserAndTabIndexFromBrowserList(
- chrome::BrowserListImpl::GetInstance(chrome::HOST_DESKTOP_TYPE_ASH),
- browser,
- tab);
- }
-#endif
- return found;
-}
-
-bool DevToolsWindow::FindInspectedBrowserAndTabIndexFromBrowserList(
- chrome::BrowserListImpl* browser_list,
- Browser** browser,
- int* tab) {
- if (!inspected_web_contents_)
- return false;
-
- for (chrome::BrowserListImpl::const_iterator it = browser_list->begin();
- it != browser_list->end(); ++it) {
- int tab_index = (*it)->tab_strip_model()->GetIndexOfWebContents(
+ for (chrome::BrowserIterator it; !it.done(); it.Next()) {
+ int tab_index = it->tab_strip_model()->GetIndexOfWebContents(
inspected_web_contents_);
if (tab_index != TabStripModel::kNoTab) {
*browser = *it;
@@ -832,8 +807,20 @@ void DevToolsWindow::OpenInNewTab(const std::string& url) {
if (inspected_web_contents_) {
inspected_web_contents_->OpenURL(params);
} else {
- for (BrowserList::const_iterator it = BrowserList::begin();
- it != BrowserList::end(); ++it) {
+ chrome::HostDesktopType host_desktop_type;
pfeldman 2013/02/09 10:15:53 I am not sure I follow the code below. Note that
gab 2013/02/09 17:38:05 Right, this code does the same thing as the previo
+ if (browser_) {
+ host_desktop_type = browser_->host_desktop_type();
+ } else {
+ // There should always be a browser when there are no inspected web
+ // contents.
+ NOTREACHED();
+ host_desktop_type = chrome::GetActiveDesktop();
+ }
+
+ const chrome::BrowserListImpl* browser_list =
+ chrome::BrowserListImpl::GetInstance(host_desktop_type);
+ for (chrome::BrowserListImpl::const_iterator it = browser_list->begin();
+ it != browser_list->end(); ++it) {
if ((*it)->type() == Browser::TYPE_TABBED) {
(*it)->OpenURL(params);
break;
« no previous file with comments | « chrome/browser/devtools/devtools_window.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698