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

Side by Side Diff: chrome/browser/debugger/devtools_window.cc

Issue 11519012: Ensure that the Inspect Element operation when performed on Windows 8 Metro ASH opens a docked dev … (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years 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
« no previous file with comments | « chrome/browser/debugger/devtools_window.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 <algorithm> 5 #include <algorithm>
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/json/json_writer.h" 8 #include "base/json/json_writer.h"
9 #include "base/lazy_instance.h" 9 #include "base/lazy_instance.h"
10 #include "base/string_number_conversions.h" 10 #include "base/string_number_conversions.h"
11 #include "base/stringprintf.h" 11 #include "base/stringprintf.h"
12 #include "base/utf_string_conversions.h" 12 #include "base/utf_string_conversions.h"
13 #include "base/values.h" 13 #include "base/values.h"
14 #include "chrome/browser/browser_process.h" 14 #include "chrome/browser/browser_process.h"
15 #include "chrome/browser/debugger/devtools_window.h" 15 #include "chrome/browser/debugger/devtools_window.h"
16 #include "chrome/browser/extensions/api/debugger/debugger_api.h" 16 #include "chrome/browser/extensions/api/debugger/debugger_api.h"
17 #include "chrome/browser/extensions/extension_service.h" 17 #include "chrome/browser/extensions/extension_service.h"
18 #include "chrome/browser/extensions/extension_system.h" 18 #include "chrome/browser/extensions/extension_system.h"
19 #include "chrome/browser/file_select_helper.h" 19 #include "chrome/browser/file_select_helper.h"
20 #include "chrome/browser/prefs/pref_service.h" 20 #include "chrome/browser/prefs/pref_service.h"
21 #include "chrome/browser/prefs/scoped_user_pref_update.h" 21 #include "chrome/browser/prefs/scoped_user_pref_update.h"
22 #include "chrome/browser/profiles/profile.h" 22 #include "chrome/browser/profiles/profile.h"
23 #include "chrome/browser/sessions/session_tab_helper.h" 23 #include "chrome/browser/sessions/session_tab_helper.h"
24 #include "chrome/browser/themes/theme_service.h" 24 #include "chrome/browser/themes/theme_service.h"
25 #include "chrome/browser/themes/theme_service_factory.h" 25 #include "chrome/browser/themes/theme_service_factory.h"
26 #include "chrome/browser/ui/browser.h" 26 #include "chrome/browser/ui/browser.h"
27 #include "chrome/browser/ui/browser_list.h" 27 #include "chrome/browser/ui/browser_list.h"
28 #include "chrome/browser/ui/browser_list_impl.h"
28 #include "chrome/browser/ui/browser_window.h" 29 #include "chrome/browser/ui/browser_window.h"
29 #include "chrome/browser/ui/tabs/tab_strip_model.h" 30 #include "chrome/browser/ui/tabs/tab_strip_model.h"
30 #include "chrome/common/chrome_notification_types.h" 31 #include "chrome/common/chrome_notification_types.h"
31 #include "chrome/common/chrome_switches.h" 32 #include "chrome/common/chrome_switches.h"
32 #include "chrome/common/pref_names.h" 33 #include "chrome/common/pref_names.h"
33 #include "chrome/common/render_messages.h" 34 #include "chrome/common/render_messages.h"
34 #include "chrome/common/url_constants.h" 35 #include "chrome/common/url_constants.h"
35 #include "content/public/browser/content_browser_client.h" 36 #include "content/public/browser/content_browser_client.h"
36 #include "content/public/browser/devtools_agent_host_registry.h" 37 #include "content/public/browser/devtools_agent_host_registry.h"
37 #include "content/public/browser/devtools_manager.h" 38 #include "content/public/browser/devtools_manager.h"
(...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after
396 browser_->tab_strip_model()->AddWebContents( 397 browser_->tab_strip_model()->AddWebContents(
397 web_contents_, -1, content::PAGE_TRANSITION_AUTO_TOPLEVEL, 398 web_contents_, -1, content::PAGE_TRANSITION_AUTO_TOPLEVEL,
398 TabStripModel::ADD_ACTIVE); 399 TabStripModel::ADD_ACTIVE);
399 } 400 }
400 401
401 bool DevToolsWindow::FindInspectedBrowserAndTabIndex(Browser** browser, 402 bool DevToolsWindow::FindInspectedBrowserAndTabIndex(Browser** browser,
402 int* tab) { 403 int* tab) {
403 if (!inspected_web_contents_) 404 if (!inspected_web_contents_)
404 return false; 405 return false;
405 406
406 for (BrowserList::const_iterator it = BrowserList::begin(); 407 bool found = FindInspectedBrowserAndTabIndexFromBrowserList(
407 it != BrowserList::end(); ++it) { 408 chrome::BrowserListImpl::GetInstance(chrome::HOST_DESKTOP_TYPE_NATIVE),
409 browser,
410 tab);
411 // On Windows 8 we can have the desktop environment and the ASH environment
412 // active concurrently. If we fail to find the inspected web contents in the
413 // native browser list, then we should look in the ASH browser list.
414 #if defined(OS_WIN) && defined(USE_AURA)
415 if (!found) {
416 found = FindInspectedBrowserAndTabIndexFromBrowserList(
417 chrome::BrowserListImpl::GetInstance(chrome::HOST_DESKTOP_TYPE_ASH),
418 browser,
419 tab);
420 }
421 #endif
422 return found;
423 }
424
425 bool DevToolsWindow::FindInspectedBrowserAndTabIndexFromBrowserList(
426 chrome::BrowserListImpl* browser_list,
427 Browser** browser,
428 int* tab) {
429 if (!inspected_web_contents_)
430 return false;
431
432 for (chrome::BrowserListImpl::const_iterator it = browser_list->begin();
433 it != browser_list->end(); ++it) {
408 int tab_index = (*it)->tab_strip_model()->GetIndexOfWebContents( 434 int tab_index = (*it)->tab_strip_model()->GetIndexOfWebContents(
409 inspected_web_contents_); 435 inspected_web_contents_);
410 if (tab_index != TabStripModel::kNoTab) { 436 if (tab_index != TabStripModel::kNoTab) {
411 *browser = *it; 437 *browser = *it;
412 *tab = tab_index; 438 *tab = tab_index;
413 return true; 439 return true;
414 } 440 }
415 } 441 }
416 return false; 442 return false;
417 } 443 }
(...skipping 461 matching lines...) Expand 10 before | Expand all | Expand 10 after
879 905
880 // static 906 // static
881 DevToolsDockSide DevToolsWindow::SideFromString( 907 DevToolsDockSide DevToolsWindow::SideFromString(
882 const std::string& dock_side) { 908 const std::string& dock_side) {
883 if (dock_side == kDockSideRight) 909 if (dock_side == kDockSideRight)
884 return DEVTOOLS_DOCK_SIDE_RIGHT; 910 return DEVTOOLS_DOCK_SIDE_RIGHT;
885 if (dock_side == kDockSideBottom) 911 if (dock_side == kDockSideBottom)
886 return DEVTOOLS_DOCK_SIDE_BOTTOM; 912 return DEVTOOLS_DOCK_SIDE_BOTTOM;
887 return DEVTOOLS_DOCK_SIDE_UNDOCKED; 913 return DEVTOOLS_DOCK_SIDE_UNDOCKED;
888 } 914 }
OLDNEW
« no previous file with comments | « chrome/browser/debugger/devtools_window.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698