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 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 } | 96 } |
97 | 97 |
98 virtual TargetType GetTargetType(content::RenderViewHost*) OVERRIDE { | 98 virtual TargetType GetTargetType(content::RenderViewHost*) OVERRIDE { |
99 return kTargetTypeTab; | 99 return kTargetTypeTab; |
100 } | 100 } |
101 | 101 |
102 virtual std::string GetViewDescription(content::RenderViewHost*) OVERRIDE { | 102 virtual std::string GetViewDescription(content::RenderViewHost*) OVERRIDE { |
103 return ""; | 103 return ""; |
104 } | 104 } |
105 | 105 |
106 virtual scoped_refptr<net::StreamListenSocket> CreateSocketForTethering( | 106 virtual scoped_ptr<net::StreamListenSocket> CreateSocketForTethering( |
107 net::StreamListenSocket::Delegate* delegate, | 107 net::StreamListenSocket::Delegate* delegate, |
108 std::string* name) OVERRIDE { | 108 std::string* name) OVERRIDE { |
109 *name = base::StringPrintf( | 109 *name = base::StringPrintf( |
110 kTetheringSocketName, getpid(), ++last_tethering_socket_); | 110 kTetheringSocketName, getpid(), ++last_tethering_socket_); |
111 return net::UnixDomainSocket::CreateAndListenWithAbstractNamespace( | 111 return net::UnixDomainSocket::CreateAndListenWithAbstractNamespace( |
112 *name, | 112 *name, |
113 "", | 113 "", |
114 delegate, | 114 delegate, |
115 base::Bind(&content::CanUserConnectToDevTools)); | 115 base::Bind(&content::CanUserConnectToDevTools)) |
| 116 .PassAs<net::StreamListenSocket>(); |
116 } | 117 } |
117 | 118 |
118 private: | 119 private: |
119 static void PopulatePageThumbnails() { | 120 static void PopulatePageThumbnails() { |
120 Profile* profile = | 121 Profile* profile = |
121 ProfileManager::GetLastUsedProfile()->GetOriginalProfile(); | 122 ProfileManager::GetLastUsedProfile()->GetOriginalProfile(); |
122 history::TopSites* top_sites = profile->GetTopSites(); | 123 history::TopSites* top_sites = profile->GetTopSites(); |
123 if (top_sites) | 124 if (top_sites) |
124 top_sites->SyncWithHistory(); | 125 top_sites->SyncWithHistory(); |
125 } | 126 } |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
206 jobject obj, | 207 jobject obj, |
207 jint server, | 208 jint server, |
208 jboolean enabled) { | 209 jboolean enabled) { |
209 DevToolsServer* devtools_server = reinterpret_cast<DevToolsServer*>(server); | 210 DevToolsServer* devtools_server = reinterpret_cast<DevToolsServer*>(server); |
210 if (enabled) { | 211 if (enabled) { |
211 devtools_server->Start(); | 212 devtools_server->Start(); |
212 } else { | 213 } else { |
213 devtools_server->Stop(); | 214 devtools_server->Stop(); |
214 } | 215 } |
215 } | 216 } |
OLD | NEW |