OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/local_discovery/privet_url_fetcher.h" | 5 #include "chrome/browser/local_discovery/privet_url_fetcher.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/json/json_reader.h" | 10 #include "base/json/json_reader.h" |
(...skipping 12 matching lines...) Expand all Loading... |
23 | 23 |
24 namespace local_discovery { | 24 namespace local_discovery { |
25 | 25 |
26 namespace { | 26 namespace { |
27 | 27 |
28 typedef std::map<std::string, std::string> TokenMap; | 28 typedef std::map<std::string, std::string> TokenMap; |
29 | 29 |
30 struct TokenMapHolder { | 30 struct TokenMapHolder { |
31 public: | 31 public: |
32 static TokenMapHolder* GetInstance() { | 32 static TokenMapHolder* GetInstance() { |
33 return Singleton<TokenMapHolder>::get(); | 33 return base::Singleton<TokenMapHolder>::get(); |
34 } | 34 } |
35 | 35 |
36 TokenMap map; | 36 TokenMap map; |
37 }; | 37 }; |
38 | 38 |
39 const char kXPrivetTokenHeaderPrefix[] = "X-Privet-Token: "; | 39 const char kXPrivetTokenHeaderPrefix[] = "X-Privet-Token: "; |
40 const char kPrivetV3AuthTokenHeaderPrefix[] = "Authorization: "; | 40 const char kPrivetV3AuthTokenHeaderPrefix[] = "Authorization: "; |
41 const char kRangeHeaderFormat[] = "Range: bytes=%d-%d"; | 41 const char kRangeHeaderFormat[] = "Range: bytes=%d-%d"; |
42 const char kXPrivetEmptyToken[] = "\"\""; | 42 const char kXPrivetEmptyToken[] = "\"\""; |
43 const char kPrivetAuthTokenUnknown[] = "Unknown"; | 43 const char kPrivetAuthTokenUnknown[] = "Unknown"; |
(...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
372 } | 372 } |
373 | 373 |
374 bool PrivetURLFetcher::PrivetErrorTransient(const std::string& error) { | 374 bool PrivetURLFetcher::PrivetErrorTransient(const std::string& error) { |
375 return (error == kPrivetErrorDeviceBusy) || | 375 return (error == kPrivetErrorDeviceBusy) || |
376 (error == kPrivetV3ErrorDeviceBusy) || | 376 (error == kPrivetV3ErrorDeviceBusy) || |
377 (error == kPrivetErrorPendingUserAction) || | 377 (error == kPrivetErrorPendingUserAction) || |
378 (error == kPrivetErrorPrinterBusy); | 378 (error == kPrivetErrorPrinterBusy); |
379 } | 379 } |
380 | 380 |
381 } // namespace local_discovery | 381 } // namespace local_discovery |
OLD | NEW |