OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/chromeos/web_socket_proxy.h" | 5 #include "chrome/browser/chromeos/web_socket_proxy.h" |
6 | 6 |
7 #include <stdio.h> | 7 #include <stdio.h> |
8 #include <stdlib.h> | 8 #include <stdlib.h> |
9 #include <string.h> | 9 #include <string.h> |
10 | 10 |
(...skipping 13 matching lines...) Expand all Loading... |
24 #include <sys/wait.h> | 24 #include <sys/wait.h> |
25 | 25 |
26 #include "base/base64.h" | 26 #include "base/base64.h" |
27 #include "base/basictypes.h" | 27 #include "base/basictypes.h" |
28 #include "base/logging.h" | 28 #include "base/logging.h" |
29 #include "base/md5.h" | 29 #include "base/md5.h" |
30 #include "base/memory/scoped_ptr.h" | 30 #include "base/memory/scoped_ptr.h" |
31 #include "base/string_number_conversions.h" | 31 #include "base/string_number_conversions.h" |
32 #include "base/string_util.h" | 32 #include "base/string_util.h" |
33 #include "chrome/browser/internal_auth.h" | 33 #include "chrome/browser/internal_auth.h" |
| 34 #include "chrome/common/chrome_notification_types.h" |
34 #include "content/browser/browser_thread.h" | 35 #include "content/browser/browser_thread.h" |
| 36 #include "content/common/content_notification_types.h" |
35 #include "content/common/notification_service.h" | 37 #include "content/common/notification_service.h" |
36 #include "content/common/notification_type.h" | |
37 #include "content/common/url_constants.h" | 38 #include "content/common/url_constants.h" |
38 #include "googleurl/src/gurl.h" | 39 #include "googleurl/src/gurl.h" |
39 #include "third_party/libevent/evdns.h" | 40 #include "third_party/libevent/evdns.h" |
40 #include "third_party/libevent/event.h" | 41 #include "third_party/libevent/event.h" |
41 | 42 |
42 namespace chromeos { | 43 namespace chromeos { |
43 | 44 |
44 namespace { | 45 namespace { |
45 | 46 |
46 const uint8 kCRLF[] = "\r\n"; | 47 const uint8 kCRLF[] = "\r\n"; |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 return std::string(); | 147 return std::string(); |
147 } | 148 } |
148 | 149 |
149 inline size_t strlen(const uint8* s) { | 150 inline size_t strlen(const uint8* s) { |
150 return ::strlen(reinterpret_cast<const char*>(s)); | 151 return ::strlen(reinterpret_cast<const char*>(s)); |
151 } | 152 } |
152 | 153 |
153 void SendNotification() { | 154 void SendNotification() { |
154 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 155 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
155 NotificationService::current()->Notify( | 156 NotificationService::current()->Notify( |
156 NotificationType::WEB_SOCKET_PROXY_STARTED, | 157 chrome::NOTIFICATION_WEB_SOCKET_PROXY_STARTED, |
157 NotificationService::AllSources(), NotificationService::NoDetails()); | 158 NotificationService::AllSources(), NotificationService::NoDetails()); |
158 } | 159 } |
159 | 160 |
160 class Conn; | 161 class Conn; |
161 | 162 |
162 // Websocket to TCP proxy server. | 163 // Websocket to TCP proxy server. |
163 class Serv { | 164 class Serv { |
164 public: | 165 public: |
165 Serv(const std::vector<std::string>& allowed_origins, | 166 Serv(const std::vector<std::string>& allowed_origins, |
166 struct sockaddr* addr, int addr_len); | 167 struct sockaddr* addr, int addr_len); |
(...skipping 1121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1288 void WebSocketProxy::Run() { | 1289 void WebSocketProxy::Run() { |
1289 static_cast<Serv*>(impl_)->Run(); | 1290 static_cast<Serv*>(impl_)->Run(); |
1290 } | 1291 } |
1291 | 1292 |
1292 void WebSocketProxy::Shutdown() { | 1293 void WebSocketProxy::Shutdown() { |
1293 static_cast<Serv*>(impl_)->Shutdown(); | 1294 static_cast<Serv*>(impl_)->Shutdown(); |
1294 } | 1295 } |
1295 | 1296 |
1296 } // namespace chromeos | 1297 } // namespace chromeos |
1297 | 1298 |
OLD | NEW |