| OLD | NEW |
| 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 | 8 |
| 9 #include <memory> |
| 9 #include <utility> | 10 #include <utility> |
| 10 | 11 |
| 11 #include "base/base64.h" | 12 #include "base/base64.h" |
| 12 #include "base/json/json_reader.h" | 13 #include "base/json/json_reader.h" |
| 13 #include "base/json/json_writer.h" | 14 #include "base/json/json_writer.h" |
| 14 #include "base/json/string_escape.h" | 15 #include "base/json/string_escape.h" |
| 15 #include "base/macros.h" | 16 #include "base/macros.h" |
| 17 #include "base/memory/ptr_util.h" |
| 16 #include "base/metrics/histogram_macros.h" | 18 #include "base/metrics/histogram_macros.h" |
| 17 #include "base/strings/string_number_conversions.h" | 19 #include "base/strings/string_number_conversions.h" |
| 18 #include "base/strings/string_util.h" | 20 #include "base/strings/string_util.h" |
| 19 #include "base/strings/stringprintf.h" | 21 #include "base/strings/stringprintf.h" |
| 20 #include "base/strings/utf_string_conversions.h" | 22 #include "base/strings/utf_string_conversions.h" |
| 21 #include "base/values.h" | 23 #include "base/values.h" |
| 22 #include "build/build_config.h" | 24 #include "build/build_config.h" |
| 23 #include "chrome/browser/chrome_notification_types.h" | 25 #include "chrome/browser/chrome_notification_types.h" |
| 24 #include "chrome/browser/devtools/devtools_file_watcher.h" | 26 #include "chrome/browser/devtools/devtools_file_watcher.h" |
| 25 #include "chrome/browser/devtools/devtools_protocol.h" | 27 #include "chrome/browser/devtools/devtools_protocol.h" |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 static const char kRemotePageActionClose[] = "close"; | 93 static const char kRemotePageActionClose[] = "close"; |
| 92 | 94 |
| 93 // This constant should be in sync with | 95 // This constant should be in sync with |
| 94 // the constant at shell_devtools_frontend.cc. | 96 // the constant at shell_devtools_frontend.cc. |
| 95 const size_t kMaxMessageChunkSize = IPC::Channel::kMaximumMessageSize / 4; | 97 const size_t kMaxMessageChunkSize = IPC::Channel::kMaximumMessageSize / 4; |
| 96 | 98 |
| 97 typedef std::vector<DevToolsUIBindings*> DevToolsUIBindingsList; | 99 typedef std::vector<DevToolsUIBindings*> DevToolsUIBindingsList; |
| 98 base::LazyInstance<DevToolsUIBindingsList>::Leaky g_instances = | 100 base::LazyInstance<DevToolsUIBindingsList>::Leaky g_instances = |
| 99 LAZY_INSTANCE_INITIALIZER; | 101 LAZY_INSTANCE_INITIALIZER; |
| 100 | 102 |
| 101 base::DictionaryValue* CreateFileSystemValue( | 103 std::unique_ptr<base::DictionaryValue> CreateFileSystemValue( |
| 102 DevToolsFileHelper::FileSystem file_system) { | 104 DevToolsFileHelper::FileSystem file_system) { |
| 103 base::DictionaryValue* file_system_value = new base::DictionaryValue(); | 105 auto file_system_value = base::MakeUnique<base::DictionaryValue>(); |
| 104 file_system_value->SetString("fileSystemName", file_system.file_system_name); | 106 file_system_value->SetString("fileSystemName", file_system.file_system_name); |
| 105 file_system_value->SetString("rootURL", file_system.root_url); | 107 file_system_value->SetString("rootURL", file_system.root_url); |
| 106 file_system_value->SetString("fileSystemPath", file_system.file_system_path); | 108 file_system_value->SetString("fileSystemPath", file_system.file_system_path); |
| 107 return file_system_value; | 109 return file_system_value; |
| 108 } | 110 } |
| 109 | 111 |
| 110 Browser* FindBrowser(content::WebContents* web_contents) { | 112 Browser* FindBrowser(content::WebContents* web_contents) { |
| 111 for (auto* browser : *BrowserList::GetInstance()) { | 113 for (auto* browser : *BrowserList::GetInstance()) { |
| 112 int tab_index = browser->tab_strip_model()->GetIndexOfWebContents( | 114 int tab_index = browser->tab_strip_model()->GetIndexOfWebContents( |
| 113 web_contents); | 115 web_contents); |
| (...skipping 1033 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1147 void DevToolsUIBindings::FrontendLoaded() { | 1149 void DevToolsUIBindings::FrontendLoaded() { |
| 1148 if (frontend_loaded_) | 1150 if (frontend_loaded_) |
| 1149 return; | 1151 return; |
| 1150 frontend_loaded_ = true; | 1152 frontend_loaded_ = true; |
| 1151 | 1153 |
| 1152 // Call delegate first - it seeds importants bit of information. | 1154 // Call delegate first - it seeds importants bit of information. |
| 1153 delegate_->OnLoadCompleted(); | 1155 delegate_->OnLoadCompleted(); |
| 1154 | 1156 |
| 1155 AddDevToolsExtensionsToClient(); | 1157 AddDevToolsExtensionsToClient(); |
| 1156 } | 1158 } |
| OLD | NEW |