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" |
11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
12 #include "base/bind.h" | 12 #include "base/bind.h" |
13 #include "base/callback.h" | 13 #include "base/callback.h" |
14 #include "base/command_line.h" | 14 #include "base/command_line.h" |
15 #include "base/compiler_specific.h" | 15 #include "base/compiler_specific.h" |
16 #include "base/files/file_path.h" | 16 #include "base/files/file_path.h" |
17 #include "base/logging.h" | 17 #include "base/logging.h" |
18 #include "base/strings/string_number_conversions.h" | 18 #include "base/strings/string_number_conversions.h" |
19 #include "base/strings/stringprintf.h" | 19 #include "base/strings/stringprintf.h" |
20 #include "base/strings/utf_string_conversions.h" | 20 #include "base/strings/utf_string_conversions.h" |
21 #include "chrome/browser/android/tab_android.h" | 21 #include "chrome/browser/android/tab_android.h" |
22 #include "chrome/browser/browser_process.h" | 22 #include "chrome/browser/browser_process.h" |
23 #include "chrome/browser/history/top_sites.h" | 23 #include "chrome/browser/history/top_sites.h" |
| 24 #include "chrome/browser/history/top_sites_service_factory.h" |
24 #include "chrome/browser/profiles/profile_manager.h" | 25 #include "chrome/browser/profiles/profile_manager.h" |
25 #include "chrome/browser/ui/android/tab_model/tab_model.h" | 26 #include "chrome/browser/ui/android/tab_model/tab_model.h" |
26 #include "chrome/browser/ui/android/tab_model/tab_model_list.h" | 27 #include "chrome/browser/ui/android/tab_model/tab_model_list.h" |
27 #include "content/public/browser/android/devtools_auth.h" | 28 #include "content/public/browser/android/devtools_auth.h" |
28 #include "content/public/browser/browser_thread.h" | 29 #include "content/public/browser/browser_thread.h" |
29 #include "content/public/browser/devtools_agent_host.h" | 30 #include "content/public/browser/devtools_agent_host.h" |
30 #include "content/public/browser/devtools_http_handler.h" | 31 #include "content/public/browser/devtools_http_handler.h" |
31 #include "content/public/browser/devtools_http_handler_delegate.h" | 32 #include "content/public/browser/devtools_http_handler_delegate.h" |
32 #include "content/public/browser/devtools_target.h" | 33 #include "content/public/browser/devtools_target.h" |
33 #include "content/public/browser/favicon_status.h" | 34 #include "content/public/browser/favicon_status.h" |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 if (socket->ListenWithAddressAndPort(*name, 0, kBackLog) != net::OK) | 117 if (socket->ListenWithAddressAndPort(*name, 0, kBackLog) != net::OK) |
117 return scoped_ptr<net::ServerSocket>(); | 118 return scoped_ptr<net::ServerSocket>(); |
118 | 119 |
119 return socket.Pass(); | 120 return socket.Pass(); |
120 } | 121 } |
121 | 122 |
122 private: | 123 private: |
123 static void PopulatePageThumbnails() { | 124 static void PopulatePageThumbnails() { |
124 Profile* profile = | 125 Profile* profile = |
125 ProfileManager::GetLastUsedProfile()->GetOriginalProfile(); | 126 ProfileManager::GetLastUsedProfile()->GetOriginalProfile(); |
126 history::TopSites* top_sites = profile->GetTopSites(); | 127 scoped_refptr<history::TopSites> top_sites = |
127 if (top_sites) | 128 TopSitesServiceFactory::GetForProfile(profile); |
| 129 if (top_sites.get()) |
128 top_sites->SyncWithHistory(); | 130 top_sites->SyncWithHistory(); |
129 } | 131 } |
130 | 132 |
131 int last_tethering_socket_; | 133 int last_tethering_socket_; |
132 const net::UnixDomainServerSocket::AuthCallback auth_callback_; | 134 const net::UnixDomainServerSocket::AuthCallback auth_callback_; |
133 | 135 |
134 DISALLOW_COPY_AND_ASSIGN(DevToolsServerDelegate); | 136 DISALLOW_COPY_AND_ASSIGN(DevToolsServerDelegate); |
135 }; | 137 }; |
136 | 138 |
137 // Factory for UnixDomainServerSocket. It tries a fallback socket when | 139 // Factory for UnixDomainServerSocket. It tries a fallback socket when |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
246 jlong server, | 248 jlong server, |
247 jboolean enabled, | 249 jboolean enabled, |
248 jboolean allow_debug_permission) { | 250 jboolean allow_debug_permission) { |
249 DevToolsServer* devtools_server = reinterpret_cast<DevToolsServer*>(server); | 251 DevToolsServer* devtools_server = reinterpret_cast<DevToolsServer*>(server); |
250 if (enabled) { | 252 if (enabled) { |
251 devtools_server->Start(allow_debug_permission); | 253 devtools_server->Start(allow_debug_permission); |
252 } else { | 254 } else { |
253 devtools_server->Stop(); | 255 devtools_server->Stop(); |
254 } | 256 } |
255 } | 257 } |
OLD | NEW |