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

Side by Side Diff: extensions/browser/extension_prefs.cc

Issue 1025613003: Fix for ERROR:url_pattern_set.cc(240)] Invalid url pattern: chrome://print/* (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Changes as per review comments. Created 5 years, 8 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
« no previous file with comments | « extensions/browser/extension_prefs.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "extensions/browser/extension_prefs.h" 5 #include "extensions/browser/extension_prefs.h"
6 6
7 #include <iterator> 7 #include <iterator>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/metrics/histogram_macros.h" 10 #include "base/metrics/histogram_macros.h"
(...skipping 525 matching lines...) Expand 10 before | Expand all | Expand 10 after
536 return GetExtensionPref(extension_id) != NULL; 536 return GetExtensionPref(extension_id) != NULL;
537 } 537 }
538 538
539 bool ExtensionPrefs::ReadPrefAsURLPatternSet(const std::string& extension_id, 539 bool ExtensionPrefs::ReadPrefAsURLPatternSet(const std::string& extension_id,
540 const std::string& pref_key, 540 const std::string& pref_key,
541 URLPatternSet* result, 541 URLPatternSet* result,
542 int valid_schemes) { 542 int valid_schemes) {
543 const base::ListValue* value = NULL; 543 const base::ListValue* value = NULL;
544 if (!ReadPrefAsList(extension_id, pref_key, &value)) 544 if (!ReadPrefAsList(extension_id, pref_key, &value))
545 return false; 545 return false;
546 const base::DictionaryValue* extension = GetExtensionPref(extension_id);
547 if (!extension)
548 return false;
549 int location;
550 if (extension->GetInteger(kPrefLocation, &location) &&
551 static_cast<Manifest::Location>(location) == Manifest::COMPONENT) {
552 valid_schemes |= URLPattern::SCHEME_CHROMEUI;
553 }
546 554
547 bool allow_file_access = AllowFileAccess(extension_id); 555 bool allow_file_access = AllowFileAccess(extension_id);
548 return result->Populate(*value, valid_schemes, allow_file_access, NULL); 556 return result->Populate(*value, valid_schemes, allow_file_access, NULL);
549 } 557 }
550 558
551 void ExtensionPrefs::SetExtensionPrefURLPatternSet( 559 void ExtensionPrefs::SetExtensionPrefURLPatternSet(
552 const std::string& extension_id, 560 const std::string& extension_id,
553 const std::string& pref_key, 561 const std::string& pref_key,
554 const URLPatternSet& new_value) { 562 const URLPatternSet& new_value) {
555 UpdateExtensionPref(extension_id, pref_key, new_value.ToValue().release()); 563 UpdateExtensionPref(extension_id, pref_key, new_value.ToValue().release());
(...skipping 1582 matching lines...) Expand 10 before | Expand all | Expand 10 after
2138 extension_pref_value_map_->RegisterExtension( 2146 extension_pref_value_map_->RegisterExtension(
2139 extension_id, install_time, is_enabled, is_incognito_enabled); 2147 extension_id, install_time, is_enabled, is_incognito_enabled);
2140 2148
2141 FOR_EACH_OBSERVER( 2149 FOR_EACH_OBSERVER(
2142 ExtensionPrefsObserver, 2150 ExtensionPrefsObserver,
2143 observer_list_, 2151 observer_list_,
2144 OnExtensionRegistered(extension_id, install_time, is_enabled)); 2152 OnExtensionRegistered(extension_id, install_time, is_enabled));
2145 } 2153 }
2146 2154
2147 } // namespace extensions 2155 } // namespace extensions
OLDNEW
« no previous file with comments | « extensions/browser/extension_prefs.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698