OLD | NEW |
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 "chrome/browser/extensions/extension_system_impl.h" | 5 #include "chrome/browser/extensions/extension_system_impl.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/base_switches.h" | 9 #include "base/base_switches.h" |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 25 matching lines...) Expand all Loading... |
36 #include "chrome/browser/extensions/update_install_gate.h" | 36 #include "chrome/browser/extensions/update_install_gate.h" |
37 #include "chrome/browser/notifications/notifier_state_tracker.h" | 37 #include "chrome/browser/notifications/notifier_state_tracker.h" |
38 #include "chrome/browser/notifications/notifier_state_tracker_factory.h" | 38 #include "chrome/browser/notifications/notifier_state_tracker_factory.h" |
39 #include "chrome/browser/profiles/profile.h" | 39 #include "chrome/browser/profiles/profile.h" |
40 #include "chrome/browser/profiles/profile_manager.h" | 40 #include "chrome/browser/profiles/profile_manager.h" |
41 #include "chrome/browser/ui/webui/extensions/extension_icon_source.h" | 41 #include "chrome/browser/ui/webui/extensions/extension_icon_source.h" |
42 #include "chrome/common/chrome_switches.h" | 42 #include "chrome/common/chrome_switches.h" |
43 #include "content/public/browser/browser_thread.h" | 43 #include "content/public/browser/browser_thread.h" |
44 #include "content/public/browser/notification_service.h" | 44 #include "content/public/browser/notification_service.h" |
45 #include "content/public/browser/url_data_source.h" | 45 #include "content/public/browser/url_data_source.h" |
| 46 #include "extensions/browser/api/declarative_net_request/rules_monitor.h" |
46 #include "extensions/browser/content_verifier.h" | 47 #include "extensions/browser/content_verifier.h" |
47 #include "extensions/browser/extension_pref_store.h" | 48 #include "extensions/browser/extension_pref_store.h" |
48 #include "extensions/browser/extension_pref_value_map.h" | 49 #include "extensions/browser/extension_pref_value_map.h" |
49 #include "extensions/browser/extension_pref_value_map_factory.h" | 50 #include "extensions/browser/extension_pref_value_map_factory.h" |
50 #include "extensions/browser/extension_prefs.h" | 51 #include "extensions/browser/extension_prefs.h" |
51 #include "extensions/browser/extension_registry.h" | 52 #include "extensions/browser/extension_registry.h" |
52 #include "extensions/browser/extension_util.h" | 53 #include "extensions/browser/extension_util.h" |
53 #include "extensions/browser/info_map.h" | 54 #include "extensions/browser/info_map.h" |
54 #include "extensions/browser/quota_service.h" | 55 #include "extensions/browser/quota_service.h" |
55 #include "extensions/browser/runtime_data.h" | 56 #include "extensions/browser/runtime_data.h" |
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
256 } | 257 } |
257 #else | 258 #else |
258 extension_service_->component_loader()->AddDefaultComponentExtensions( | 259 extension_service_->component_loader()->AddDefaultComponentExtensions( |
259 skip_session_extensions); | 260 skip_session_extensions); |
260 #endif | 261 #endif |
261 | 262 |
262 app_sorting_.reset(new ChromeAppSorting(profile_)); | 263 app_sorting_.reset(new ChromeAppSorting(profile_)); |
263 | 264 |
264 InitInstallGates(); | 265 InitInstallGates(); |
265 | 266 |
| 267 // TODO is this the correct place for initialization? rules_store is |
| 268 // initialized in InitPrefs(). Should be before init, |
| 269 // extension_service_->Init() since should be setup before extensions are |
| 270 // loaded. Should be after extension service constructor since requires file |
| 271 // task runner. |
| 272 rules_monitor_ = base::MakeUnique<declarative_net_request::RulesMonitor>( |
| 273 profile_, extension_service_->GetFileTaskRunner(), info_map()); |
| 274 |
266 extension_service_->Init(); | 275 extension_service_->Init(); |
267 | 276 |
268 // Make sure ExtensionSyncService is created. | 277 // Make sure ExtensionSyncService is created. |
269 ExtensionSyncService::Get(profile_); | 278 ExtensionSyncService::Get(profile_); |
270 | 279 |
271 // Make the chrome://extension-icon/ resource available. | 280 // Make the chrome://extension-icon/ resource available. |
272 content::URLDataSource::Add(profile_, new ExtensionIconSource(profile_)); | 281 content::URLDataSource::Add(profile_, new ExtensionIconSource(profile_)); |
273 } | 282 } |
274 | 283 |
275 void ExtensionSystemImpl::Shared::Shutdown() { | 284 void ExtensionSystemImpl::Shared::Shutdown() { |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
324 } | 333 } |
325 | 334 |
326 AppSorting* ExtensionSystemImpl::Shared::app_sorting() { | 335 AppSorting* ExtensionSystemImpl::Shared::app_sorting() { |
327 return app_sorting_.get(); | 336 return app_sorting_.get(); |
328 } | 337 } |
329 | 338 |
330 ContentVerifier* ExtensionSystemImpl::Shared::content_verifier() { | 339 ContentVerifier* ExtensionSystemImpl::Shared::content_verifier() { |
331 return content_verifier_.get(); | 340 return content_verifier_.get(); |
332 } | 341 } |
333 | 342 |
| 343 declarative_net_request::RulesMonitor* |
| 344 ExtensionSystemImpl::Shared::rules_monitor() { |
| 345 return rules_monitor_.get(); |
| 346 } |
| 347 |
334 void ExtensionSystemImpl::Shared::Observe( | 348 void ExtensionSystemImpl::Shared::Observe( |
335 int type, | 349 int type, |
336 const content::NotificationSource& source, | 350 const content::NotificationSource& source, |
337 const content::NotificationDetails& details) { | 351 const content::NotificationDetails& details) { |
338 DCHECK_EQ(chrome::NOTIFICATION_APP_TERMINATING, type); | 352 DCHECK_EQ(chrome::NOTIFICATION_APP_TERMINATING, type); |
339 chrome_apps::NotifyApplicationTerminating(profile_); | 353 chrome_apps::NotifyApplicationTerminating(profile_); |
340 } | 354 } |
341 | 355 |
342 // | 356 // |
343 // ExtensionSystemImpl | 357 // ExtensionSystemImpl |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
412 } | 426 } |
413 | 427 |
414 AppSorting* ExtensionSystemImpl::app_sorting() { | 428 AppSorting* ExtensionSystemImpl::app_sorting() { |
415 return shared_->app_sorting(); | 429 return shared_->app_sorting(); |
416 } | 430 } |
417 | 431 |
418 ContentVerifier* ExtensionSystemImpl::content_verifier() { | 432 ContentVerifier* ExtensionSystemImpl::content_verifier() { |
419 return shared_->content_verifier(); | 433 return shared_->content_verifier(); |
420 } | 434 } |
421 | 435 |
| 436 declarative_net_request::RulesMonitor* ExtensionSystemImpl::rules_monitor() { |
| 437 return shared_->rules_monitor(); |
| 438 } |
| 439 |
422 std::unique_ptr<ExtensionSet> ExtensionSystemImpl::GetDependentExtensions( | 440 std::unique_ptr<ExtensionSet> ExtensionSystemImpl::GetDependentExtensions( |
423 const Extension* extension) { | 441 const Extension* extension) { |
424 return extension_service()->shared_module_service()->GetDependentExtensions( | 442 return extension_service()->shared_module_service()->GetDependentExtensions( |
425 extension); | 443 extension); |
426 } | 444 } |
427 | 445 |
428 void ExtensionSystemImpl::InstallUpdate(const std::string& extension_id, | 446 void ExtensionSystemImpl::InstallUpdate(const std::string& extension_id, |
429 const base::FilePath& temp_dir) { | 447 const base::FilePath& temp_dir) { |
430 NOTREACHED() << "Not yet implemented"; | 448 NOTREACHED() << "Not yet implemented"; |
431 base::DeleteFile(temp_dir, true /* recursive */); | 449 base::DeleteFile(temp_dir, true /* recursive */); |
(...skipping 29 matching lines...) Expand all Loading... |
461 | 479 |
462 void ExtensionSystemImpl::UnregisterExtensionWithRequestContexts( | 480 void ExtensionSystemImpl::UnregisterExtensionWithRequestContexts( |
463 const std::string& extension_id, | 481 const std::string& extension_id, |
464 const UnloadedExtensionReason reason) { | 482 const UnloadedExtensionReason reason) { |
465 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, | 483 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, |
466 base::BindOnce(&InfoMap::RemoveExtension, info_map(), | 484 base::BindOnce(&InfoMap::RemoveExtension, info_map(), |
467 extension_id, reason)); | 485 extension_id, reason)); |
468 } | 486 } |
469 | 487 |
470 } // namespace extensions | 488 } // namespace extensions |
OLD | NEW |