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

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

Issue 440423003: Clean content_settings_pattern_parser.* from unnecessary dependencies. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 4 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 | Annotate | Revision Log
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_policy_provider.h" 5 #include "chrome/browser/content_settings/content_settings_policy_provider.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/json/json_reader.h" 10 #include "base/json/json_reader.h"
11 #include "base/prefs/pref_service.h" 11 #include "base/prefs/pref_service.h"
12 #include "base/values.h" 12 #include "base/values.h"
13 #include "chrome/browser/chrome_notification_types.h" 13 #include "chrome/browser/chrome_notification_types.h"
14 #include "chrome/browser/content_settings/content_settings_rule.h" 14 #include "chrome/browser/content_settings/content_settings_rule.h"
15 #include "chrome/browser/content_settings/content_settings_utils.h" 15 #include "chrome/browser/content_settings/content_settings_utils.h"
16 #include "chrome/common/chrome_content_settings_client.h"
16 #include "chrome/common/content_settings_pattern.h" 17 #include "chrome/common/content_settings_pattern.h"
17 #include "chrome/common/pref_names.h" 18 #include "chrome/common/pref_names.h"
18 #include "components/pref_registry/pref_registry_syncable.h" 19 #include "components/pref_registry/pref_registry_syncable.h"
19 #include "content/public/browser/browser_thread.h" 20 #include "content/public/browser/browser_thread.h"
20 #include "content/public/browser/notification_details.h" 21 #include "content/public/browser/notification_details.h"
21 #include "content/public/browser/notification_source.h" 22 #include "content/public/browser/notification_source.h"
22 23
23 using content::BrowserThread; 24 using content::BrowserThread;
24 25
25 namespace { 26 namespace {
(...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after
358 "pattern", &pattern_str); 359 "pattern", &pattern_str);
359 base::DictionaryValue* cert_filter = NULL; 360 base::DictionaryValue* cert_filter = NULL;
360 pattern_filter_pair->GetDictionaryWithoutPathExpansion("filter", 361 pattern_filter_pair->GetDictionaryWithoutPathExpansion("filter",
361 &cert_filter); 362 &cert_filter);
362 if (!pattern_read || !cert_filter) { 363 if (!pattern_read || !cert_filter) {
363 VLOG(1) << "Ignoring invalid certificate auto select setting. Reason:" 364 VLOG(1) << "Ignoring invalid certificate auto select setting. Reason:"
364 " Missing pattern or filter."; 365 " Missing pattern or filter.";
365 continue; 366 continue;
366 } 367 }
367 368
369 content_settings::ChromeContentSettingsClient client;
368 ContentSettingsPattern pattern = 370 ContentSettingsPattern pattern =
369 ContentSettingsPattern::FromString(pattern_str); 371 ContentSettingsPattern::FromString(&client, pattern_str);
370 // Ignore invalid patterns. 372 // Ignore invalid patterns.
371 if (!pattern.IsValid()) { 373 if (!pattern.IsValid()) {
372 VLOG(1) << "Ignoring invalid certificate auto select setting:" 374 VLOG(1) << "Ignoring invalid certificate auto select setting:"
373 " Invalid content settings pattern: " << pattern; 375 << " Invalid content settings pattern: " << pattern.ToString(&client);
374 continue; 376 continue;
375 } 377 }
376 378
377 // Don't pass removed values from |value|, because base::Values read with 379 // Don't pass removed values from |value|, because base::Values read with
378 // JSONReader use a shared string buffer. Instead, DeepCopy here. 380 // JSONReader use a shared string buffer. Instead, DeepCopy here.
379 value_map->SetValue(pattern, 381 value_map->SetValue(pattern,
380 ContentSettingsPattern::Wildcard(), 382 ContentSettingsPattern::Wildcard(),
381 CONTENT_SETTINGS_TYPE_AUTO_SELECT_CERTIFICATE, 383 CONTENT_SETTINGS_TYPE_AUTO_SELECT_CERTIFICATE,
382 std::string(), 384 std::string(),
383 cert_filter->DeepCopy()); 385 cert_filter->DeepCopy());
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
491 ReadManagedDefaultSettings(); 493 ReadManagedDefaultSettings();
492 } 494 }
493 495
494 NotifyObservers(ContentSettingsPattern(), 496 NotifyObservers(ContentSettingsPattern(),
495 ContentSettingsPattern(), 497 ContentSettingsPattern(),
496 CONTENT_SETTINGS_TYPE_DEFAULT, 498 CONTENT_SETTINGS_TYPE_DEFAULT,
497 std::string()); 499 std::string());
498 } 500 }
499 501
500 } // namespace content_settings 502 } // namespace content_settings
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698