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

Side by Side Diff: chrome/browser/extensions/api/declarative/rules_registry_with_cache.cc

Issue 16915006: Convert most of extensions and some other random stuff to using the base namespace for Values. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 6 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/extensions/api/declarative/rules_registry_with_cache.h" 5 #include "chrome/browser/extensions/api/declarative/rules_registry_with_cache.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/message_loop.h" 9 #include "base/message_loop.h"
10 #include "base/metrics/histogram.h" 10 #include "base/metrics/histogram.h"
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after
325 base::Bind(&RuleStorageOnUI::CheckIfReady, GetWeakPtr())); 325 base::Bind(&RuleStorageOnUI::CheckIfReady, GetWeakPtr()));
326 } 326 }
327 327
328 void RulesRegistryWithCache::RuleStorageOnUI::WriteToStorage( 328 void RulesRegistryWithCache::RuleStorageOnUI::WriteToStorage(
329 const std::string& extension_id, 329 const std::string& extension_id,
330 scoped_ptr<base::Value> value) { 330 scoped_ptr<base::Value> value) {
331 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); 331 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
332 if (!profile_) 332 if (!profile_)
333 return; 333 return;
334 334
335 const ListValue* rules = NULL; 335 const base::ListValue* rules = NULL;
336 CHECK(value->GetAsList(&rules)); 336 CHECK(value->GetAsList(&rules));
337 bool rules_stored_previously = GetDeclarativeRulesStored(extension_id); 337 bool rules_stored_previously = GetDeclarativeRulesStored(extension_id);
338 bool store_rules = !rules->empty(); 338 bool store_rules = !rules->empty();
339 SetDeclarativeRulesStored(extension_id, store_rules); 339 SetDeclarativeRulesStored(extension_id, store_rules);
340 if (!rules_stored_previously && !store_rules) 340 if (!rules_stored_previously && !store_rules)
341 return; 341 return;
342 342
343 StateStore* store = ExtensionSystem::Get(profile_)->rules_store(); 343 StateStore* store = ExtensionSystem::Get(profile_)->rules_store();
344 if (store) 344 if (store)
345 store->SetExtensionValue(extension_id, storage_key_, value.Pass()); 345 store->SetExtensionValue(extension_id, storage_key_, value.Pass());
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
445 void RulesRegistryWithCache::RuleStorageOnUI::SetDeclarativeRulesStored( 445 void RulesRegistryWithCache::RuleStorageOnUI::SetDeclarativeRulesStored(
446 const std::string& extension_id, 446 const std::string& extension_id,
447 bool rules_stored) { 447 bool rules_stored) {
448 CHECK(profile_); 448 CHECK(profile_);
449 ExtensionScopedPrefs* extension_prefs = ExtensionPrefs::Get(profile_); 449 ExtensionScopedPrefs* extension_prefs = ExtensionPrefs::Get(profile_);
450 extension_prefs->UpdateExtensionPref( 450 extension_prefs->UpdateExtensionPref(
451 extension_id, kRulesStoredKey, new base::FundamentalValue(rules_stored)); 451 extension_id, kRulesStoredKey, new base::FundamentalValue(rules_stored));
452 } 452 }
453 453
454 } // namespace extensions 454 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698