| 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 | 12 |
| 13 namespace { | 13 namespace { |
| 14 | 14 |
| 15 const char kNoPathWildcardsError[] = | 15 const char kNoPathWildcardsError[] = |
| 16 "Path wildcards in file URL patterns are not allowed."; | 16 "Path wildcards in file URL patterns are not allowed."; |
| 17 const char kNoPathsError[] = "Specific paths are not allowed."; | 17 const char kNoPathsError[] = "Specific paths are not allowed."; |
| 18 const char kInvalidPatternError[] = "The pattern \"*\" is invalid."; | 18 const char kInvalidPatternError[] = "The pattern \"*\" is invalid."; |
| 19 | 19 |
| 20 const char* const kContentSettingsTypeNames[] = { | 20 const char* const kContentSettingsTypeNames[] = { |
| 21 "cookies", | 21 "cookies", |
| 22 "images", | 22 "images", |
| 23 "javascript", | 23 "javascript", |
| 24 "plugins", | 24 "plugins", |
| 25 "popups", | 25 "popups", |
| 26 "location", | 26 "location", |
| 27 "notifications", | 27 "notifications", |
| 28 "auto-select-certificate", | 28 "auto-select-certificate", |
| 29 "fullscreen", | 29 "fullscreen", |
| 30 "mouselock", | 30 "mouselock" |
| 31 "mixed-script", | |
| 32 "media-stream", | |
| 33 "media-stream-mic" | |
| 34 }; | 31 }; |
| 35 | 32 |
| 36 // TODO(msramek): Assert that |kContentSettingsTypeNames| is synced with | 33 // TODO(msramek): Assert that |kContentSettingsTypeNames| is synced with enum |
| 37 // enum |ContentSettingsType|. | 34 // |ContentSettingsType| and mapping in |kContentSettingsTypeGroupNames|. |
| 38 static_assert(arraysize(kContentSettingsTypeNames) <= | 35 static_assert(arraysize(kContentSettingsTypeNames) <= |
| 39 CONTENT_SETTINGS_NUM_TYPES, | 36 CONTENT_SETTINGS_NUM_TYPES, |
| 40 "kContentSettingsTypeNames has an unexpected number of elements"); | 37 "kContentSettingsTypeNames has an unexpected number of elements"); |
| 41 | 38 |
| 42 const char* const kContentSettingNames[] = { | 39 const char* const kContentSettingNames[] = { |
| 43 "default", | 40 "default", |
| 44 "allow", | 41 "allow", |
| 45 "block", | 42 "block", |
| 46 "ask", | 43 "ask", |
| 47 "session_only", | 44 "session_only", |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 } | 146 } |
| 150 | 147 |
| 151 const char* ContentSettingToString(ContentSetting setting) { | 148 const char* ContentSettingToString(ContentSetting setting) { |
| 152 size_t index = static_cast<size_t>(setting); | 149 size_t index = static_cast<size_t>(setting); |
| 153 DCHECK_LT(index, arraysize(kContentSettingNames)); | 150 DCHECK_LT(index, arraysize(kContentSettingNames)); |
| 154 return kContentSettingNames[index]; | 151 return kContentSettingNames[index]; |
| 155 } | 152 } |
| 156 | 153 |
| 157 } // namespace content_settings_helpers | 154 } // namespace content_settings_helpers |
| 158 } // namespace extensions | 155 } // namespace extensions |
| OLD | NEW |