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

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

Issue 1644773003: Remove BrowserIterator (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@host-desktop-1
Patch Set: auto* Created 4 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 unified diff | Download patch
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 "chrome/browser/devtools/devtools_window.h" 5 #include "chrome/browser/devtools/devtools_window.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/json/json_reader.h" 10 #include "base/json/json_reader.h"
11 #include "base/macros.h" 11 #include "base/macros.h"
12 #include "base/metrics/histogram.h" 12 #include "base/metrics/histogram.h"
13 #include "base/prefs/scoped_user_pref_update.h" 13 #include "base/prefs/scoped_user_pref_update.h"
14 #include "base/time/time.h" 14 #include "base/time/time.h"
15 #include "base/values.h" 15 #include "base/values.h"
16 #include "chrome/browser/certificate_viewer.h" 16 #include "chrome/browser/certificate_viewer.h"
17 #include "chrome/browser/file_select_helper.h" 17 #include "chrome/browser/file_select_helper.h"
18 #include "chrome/browser/infobars/infobar_service.h" 18 #include "chrome/browser/infobars/infobar_service.h"
19 #include "chrome/browser/profiles/profile.h" 19 #include "chrome/browser/profiles/profile.h"
20 #include "chrome/browser/sessions/session_tab_helper.h" 20 #include "chrome/browser/sessions/session_tab_helper.h"
21 #include "chrome/browser/task_management/web_contents_tags.h" 21 #include "chrome/browser/task_management/web_contents_tags.h"
22 #include "chrome/browser/ui/browser.h" 22 #include "chrome/browser/ui/browser.h"
23 #include "chrome/browser/ui/browser_dialogs.h" 23 #include "chrome/browser/ui/browser_dialogs.h"
24 #include "chrome/browser/ui/browser_iterator.h"
25 #include "chrome/browser/ui/browser_list.h" 24 #include "chrome/browser/ui/browser_list.h"
26 #include "chrome/browser/ui/browser_tabstrip.h" 25 #include "chrome/browser/ui/browser_tabstrip.h"
27 #include "chrome/browser/ui/browser_window.h" 26 #include "chrome/browser/ui/browser_window.h"
28 #include "chrome/browser/ui/host_desktop.h" 27 #include "chrome/browser/ui/host_desktop.h"
29 #include "chrome/browser/ui/prefs/prefs_tab_helper.h" 28 #include "chrome/browser/ui/prefs/prefs_tab_helper.h"
30 #include "chrome/browser/ui/scoped_tabbed_browser_displayer.h" 29 #include "chrome/browser/ui/scoped_tabbed_browser_displayer.h"
31 #include "chrome/browser/ui/tabs/tab_strip_model.h" 30 #include "chrome/browser/ui/tabs/tab_strip_model.h"
32 #include "chrome/browser/ui/webui/devtools_ui.h" 31 #include "chrome/browser/ui/webui/devtools_ui.h"
33 #include "chrome/common/chrome_switches.h" 32 #include "chrome/common/chrome_switches.h"
34 #include "chrome/common/pref_names.h" 33 #include "chrome/common/pref_names.h"
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 LAZY_INSTANCE_INITIALIZER; 68 LAZY_INSTANCE_INITIALIZER;
70 69
71 static const char kKeyUpEventName[] = "keyup"; 70 static const char kKeyUpEventName[] = "keyup";
72 static const char kKeyDownEventName[] = "keydown"; 71 static const char kKeyDownEventName[] = "keydown";
73 72
74 bool FindInspectedBrowserAndTabIndex( 73 bool FindInspectedBrowserAndTabIndex(
75 WebContents* inspected_web_contents, Browser** browser, int* tab) { 74 WebContents* inspected_web_contents, Browser** browser, int* tab) {
76 if (!inspected_web_contents) 75 if (!inspected_web_contents)
77 return false; 76 return false;
78 77
79 for (chrome::BrowserIterator it; !it.done(); it.Next()) { 78 for (auto* browser_it : *BrowserList::GetInstance()) {
sky 2016/01/28 16:58:12 With the auto browser_it is rather confusing. _it
scottmg 2016/01/28 17:36:28 Done.
80 int tab_index = it->tab_strip_model()->GetIndexOfWebContents( 79 int tab_index = browser_it->tab_strip_model()->GetIndexOfWebContents(
81 inspected_web_contents); 80 inspected_web_contents);
82 if (tab_index != TabStripModel::kNoTab) { 81 if (tab_index != TabStripModel::kNoTab) {
83 *browser = *it; 82 *browser = browser_it;
84 *tab = tab_index; 83 *tab = tab_index;
85 return true; 84 return true;
86 } 85 }
87 } 86 }
88 return false; 87 return false;
89 } 88 }
90 89
91 // DevToolsToolboxDelegate ---------------------------------------------------- 90 // DevToolsToolboxDelegate ----------------------------------------------------
92 91
93 class DevToolsToolboxDelegate 92 class DevToolsToolboxDelegate
(...skipping 1188 matching lines...) Expand 10 before | Expand all | Expand 10 after
1282 bool DevToolsWindow::ReloadInspectedWebContents(bool ignore_cache) { 1281 bool DevToolsWindow::ReloadInspectedWebContents(bool ignore_cache) {
1283 // Only route reload via front-end if the agent is attached. 1282 // Only route reload via front-end if the agent is attached.
1284 WebContents* wc = GetInspectedWebContents(); 1283 WebContents* wc = GetInspectedWebContents();
1285 if (!wc || wc->GetCrashedStatus() != base::TERMINATION_STATUS_STILL_RUNNING) 1284 if (!wc || wc->GetCrashedStatus() != base::TERMINATION_STATUS_STILL_RUNNING)
1286 return false; 1285 return false;
1287 base::FundamentalValue ignore_cache_value(ignore_cache); 1286 base::FundamentalValue ignore_cache_value(ignore_cache);
1288 bindings_->CallClientFunction("DevToolsAPI.reloadInspectedPage", 1287 bindings_->CallClientFunction("DevToolsAPI.reloadInspectedPage",
1289 &ignore_cache_value, nullptr, nullptr); 1288 &ignore_cache_value, nullptr, nullptr);
1290 return true; 1289 return true;
1291 } 1290 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698