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

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

Issue 25366003: Moved some functions off ExtensionService into a new file extension_util. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Compile failures Created 7 years, 2 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/message_loop.h" 9 #include "base/message_loop/message_loop.h"
10 #include "base/metrics/histogram.h" 10 #include "base/metrics/histogram.h"
11 #include "base/strings/stringprintf.h" 11 #include "base/strings/stringprintf.h"
12 #include "base/time/time.h" 12 #include "base/time/time.h"
13 #include "base/values.h" 13 #include "base/values.h"
14 #include "chrome/browser/chrome_notification_types.h" 14 #include "chrome/browser/chrome_notification_types.h"
15 #include "chrome/browser/extensions/extension_info_map.h" 15 #include "chrome/browser/extensions/extension_info_map.h"
16 #include "chrome/browser/extensions/extension_prefs.h" 16 #include "chrome/browser/extensions/extension_prefs.h"
17 #include "chrome/browser/extensions/extension_service.h" 17 #include "chrome/browser/extensions/extension_service.h"
18 #include "chrome/browser/extensions/extension_system.h" 18 #include "chrome/browser/extensions/extension_system.h"
19 #include "chrome/browser/extensions/extension_util.h"
19 #include "chrome/browser/extensions/state_store.h" 20 #include "chrome/browser/extensions/state_store.h"
20 #include "chrome/browser/profiles/profile.h" 21 #include "chrome/browser/profiles/profile.h"
21 #include "chrome/common/extensions/extension.h" 22 #include "chrome/common/extensions/extension.h"
22 #include "content/public/browser/browser_thread.h" 23 #include "content/public/browser/browser_thread.h"
23 #include "content/public/browser/notification_details.h" 24 #include "content/public/browser/notification_details.h"
24 #include "content/public/browser/notification_source.h" 25 #include "content/public/browser/notification_source.h"
25 26
26 namespace { 27 namespace {
27 28
28 const char kSuccess[] = ""; 29 const char kSuccess[] = "";
(...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after
395 if (extension_service->is_ready()) { 396 if (extension_service->is_ready()) {
396 const ExtensionSet* extensions = extension_service->extensions(); 397 const ExtensionSet* extensions = extension_service->extensions();
397 for (ExtensionSet::const_iterator i = extensions->begin(); 398 for (ExtensionSet::const_iterator i = extensions->begin();
398 i != extensions->end(); 399 i != extensions->end();
399 ++i) { 400 ++i) {
400 bool needs_apis_storing_rules = 401 bool needs_apis_storing_rules =
401 (*i)->HasAPIPermission(APIPermission::kDeclarativeContent) || 402 (*i)->HasAPIPermission(APIPermission::kDeclarativeContent) ||
402 (*i)->HasAPIPermission(APIPermission::kDeclarativeWebRequest); 403 (*i)->HasAPIPermission(APIPermission::kDeclarativeWebRequest);
403 bool respects_off_the_record = 404 bool respects_off_the_record =
404 !(profile_->IsOffTheRecord()) || 405 !(profile_->IsOffTheRecord()) ||
405 extension_service->IsIncognitoEnabled((*i)->id()); 406 extension_util::IsIncognitoEnabled((*i)->id(), extension_service);
406 if (needs_apis_storing_rules && respects_off_the_record) 407 if (needs_apis_storing_rules && respects_off_the_record)
407 ReadFromStorage((*i)->id()); 408 ReadFromStorage((*i)->id());
408 } 409 }
409 } 410 }
410 } 411 }
411 412
412 void RulesRegistryWithCache::RuleStorageOnUI::ReadFromStorage( 413 void RulesRegistryWithCache::RuleStorageOnUI::ReadFromStorage(
413 const std::string& extension_id) { 414 const std::string& extension_id) {
414 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); 415 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
415 if (!profile_) 416 if (!profile_)
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
474 bool rules_stored) { 475 bool rules_stored) {
475 CHECK(profile_); 476 CHECK(profile_);
476 ExtensionScopedPrefs* extension_prefs = ExtensionPrefs::Get(profile_); 477 ExtensionScopedPrefs* extension_prefs = ExtensionPrefs::Get(profile_);
477 extension_prefs->UpdateExtensionPref( 478 extension_prefs->UpdateExtensionPref(
478 extension_id, 479 extension_id,
479 rules_stored_key_, 480 rules_stored_key_,
480 new base::FundamentalValue(rules_stored)); 481 new base::FundamentalValue(rules_stored));
481 } 482 }
482 483
483 } // namespace extensions 484 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698