Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "webproxy_task.h" | |
| 6 | |
| 7 #include <netinet/in.h> | |
| 8 #include <sys/wait.h> | |
| 9 #include <unistd.h> | |
| 10 | |
| 11 #include "base/threading/platform_thread.h" | |
| 12 #include "chrome/browser/chromeos/net/webproxy/serv.h" | |
| 13 | |
| 14 namespace chromeos { | |
| 15 | |
| 16 void WebproxyTask::Run() { | |
| 17 const int kPort = 10101; | |
| 18 | |
| 19 // Configure allowed origins. | |
| 20 std::vector<std::string> allowed_origins; | |
| 21 allowed_origins.push_back("chrome-extension://XXXXXXXXXXXXXXXXXXXXXX"); | |
|
zel
2011/04/07 16:54:12
let's replace one of these with haiffjcadagjlijogg
Denis Lagno
2011/04/11 23:21:27
Done.
| |
| 22 allowed_origins.push_back("chrome-extension://YYYYYYYYYYYYYYYYYYYYYY"); | |
| 23 | |
| 24 struct sockaddr_in sa; | |
| 25 memset(&sa, 0, sizeof(sa)); | |
| 26 sa.sin_family = AF_INET; | |
| 27 sa.sin_port = htons(kPort); | |
| 28 sa.sin_addr.s_addr = htonl(INADDR_LOOPBACK); | |
| 29 for (int sleep_ms = 1000;;) { | |
| 30 webproxy::Serv ws( | |
| 31 allowed_origins, reinterpret_cast<sockaddr*>(&sa), sizeof(sa)); | |
| 32 ws.Run(); | |
| 33 if (sleep_ms < 100 * 1000) | |
| 34 (sleep_ms *= 3) /= 2; | |
| 35 base::PlatformThread::Sleep(sleep_ms); | |
| 36 } | |
| 37 } | |
| 38 | |
| 39 } // namespace chromeos | |
| 40 | |
| OLD | NEW |