Chromium Code Reviews| 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", | |
| 29 "fullscreen", | |
| 30 "mouselock" | |
| 28 }; | 31 }; |
| 29 static_assert(arraysize(kContentSettingsTypeNames) <= | 32 static_assert(arraysize(kContentSettingsTypeNames) <= |
| 30 CONTENT_SETTINGS_NUM_TYPES, | 33 CONTENT_SETTINGS_NUM_TYPES, |
|
Mike West
2015/01/23 11:23:46
Please add a TODO here to come up with a clever wa
msramek
2015/01/23 12:28:46
Done.
| |
| 31 "kContentSettingsTypeNames has an unexpected number of elements"); | 34 "kContentSettingsTypeNames has an unexpected number of elements"); |
| 32 | 35 |
| 33 const char* const kContentSettingNames[] = { | 36 const char* const kContentSettingNames[] = { |
| 34 "default", | 37 "default", |
| 35 "allow", | 38 "allow", |
| 36 "block", | 39 "block", |
| 37 "ask", | 40 "ask", |
| 38 "session_only", | 41 "session_only", |
| 39 }; | 42 }; |
| 40 static_assert(arraysize(kContentSettingNames) <= | 43 static_assert(arraysize(kContentSettingNames) <= |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 140 } | 143 } |
| 141 | 144 |
| 142 const char* ContentSettingToString(ContentSetting setting) { | 145 const char* ContentSettingToString(ContentSetting setting) { |
| 143 size_t index = static_cast<size_t>(setting); | 146 size_t index = static_cast<size_t>(setting); |
| 144 DCHECK_LT(index, arraysize(kContentSettingNames)); | 147 DCHECK_LT(index, arraysize(kContentSettingNames)); |
| 145 return kContentSettingNames[index]; | 148 return kContentSettingNames[index]; |
| 146 } | 149 } |
| 147 | 150 |
| 148 } // namespace content_settings_helpers | 151 } // namespace content_settings_helpers |
| 149 } // namespace extensions | 152 } // namespace extensions |
| OLD | NEW |