OLD | NEW |
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/android/dev_tools_server.h" | 5 #include "chrome/browser/android/dev_tools_server.h" |
6 | 6 |
7 #include <pwd.h> | 7 #include <pwd.h> |
8 #include <cstring> | 8 #include <cstring> |
9 | 9 |
10 #include "base/android/jni_string.h" | 10 #include "base/android/jni_string.h" |
(...skipping 22 matching lines...) Expand all Loading... |
33 #include "content/public/browser/favicon_status.h" | 33 #include "content/public/browser/favicon_status.h" |
34 #include "content/public/browser/navigation_entry.h" | 34 #include "content/public/browser/navigation_entry.h" |
35 #include "content/public/browser/render_view_host.h" | 35 #include "content/public/browser/render_view_host.h" |
36 #include "content/public/browser/web_contents.h" | 36 #include "content/public/browser/web_contents.h" |
37 #include "content/public/browser/web_contents_delegate.h" | 37 #include "content/public/browser/web_contents_delegate.h" |
38 #include "content/public/common/content_switches.h" | 38 #include "content/public/common/content_switches.h" |
39 #include "content/public/common/url_constants.h" | 39 #include "content/public/common/url_constants.h" |
40 #include "content/public/common/user_agent.h" | 40 #include "content/public/common/user_agent.h" |
41 #include "grit/browser_resources.h" | 41 #include "grit/browser_resources.h" |
42 #include "jni/DevToolsServer_jni.h" | 42 #include "jni/DevToolsServer_jni.h" |
43 #include "net/socket/unix_domain_socket_posix.h" | 43 #include "net/socket/unix_domain_listen_socket_posix.h" |
44 #include "net/url_request/url_request_context_getter.h" | 44 #include "net/url_request/url_request_context_getter.h" |
45 #include "ui/base/resource/resource_bundle.h" | 45 #include "ui/base/resource/resource_bundle.h" |
46 | 46 |
47 using content::DevToolsAgentHost; | 47 using content::DevToolsAgentHost; |
48 using content::RenderViewHost; | 48 using content::RenderViewHost; |
49 using content::WebContents; | 49 using content::WebContents; |
50 | 50 |
51 namespace { | 51 namespace { |
52 | 52 |
53 // TL;DR: Do not change this string. | 53 // TL;DR: Do not change this string. |
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
359 } | 359 } |
360 | 360 |
361 callback.Run(targets); | 361 callback.Run(targets); |
362 } | 362 } |
363 | 363 |
364 virtual scoped_ptr<net::StreamListenSocket> CreateSocketForTethering( | 364 virtual scoped_ptr<net::StreamListenSocket> CreateSocketForTethering( |
365 net::StreamListenSocket::Delegate* delegate, | 365 net::StreamListenSocket::Delegate* delegate, |
366 std::string* name) OVERRIDE { | 366 std::string* name) OVERRIDE { |
367 *name = base::StringPrintf( | 367 *name = base::StringPrintf( |
368 kTetheringSocketName, getpid(), ++last_tethering_socket_); | 368 kTetheringSocketName, getpid(), ++last_tethering_socket_); |
369 return net::UnixDomainSocket::CreateAndListenWithAbstractNamespace( | 369 return net::deprecated::UnixDomainListenSocket:: |
370 *name, | 370 CreateAndListenWithAbstractNamespace( |
371 "", | 371 *name, |
372 delegate, | 372 "", |
373 base::Bind(&content::CanUserConnectToDevTools)) | 373 delegate, |
374 .PassAs<net::StreamListenSocket>(); | 374 base::Bind(&content::CanUserConnectToDevTools)) |
| 375 .PassAs<net::StreamListenSocket>(); |
375 } | 376 } |
376 | 377 |
377 private: | 378 private: |
378 static void PopulatePageThumbnails() { | 379 static void PopulatePageThumbnails() { |
379 Profile* profile = | 380 Profile* profile = |
380 ProfileManager::GetLastUsedProfile()->GetOriginalProfile(); | 381 ProfileManager::GetLastUsedProfile()->GetOriginalProfile(); |
381 history::TopSites* top_sites = profile->GetTopSites(); | 382 history::TopSites* top_sites = profile->GetTopSites(); |
382 if (top_sites) | 383 if (top_sites) |
383 top_sites->SyncWithHistory(); | 384 top_sites->SyncWithHistory(); |
384 } | 385 } |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
416 | 417 |
417 DevToolsServer::~DevToolsServer() { | 418 DevToolsServer::~DevToolsServer() { |
418 Stop(); | 419 Stop(); |
419 } | 420 } |
420 | 421 |
421 void DevToolsServer::Start() { | 422 void DevToolsServer::Start() { |
422 if (protocol_handler_) | 423 if (protocol_handler_) |
423 return; | 424 return; |
424 | 425 |
425 protocol_handler_ = content::DevToolsHttpHandler::Start( | 426 protocol_handler_ = content::DevToolsHttpHandler::Start( |
426 new net::UnixDomainSocketWithAbstractNamespaceFactory( | 427 new net::deprecated::UnixDomainListenSocketWithAbstractNamespaceFactory( |
427 socket_name_, | 428 socket_name_, |
428 base::StringPrintf("%s_%d", socket_name_.c_str(), getpid()), | 429 base::StringPrintf("%s_%d", socket_name_.c_str(), getpid()), |
429 base::Bind(&content::CanUserConnectToDevTools)), | 430 base::Bind(&content::CanUserConnectToDevTools)), |
430 base::StringPrintf(kFrontEndURL, content::GetWebKitRevision().c_str()), | 431 base::StringPrintf(kFrontEndURL, content::GetWebKitRevision().c_str()), |
431 new DevToolsServerDelegate(), | 432 new DevToolsServerDelegate(), |
432 base::FilePath()); | 433 base::FilePath()); |
433 } | 434 } |
434 | 435 |
435 void DevToolsServer::Stop() { | 436 void DevToolsServer::Stop() { |
436 if (!protocol_handler_) | 437 if (!protocol_handler_) |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
471 jobject obj, | 472 jobject obj, |
472 jlong server, | 473 jlong server, |
473 jboolean enabled) { | 474 jboolean enabled) { |
474 DevToolsServer* devtools_server = reinterpret_cast<DevToolsServer*>(server); | 475 DevToolsServer* devtools_server = reinterpret_cast<DevToolsServer*>(server); |
475 if (enabled) { | 476 if (enabled) { |
476 devtools_server->Start(); | 477 devtools_server->Start(); |
477 } else { | 478 } else { |
478 devtools_server->Stop(); | 479 devtools_server->Stop(); |
479 } | 480 } |
480 } | 481 } |
OLD | NEW |