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

Side by Side Diff: chrome/browser/extensions/api/declarative_content/content_rules_registry.cc

Issue 28273006: <webview>: Implement declarativeWebRequest API (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added tests Created 7 years, 1 month 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/extensions/api/declarative_content/content_rules_regist ry.h" 5 #include "chrome/browser/extensions/api/declarative_content/content_rules_regist ry.h"
6 6
7 #include "chrome/browser/chrome_notification_types.h" 7 #include "chrome/browser/chrome_notification_types.h"
8 #include "chrome/browser/extensions/api/declarative_content/content_action.h" 8 #include "chrome/browser/extensions/api/declarative_content/content_action.h"
9 #include "chrome/browser/extensions/api/declarative_content/content_condition.h" 9 #include "chrome/browser/extensions/api/declarative_content/content_condition.h"
10 #include "chrome/browser/extensions/api/declarative_content/content_constants.h" 10 #include "chrome/browser/extensions/api/declarative_content/content_constants.h"
11 #include "chrome/browser/extensions/extension_service.h" 11 #include "chrome/browser/extensions/extension_service.h"
12 #include "chrome/browser/extensions/extension_system.h" 12 #include "chrome/browser/extensions/extension_system.h"
13 #include "chrome/browser/extensions/extension_tab_util.h" 13 #include "chrome/browser/extensions/extension_tab_util.h"
14 #include "chrome/browser/profiles/profile.h" 14 #include "chrome/browser/profiles/profile.h"
15 #include "chrome/common/extensions/extension_messages.h" 15 #include "chrome/common/extensions/extension_messages.h"
16 #include "content/public/browser/navigation_details.h" 16 #include "content/public/browser/navigation_details.h"
17 #include "content/public/browser/notification_service.h" 17 #include "content/public/browser/notification_service.h"
18 #include "content/public/browser/notification_source.h" 18 #include "content/public/browser/notification_source.h"
19 #include "content/public/browser/render_process_host.h" 19 #include "content/public/browser/render_process_host.h"
20 #include "content/public/browser/web_contents.h" 20 #include "content/public/browser/web_contents.h"
21 21
22 namespace extensions { 22 namespace extensions {
23 23
24 ContentRulesRegistry::ContentRulesRegistry( 24 ContentRulesRegistry::ContentRulesRegistry(
25 Profile* profile, 25 Profile* profile,
26 scoped_ptr<RulesRegistryWithCache::RuleStorageOnUI>* ui_part) 26 scoped_ptr<RulesRegistryWithCache::RuleStorageOnUI>* ui_part,
27 const WebViewKey& webview_key)
27 : RulesRegistryWithCache((ui_part ? profile : NULL), 28 : RulesRegistryWithCache((ui_part ? profile : NULL),
28 declarative_content_constants::kOnPageChanged, 29 declarative_content_constants::kOnPageChanged,
29 content::BrowserThread::UI, 30 content::BrowserThread::UI,
30 false /*log_storage_init_delay*/, 31 false /*log_storage_init_delay*/,
31 ui_part), 32 ui_part,
33 webview_key),
32 profile_(profile) { 34 profile_(profile) {
33 extension_info_map_ = ExtensionSystem::Get(profile)->info_map(); 35 extension_info_map_ = ExtensionSystem::Get(profile)->info_map();
34 36
35 registrar_.Add(this, content::NOTIFICATION_RENDERER_PROCESS_CREATED, 37 registrar_.Add(this, content::NOTIFICATION_RENDERER_PROCESS_CREATED,
36 content::NotificationService::AllBrowserContextsAndSources()); 38 content::NotificationService::AllBrowserContextsAndSources());
37 registrar_.Add(this, content::NOTIFICATION_WEB_CONTENTS_DESTROYED, 39 registrar_.Add(this, content::NOTIFICATION_WEB_CONTENTS_DESTROYED,
38 content::NotificationService::AllBrowserContextsAndSources()); 40 content::NotificationService::AllBrowserContextsAndSources());
39 } 41 }
40 42
41 void ContentRulesRegistry::Observe( 43 void ContentRulesRegistry::Observe(
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after
312 314
313 base::Time ContentRulesRegistry::GetExtensionInstallationTime( 315 base::Time ContentRulesRegistry::GetExtensionInstallationTime(
314 const std::string& extension_id) const { 316 const std::string& extension_id) const {
315 if (!extension_info_map_.get()) // May be NULL during testing. 317 if (!extension_info_map_.get()) // May be NULL during testing.
316 return base::Time(); 318 return base::Time();
317 319
318 return extension_info_map_->GetInstallTime(extension_id); 320 return extension_info_map_->GetInstallTime(extension_id);
319 } 321 }
320 322
321 } // namespace extensions 323 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698