Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1214)

Side by Side Diff: chrome/browser/extensions/api/content_settings/content_settings_helpers.cc

Issue 10381097: Move content settings extension API to content_settings dir. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: fixed conflict Created 8 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/extension_content_settings_helpers.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 "chrome/common/extensions/url_pattern.h" 10 #include "chrome/common/extensions/url_pattern.h"
11 #include "content/public/common/url_constants.h" 11 #include "content/public/common/url_constants.h"
12 12
13 namespace { 13 namespace {
14 14
15 const char kNoPathWildcardsError[] = 15 const char kNoPathWildcardsError[] =
(...skipping 30 matching lines...) Expand all
46 if (scheme == chrome::kHttpScheme) 46 if (scheme == chrome::kHttpScheme)
47 return "80"; 47 return "80";
48 if (scheme == chrome::kHttpsScheme) 48 if (scheme == chrome::kHttpsScheme)
49 return "443"; 49 return "443";
50 NOTREACHED(); 50 NOTREACHED();
51 return ""; 51 return "";
52 } 52 }
53 53
54 } // namespace 54 } // namespace
55 55
56 namespace extension_content_settings_helpers { 56 namespace extensions {
57 namespace content_settings_helpers {
57 58
58 ContentSettingsPattern ParseExtensionPattern(const std::string& pattern_str, 59 ContentSettingsPattern ParseExtensionPattern(const std::string& pattern_str,
59 std::string* error) { 60 std::string* error) {
60 const int kAllowedSchemes = 61 const int kAllowedSchemes =
61 URLPattern::SCHEME_HTTP | URLPattern::SCHEME_HTTPS | 62 URLPattern::SCHEME_HTTP | URLPattern::SCHEME_HTTPS |
62 URLPattern::SCHEME_FILE; 63 URLPattern::SCHEME_FILE;
63 URLPattern url_pattern(kAllowedSchemes); 64 URLPattern url_pattern(kAllowedSchemes);
64 URLPattern::ParseResult result = url_pattern.Parse(pattern_str); 65 URLPattern::ParseResult result = url_pattern.Parse(pattern_str);
65 if (result != URLPattern::PARSE_SUCCESS) { 66 if (result != URLPattern::PARSE_SUCCESS) {
66 *error = URLPattern::GetParseResultString(result); 67 *error = URLPattern::GetParseResultString(result);
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 } 138 }
138 return false; 139 return false;
139 } 140 }
140 141
141 const char* ContentSettingToString(ContentSetting setting) { 142 const char* ContentSettingToString(ContentSetting setting) {
142 size_t index = static_cast<size_t>(setting); 143 size_t index = static_cast<size_t>(setting);
143 DCHECK_LT(index, arraysize(kContentSettingNames)); 144 DCHECK_LT(index, arraysize(kContentSettingNames));
144 return kContentSettingNames[index]; 145 return kContentSettingNames[index];
145 } 146 }
146 147
147 } // namespace extension_content_settings_helpers 148 } // namespace content_settings_helpers
149 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698