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

Side by Side Diff: chrome/browser/content_settings/content_settings_utils.cc

Issue 380893005: Add an option page for searching and managing resources and permissions. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 5 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) 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/content_settings/content_settings_utils.h" 5 #include "chrome/browser/content_settings/content_settings_utils.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 const char kPatternSeparator[] = ","; 57 const char kPatternSeparator[] = ",";
58 58
59 } // namespace 59 } // namespace
60 60
61 namespace content_settings { 61 namespace content_settings {
62 62
63 std::string GetTypeName(ContentSettingsType type) { 63 std::string GetTypeName(ContentSettingsType type) {
64 return std::string(kTypeNames[type]); 64 return std::string(kTypeNames[type]);
65 } 65 }
66 66
67 ContentSettingsType GetTypeFromName(const std::string& name) {
68 for (size_t type = 0; type < CONTENT_SETTINGS_NUM_TYPES; ++type) {
69 if (name == std::string(GetTypeName(ContentSettingsType(type)))) {
Bernhard Bauer 2014/07/10 08:47:42 If you want to micro-optimize this a bit, use `nam
Daniel Nishi 2014/07/10 19:00:07 Done.
70 return ContentSettingsType(type);
71 }
72 }
73 return CONTENT_SETTINGS_TYPE_DEFAULT;
Bernhard Bauer 2014/07/10 08:47:42 It might be a bit better to return a success value
Daniel Nishi 2014/07/10 19:00:07 Good point. I was thinking about maybe placing a N
74 }
75
67 std::string CreatePatternString( 76 std::string CreatePatternString(
68 const ContentSettingsPattern& item_pattern, 77 const ContentSettingsPattern& item_pattern,
69 const ContentSettingsPattern& top_level_frame_pattern) { 78 const ContentSettingsPattern& top_level_frame_pattern) {
70 return item_pattern.ToString() 79 return item_pattern.ToString()
71 + std::string(kPatternSeparator) 80 + std::string(kPatternSeparator)
72 + top_level_frame_pattern.ToString(); 81 + top_level_frame_pattern.ToString();
73 } 82 }
74 83
75 PatternPair ParsePatternString(const std::string& pattern_str) { 84 PatternPair ParsePatternString(const std::string& pattern_str) {
76 std::vector<std::string> pattern_str_list; 85 std::vector<std::string> pattern_str_list;
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 207
199 void GetRendererContentSettingRules(const HostContentSettingsMap* map, 208 void GetRendererContentSettingRules(const HostContentSettingsMap* map,
200 RendererContentSettingRules* rules) { 209 RendererContentSettingRules* rules) {
201 map->GetSettingsForOneType( 210 map->GetSettingsForOneType(
202 CONTENT_SETTINGS_TYPE_IMAGES, std::string(), &(rules->image_rules)); 211 CONTENT_SETTINGS_TYPE_IMAGES, std::string(), &(rules->image_rules));
203 map->GetSettingsForOneType( 212 map->GetSettingsForOneType(
204 CONTENT_SETTINGS_TYPE_JAVASCRIPT, std::string(), &(rules->script_rules)); 213 CONTENT_SETTINGS_TYPE_JAVASCRIPT, std::string(), &(rules->script_rules));
205 } 214 }
206 215
207 } // namespace content_settings 216 } // namespace content_settings
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698