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

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

Issue 1644773003: Remove BrowserIterator (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@host-desktop-1
Patch Set: . 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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_ui_bindings.h" 5 #include "chrome/browser/devtools/devtools_ui_bindings.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/json/json_reader.h" 10 #include "base/json/json_reader.h"
11 #include "base/json/json_writer.h" 11 #include "base/json/json_writer.h"
12 #include "base/macros.h" 12 #include "base/macros.h"
13 #include "base/metrics/histogram.h" 13 #include "base/metrics/histogram.h"
14 #include "base/prefs/scoped_user_pref_update.h" 14 #include "base/prefs/scoped_user_pref_update.h"
15 #include "base/strings/string_number_conversions.h" 15 #include "base/strings/string_number_conversions.h"
16 #include "base/strings/string_util.h" 16 #include "base/strings/string_util.h"
17 #include "base/strings/stringprintf.h" 17 #include "base/strings/stringprintf.h"
18 #include "base/strings/utf_string_conversions.h" 18 #include "base/strings/utf_string_conversions.h"
19 #include "base/values.h" 19 #include "base/values.h"
20 #include "build/build_config.h" 20 #include "build/build_config.h"
21 #include "chrome/browser/chrome_notification_types.h" 21 #include "chrome/browser/chrome_notification_types.h"
22 #include "chrome/browser/devtools/devtools_file_watcher.h" 22 #include "chrome/browser/devtools/devtools_file_watcher.h"
23 #include "chrome/browser/devtools/devtools_protocol.h" 23 #include "chrome/browser/devtools/devtools_protocol.h"
24 #include "chrome/browser/devtools/devtools_target_impl.h" 24 #include "chrome/browser/devtools/devtools_target_impl.h"
25 #include "chrome/browser/devtools/global_confirm_info_bar.h" 25 #include "chrome/browser/devtools/global_confirm_info_bar.h"
26 #include "chrome/browser/extensions/chrome_extension_web_contents_observer.h" 26 #include "chrome/browser/extensions/chrome_extension_web_contents_observer.h"
27 #include "chrome/browser/infobars/infobar_service.h" 27 #include "chrome/browser/infobars/infobar_service.h"
28 #include "chrome/browser/profiles/profile.h" 28 #include "chrome/browser/profiles/profile.h"
29 #include "chrome/browser/ui/browser.h" 29 #include "chrome/browser/ui/browser.h"
30 #include "chrome/browser/ui/browser_iterator.h"
31 #include "chrome/browser/ui/browser_list.h" 30 #include "chrome/browser/ui/browser_list.h"
32 #include "chrome/browser/ui/browser_window.h" 31 #include "chrome/browser/ui/browser_window.h"
33 #include "chrome/browser/ui/tabs/tab_strip_model.h" 32 #include "chrome/browser/ui/tabs/tab_strip_model.h"
34 #include "chrome/common/chrome_switches.h" 33 #include "chrome/common/chrome_switches.h"
35 #include "chrome/common/extensions/chrome_manifest_url_handlers.h" 34 #include "chrome/common/extensions/chrome_manifest_url_handlers.h"
36 #include "chrome/common/pref_names.h" 35 #include "chrome/common/pref_names.h"
37 #include "chrome/common/url_constants.h" 36 #include "chrome/common/url_constants.h"
38 #include "chrome/grit/generated_resources.h" 37 #include "chrome/grit/generated_resources.h"
39 #include "components/infobars/core/confirm_infobar_delegate.h" 38 #include "components/infobars/core/confirm_infobar_delegate.h"
40 #include "components/infobars/core/infobar.h" 39 #include "components/infobars/core/infobar.h"
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 base::DictionaryValue* CreateFileSystemValue( 98 base::DictionaryValue* CreateFileSystemValue(
100 DevToolsFileHelper::FileSystem file_system) { 99 DevToolsFileHelper::FileSystem file_system) {
101 base::DictionaryValue* file_system_value = new base::DictionaryValue(); 100 base::DictionaryValue* file_system_value = new base::DictionaryValue();
102 file_system_value->SetString("fileSystemName", file_system.file_system_name); 101 file_system_value->SetString("fileSystemName", file_system.file_system_name);
103 file_system_value->SetString("rootURL", file_system.root_url); 102 file_system_value->SetString("rootURL", file_system.root_url);
104 file_system_value->SetString("fileSystemPath", file_system.file_system_path); 103 file_system_value->SetString("fileSystemPath", file_system.file_system_path);
105 return file_system_value; 104 return file_system_value;
106 } 105 }
107 106
108 Browser* FindBrowser(content::WebContents* web_contents) { 107 Browser* FindBrowser(content::WebContents* web_contents) {
109 for (chrome::BrowserIterator it; !it.done(); it.Next()) { 108 for (auto* browser : *BrowserList::GetInstance()) {
110 int tab_index = it->tab_strip_model()->GetIndexOfWebContents( 109 int tab_index = browser->tab_strip_model()->GetIndexOfWebContents(
111 web_contents); 110 web_contents);
112 if (tab_index != TabStripModel::kNoTab) 111 if (tab_index != TabStripModel::kNoTab)
113 return *it; 112 return browser;
114 } 113 }
115 return NULL; 114 return NULL;
116 } 115 }
117 116
118 // DevToolsConfirmInfoBarDelegate --------------------------------------------- 117 // DevToolsConfirmInfoBarDelegate ---------------------------------------------
119 118
120 typedef base::Callback<void(bool)> InfoBarCallback; 119 typedef base::Callback<void(bool)> InfoBarCallback;
121 120
122 class DevToolsConfirmInfoBarDelegate : public ConfirmInfoBarDelegate { 121 class DevToolsConfirmInfoBarDelegate : public ConfirmInfoBarDelegate {
123 public: 122 public:
(...skipping 1099 matching lines...) Expand 10 before | Expand all | Expand 10 after
1223 return; 1222 return;
1224 frontend_loaded_ = true; 1223 frontend_loaded_ = true;
1225 1224
1226 // Call delegate first - it seeds importants bit of information. 1225 // Call delegate first - it seeds importants bit of information.
1227 delegate_->OnLoadCompleted(); 1226 delegate_->OnLoadCompleted();
1228 1227
1229 AddDevToolsExtensionsToClient(); 1228 AddDevToolsExtensionsToClient();
1230 if (g_web_socket_api_channel) 1229 if (g_web_socket_api_channel)
1231 g_web_socket_api_channel->AttachedToBindings(this); 1230 g_web_socket_api_channel->AttachedToBindings(this);
1232 } 1231 }
OLDNEW
« no previous file with comments | « chrome/browser/devtools/devtools_sanity_browsertest.cc ('k') | chrome/browser/devtools/devtools_window.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698