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

Side by Side Diff: content/shell/browser/shell_devtools_manager_delegate.cc

Issue 1544273002: Switch to standard integer types in content/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 12 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "content/shell/browser/shell_devtools_manager_delegate.h" 5 #include "content/shell/browser/shell_devtools_manager_delegate.h"
6 6
7 #include <stdint.h>
8
7 #include <vector> 9 #include <vector>
8 10
9 #include "base/bind.h" 11 #include "base/bind.h"
10 #include "base/command_line.h" 12 #include "base/command_line.h"
11 #include "base/files/file_path.h" 13 #include "base/files/file_path.h"
14 #include "base/macros.h"
12 #include "base/strings/string_number_conversions.h" 15 #include "base/strings/string_number_conversions.h"
13 #include "base/strings/stringprintf.h" 16 #include "base/strings/stringprintf.h"
14 #include "base/strings/utf_string_conversions.h" 17 #include "base/strings/utf_string_conversions.h"
18 #include "build/build_config.h"
15 #include "components/devtools_discovery/basic_target_descriptor.h" 19 #include "components/devtools_discovery/basic_target_descriptor.h"
16 #include "components/devtools_discovery/devtools_discovery_manager.h" 20 #include "components/devtools_discovery/devtools_discovery_manager.h"
17 #include "components/devtools_http_handler/devtools_http_handler.h" 21 #include "components/devtools_http_handler/devtools_http_handler.h"
18 #include "content/public/browser/browser_context.h" 22 #include "content/public/browser/browser_context.h"
19 #include "content/public/browser/devtools_agent_host.h" 23 #include "content/public/browser/devtools_agent_host.h"
20 #include "content/public/browser/devtools_frontend_host.h" 24 #include "content/public/browser/devtools_frontend_host.h"
21 #include "content/public/browser/favicon_status.h" 25 #include "content/public/browser/favicon_status.h"
22 #include "content/public/browser/navigation_entry.h" 26 #include "content/public/browser/navigation_entry.h"
23 #include "content/public/browser/render_view_host.h" 27 #include "content/public/browser/render_view_host.h"
24 #include "content/public/browser/web_contents.h" 28 #include "content/public/browser/web_contents.h"
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 } 75 }
72 76
73 std::string socket_name_; 77 std::string socket_name_;
74 78
75 DISALLOW_COPY_AND_ASSIGN(UnixDomainServerSocketFactory); 79 DISALLOW_COPY_AND_ASSIGN(UnixDomainServerSocketFactory);
76 }; 80 };
77 #else 81 #else
78 class TCPServerSocketFactory 82 class TCPServerSocketFactory
79 : public DevToolsHttpHandler::ServerSocketFactory { 83 : public DevToolsHttpHandler::ServerSocketFactory {
80 public: 84 public:
81 TCPServerSocketFactory(const std::string& address, uint16 port) 85 TCPServerSocketFactory(const std::string& address, uint16_t port)
82 : address_(address), port_(port) { 86 : address_(address), port_(port) {}
83 }
84 87
85 private: 88 private:
86 // DevToolsHttpHandler::ServerSocketFactory. 89 // DevToolsHttpHandler::ServerSocketFactory.
87 scoped_ptr<net::ServerSocket> CreateForHttpServer() override { 90 scoped_ptr<net::ServerSocket> CreateForHttpServer() override {
88 scoped_ptr<net::ServerSocket> socket( 91 scoped_ptr<net::ServerSocket> socket(
89 new net::TCPServerSocket(nullptr, net::NetLog::Source())); 92 new net::TCPServerSocket(nullptr, net::NetLog::Source()));
90 if (socket->ListenWithAddressAndPort(address_, port_, kBackLog) != net::OK) 93 if (socket->ListenWithAddressAndPort(address_, port_, kBackLog) != net::OK)
91 return scoped_ptr<net::ServerSocket>(); 94 return scoped_ptr<net::ServerSocket>();
92 95
93 return socket; 96 return socket;
94 } 97 }
95 98
96 std::string address_; 99 std::string address_;
97 uint16 port_; 100 uint16_t port_;
98 101
99 DISALLOW_COPY_AND_ASSIGN(TCPServerSocketFactory); 102 DISALLOW_COPY_AND_ASSIGN(TCPServerSocketFactory);
100 }; 103 };
101 #endif 104 #endif
102 105
103 scoped_ptr<DevToolsHttpHandler::ServerSocketFactory> 106 scoped_ptr<DevToolsHttpHandler::ServerSocketFactory>
104 CreateSocketFactory() { 107 CreateSocketFactory() {
105 const base::CommandLine& command_line = 108 const base::CommandLine& command_line =
106 *base::CommandLine::ForCurrentProcess(); 109 *base::CommandLine::ForCurrentProcess();
107 #if defined(OS_ANDROID) 110 #if defined(OS_ANDROID)
108 std::string socket_name = "content_shell_devtools_remote"; 111 std::string socket_name = "content_shell_devtools_remote";
109 if (command_line.HasSwitch(switches::kRemoteDebuggingSocketName)) { 112 if (command_line.HasSwitch(switches::kRemoteDebuggingSocketName)) {
110 socket_name = command_line.GetSwitchValueASCII( 113 socket_name = command_line.GetSwitchValueASCII(
111 switches::kRemoteDebuggingSocketName); 114 switches::kRemoteDebuggingSocketName);
112 } 115 }
113 return scoped_ptr<DevToolsHttpHandler::ServerSocketFactory>( 116 return scoped_ptr<DevToolsHttpHandler::ServerSocketFactory>(
114 new UnixDomainServerSocketFactory(socket_name)); 117 new UnixDomainServerSocketFactory(socket_name));
115 #else 118 #else
116 // See if the user specified a port on the command line (useful for 119 // See if the user specified a port on the command line (useful for
117 // automation). If not, use an ephemeral port by specifying 0. 120 // automation). If not, use an ephemeral port by specifying 0.
118 uint16 port = 0; 121 uint16_t port = 0;
119 if (command_line.HasSwitch(switches::kRemoteDebuggingPort)) { 122 if (command_line.HasSwitch(switches::kRemoteDebuggingPort)) {
120 int temp_port; 123 int temp_port;
121 std::string port_str = 124 std::string port_str =
122 command_line.GetSwitchValueASCII(switches::kRemoteDebuggingPort); 125 command_line.GetSwitchValueASCII(switches::kRemoteDebuggingPort);
123 if (base::StringToInt(port_str, &temp_port) && 126 if (base::StringToInt(port_str, &temp_port) &&
124 temp_port >= 0 && temp_port < 65535) { 127 temp_port >= 0 && temp_port < 65535) {
125 port = static_cast<uint16>(temp_port); 128 port = static_cast<uint16_t>(temp_port);
126 } else { 129 } else {
127 DLOG(WARNING) << "Invalid http debugger port number " << temp_port; 130 DLOG(WARNING) << "Invalid http debugger port number " << temp_port;
128 } 131 }
129 } 132 }
130 return scoped_ptr<DevToolsHttpHandler::ServerSocketFactory>( 133 return scoped_ptr<DevToolsHttpHandler::ServerSocketFactory>(
131 new TCPServerSocketFactory("127.0.0.1", port)); 134 new TCPServerSocketFactory("127.0.0.1", port));
132 #endif 135 #endif
133 } 136 }
134 137
135 scoped_ptr<devtools_discovery::DevToolsTargetDescriptor> 138 scoped_ptr<devtools_discovery::DevToolsTargetDescriptor>
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
229 ShellDevToolsManagerDelegate::~ShellDevToolsManagerDelegate() { 232 ShellDevToolsManagerDelegate::~ShellDevToolsManagerDelegate() {
230 } 233 }
231 234
232 base::DictionaryValue* ShellDevToolsManagerDelegate::HandleCommand( 235 base::DictionaryValue* ShellDevToolsManagerDelegate::HandleCommand(
233 DevToolsAgentHost* agent_host, 236 DevToolsAgentHost* agent_host,
234 base::DictionaryValue* command) { 237 base::DictionaryValue* command) {
235 return NULL; 238 return NULL;
236 } 239 }
237 240
238 } // namespace content 241 } // namespace content
OLDNEW
« no previous file with comments | « content/shell/browser/shell_devtools_manager_delegate.h ('k') | content/shell/browser/shell_download_manager_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698