| 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/extensions/api/content_settings/content_settings_helper
s.h" | 5 #include "chrome/browser/extensions/api/content_settings/content_settings_helper
s.h" |
| 6 | 6 |
| 7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "content/public/common/url_constants.h" | 10 #include "content/public/common/url_constants.h" |
| 11 #include "extensions/common/url_pattern.h" | 11 #include "extensions/common/url_pattern.h" |
| 12 #include "net/base/url_constants.h" |
| 12 | 13 |
| 13 namespace { | 14 namespace { |
| 14 | 15 |
| 15 const char kNoPathWildcardsError[] = | 16 const char kNoPathWildcardsError[] = |
| 16 "Path wildcards in file URL patterns are not allowed."; | 17 "Path wildcards in file URL patterns are not allowed."; |
| 17 const char kNoPathsError[] = "Specific paths are not allowed."; | 18 const char kNoPathsError[] = "Specific paths are not allowed."; |
| 18 const char kInvalidPatternError[] = "The pattern \"*\" is invalid."; | 19 const char kInvalidPatternError[] = "The pattern \"*\" is invalid."; |
| 19 | 20 |
| 20 const char* const kContentSettingsTypeNames[] = { | 21 const char* const kContentSettingsTypeNames[] = { |
| 21 "cookies", | 22 "cookies", |
| (...skipping 14 matching lines...) Expand all Loading... |
| 36 "block", | 37 "block", |
| 37 "ask", | 38 "ask", |
| 38 "session_only", | 39 "session_only", |
| 39 }; | 40 }; |
| 40 COMPILE_ASSERT(arraysize(kContentSettingNames) <= | 41 COMPILE_ASSERT(arraysize(kContentSettingNames) <= |
| 41 CONTENT_SETTING_NUM_SETTINGS, | 42 CONTENT_SETTING_NUM_SETTINGS, |
| 42 content_setting_names_size_invalid); | 43 content_setting_names_size_invalid); |
| 43 | 44 |
| 44 // TODO(bauerb): Move this someplace where it can be reused. | 45 // TODO(bauerb): Move this someplace where it can be reused. |
| 45 std::string GetDefaultPort(const std::string& scheme) { | 46 std::string GetDefaultPort(const std::string& scheme) { |
| 46 if (scheme == content::kHttpScheme) | 47 if (scheme == net::kHttpScheme) |
| 47 return "80"; | 48 return "80"; |
| 48 if (scheme == content::kHttpsScheme) | 49 if (scheme == net::kHttpsScheme) |
| 49 return "443"; | 50 return "443"; |
| 50 NOTREACHED(); | 51 NOTREACHED(); |
| 51 return std::string(); | 52 return std::string(); |
| 52 } | 53 } |
| 53 | 54 |
| 54 } // namespace | 55 } // namespace |
| 55 | 56 |
| 56 namespace extensions { | 57 namespace extensions { |
| 57 namespace content_settings_helpers { | 58 namespace content_settings_helpers { |
| 58 | 59 |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 } | 141 } |
| 141 | 142 |
| 142 const char* ContentSettingToString(ContentSetting setting) { | 143 const char* ContentSettingToString(ContentSetting setting) { |
| 143 size_t index = static_cast<size_t>(setting); | 144 size_t index = static_cast<size_t>(setting); |
| 144 DCHECK_LT(index, arraysize(kContentSettingNames)); | 145 DCHECK_LT(index, arraysize(kContentSettingNames)); |
| 145 return kContentSettingNames[index]; | 146 return kContentSettingNames[index]; |
| 146 } | 147 } |
| 147 | 148 |
| 148 } // namespace content_settings_helpers | 149 } // namespace content_settings_helpers |
| 149 } // namespace extensions | 150 } // namespace extensions |
| OLD | NEW |