Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/privacy_blacklist/blocked_response.h" | 5 #include "chrome/browser/privacy_blacklist/blocked_response.h" |
| 6 | 6 |
| 7 #include "app/l10n_util.h" | 7 #include "app/l10n_util.h" |
| 8 #include "app/resource_bundle.h" | 8 #include "app/resource_bundle.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
| 11 #include "base/values.h" | 11 #include "base/values.h" |
| 12 #include "chrome/browser/privacy_blacklist/blacklist.h" | 12 #include "chrome/browser/privacy_blacklist/blacklist.h" |
| 13 #include "chrome/common/jstemplate_builder.h" | 13 #include "chrome/common/jstemplate_builder.h" |
| 14 #include "chrome/common/url_constants.h" | 14 #include "chrome/common/url_constants.h" |
| 15 #include "grit/browser_resources.h" | 15 #include "grit/browser_resources.h" |
| 16 #include "grit/generated_resources.h" | 16 #include "grit/generated_resources.h" |
| 17 | 17 |
| 18 namespace { | 18 namespace { |
| 19 | 19 |
| 20 unsigned long Hash(std::set<std::string>::iterator i) { | 20 unsigned long Hash(std::set<std::string>::iterator i) { |
| 21 return (unsigned long)(i.operator->()); | 21 return (unsigned long)(i.operator->()); |
| 22 } | 22 } |
| 23 | 23 |
| 24 std::string Dehash(unsigned long l) { | 24 std::string Dehash(unsigned long l) { |
| 25 return *(std::string*)l; | 25 return *(std::string*)l; |
| 26 } | 26 } |
| 27 | 27 |
| 28 } | 28 } // namespace |
| 29 | 29 |
| 30 namespace chrome { | 30 namespace chrome { |
| 31 | 31 |
| 32 const char kUnblockScheme[] = "chrome-unblock"; | 32 const char kUnblockScheme[] = "chrome-unblock"; |
| 33 | 33 |
| 34 const char kBlockScheme[] = "chrome-block"; | 34 const char kBlockScheme[] = "chrome-block"; |
| 35 | 35 |
| 36 std::string BlockedResponse::GetHTML(const std::string& url, | 36 std::string BlockedResponse::GetHTML(const std::string& url, |
| 37 const Blacklist::Match* match) { | 37 const Blacklist::Match* match) { |
| 38 DictionaryValue strings; | 38 DictionaryValue strings; |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 94 // Read the address of the url. | 94 // Read the address of the url. |
| 95 if (sscanf(url.c_str() + sizeof(kUnblockScheme) + 2, "%lX", &l)) { | 95 if (sscanf(url.c_str() + sizeof(kUnblockScheme) + 2, "%lX", &l)) { |
| 96 std::size_t p = url.find('/', sizeof(kUnblockScheme) + 2); | 96 std::size_t p = url.find('/', sizeof(kUnblockScheme) + 2); |
| 97 if (p != std::string::npos) | 97 if (p != std::string::npos) |
| 98 return Dehash(l) + url.substr(p+1); | 98 return Dehash(l) + url.substr(p+1); |
| 99 return Dehash(l); | 99 return Dehash(l); |
| 100 } | 100 } |
| 101 return chrome::kAboutBlankURL; | 101 return chrome::kAboutBlankURL; |
| 102 } | 102 } |
| 103 | 103 |
| 104 } // end namespace chrome | 104 } // end namespace chrome |
|
brettw
2009/10/14 02:08:51
Can you fix this comment while you're at it?
| |
| OLD | NEW |