OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_service.h" | 5 #include "chrome/browser/extensions/extension_service.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <set> | 8 #include <set> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 #include "chrome/common/pref_names.h" | 63 #include "chrome/common/pref_names.h" |
64 #include "chrome/common/url_constants.h" | 64 #include "chrome/common/url_constants.h" |
65 #include "content/browser/browser_thread.h" | 65 #include "content/browser/browser_thread.h" |
66 #include "content/common/notification_service.h" | 66 #include "content/common/notification_service.h" |
67 #include "content/common/notification_type.h" | 67 #include "content/common/notification_type.h" |
68 #include "googleurl/src/gurl.h" | 68 #include "googleurl/src/gurl.h" |
69 #include "net/base/registry_controlled_domain.h" | 69 #include "net/base/registry_controlled_domain.h" |
70 #include "webkit/database/database_tracker.h" | 70 #include "webkit/database/database_tracker.h" |
71 #include "webkit/database/database_util.h" | 71 #include "webkit/database/database_util.h" |
72 | 72 |
| 73 #if defined(OS_CHROMEOS) |
| 74 #include "chrome/browser/extensions/extension_filesystem_event_router.h" |
| 75 #endif |
| 76 |
73 using base::Time; | 77 using base::Time; |
74 | 78 |
75 namespace errors = extension_manifest_errors; | 79 namespace errors = extension_manifest_errors; |
76 | 80 |
77 namespace { | 81 namespace { |
78 | 82 |
79 #if defined(OS_LINUX) | 83 #if defined(OS_LINUX) |
80 static const int kOmniboxIconPaddingLeft = 2; | 84 static const int kOmniboxIconPaddingLeft = 2; |
81 static const int kOmniboxIconPaddingRight = 2; | 85 static const int kOmniboxIconPaddingRight = 2; |
82 #elif defined(OS_MACOSX) | 86 #elif defined(OS_MACOSX) |
(...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
448 ExtensionService::~ExtensionService() { | 452 ExtensionService::~ExtensionService() { |
449 DCHECK(!profile_); // Profile should have told us it's going away. | 453 DCHECK(!profile_); // Profile should have told us it's going away. |
450 UnloadAllExtensions(); | 454 UnloadAllExtensions(); |
451 | 455 |
452 ProviderCollection::const_iterator i; | 456 ProviderCollection::const_iterator i; |
453 for (i = external_extension_providers_.begin(); | 457 for (i = external_extension_providers_.begin(); |
454 i != external_extension_providers_.end(); ++i) { | 458 i != external_extension_providers_.end(); ++i) { |
455 ExternalExtensionProviderInterface* provider = i->get(); | 459 ExternalExtensionProviderInterface* provider = i->get(); |
456 provider->ServiceShutdown(); | 460 provider->ServiceShutdown(); |
457 } | 461 } |
| 462 |
| 463 #if defined(OS_CHROMEOS) |
| 464 if (event_routers_initialized_) { |
| 465 ExtensionFileSystemEventRouter::GetInstance()-> |
| 466 StopObservingFileSystemEvents(); |
| 467 } |
| 468 #endif |
458 } | 469 } |
459 | 470 |
460 void ExtensionService::InitEventRouters() { | 471 void ExtensionService::InitEventRouters() { |
461 if (event_routers_initialized_) | 472 if (event_routers_initialized_) |
462 return; | 473 return; |
463 | 474 |
464 ExtensionHistoryEventRouter::GetInstance()->ObserveProfile(profile_); | 475 ExtensionHistoryEventRouter::GetInstance()->ObserveProfile(profile_); |
465 ExtensionAccessibilityEventRouter::GetInstance()->ObserveProfile(profile_); | 476 ExtensionAccessibilityEventRouter::GetInstance()->ObserveProfile(profile_); |
466 browser_event_router_.reset(new ExtensionBrowserEventRouter(profile_)); | 477 browser_event_router_.reset(new ExtensionBrowserEventRouter(profile_)); |
467 browser_event_router_->Init(); | 478 browser_event_router_->Init(); |
468 preference_event_router_.reset(new ExtensionPreferenceEventRouter(profile_)); | 479 preference_event_router_.reset(new ExtensionPreferenceEventRouter(profile_)); |
469 ExtensionBookmarkEventRouter::GetInstance()->Observe( | 480 ExtensionBookmarkEventRouter::GetInstance()->Observe( |
470 profile_->GetBookmarkModel()); | 481 profile_->GetBookmarkModel()); |
471 ExtensionCookiesEventRouter::GetInstance()->Init(); | 482 ExtensionCookiesEventRouter::GetInstance()->Init(); |
472 ExtensionManagementEventRouter::GetInstance()->Init(); | 483 ExtensionManagementEventRouter::GetInstance()->Init(); |
473 ExtensionProcessesEventRouter::GetInstance()->ObserveProfile(profile_); | 484 ExtensionProcessesEventRouter::GetInstance()->ObserveProfile(profile_); |
474 ExtensionWebNavigationEventRouter::GetInstance()->Init(); | 485 ExtensionWebNavigationEventRouter::GetInstance()->Init(); |
| 486 #if defined(OS_CHROMEOS) |
| 487 ExtensionFileSystemEventRouter::GetInstance()->ObserveFileSystemEvents( |
| 488 profile_); |
| 489 #endif |
475 event_routers_initialized_ = true; | 490 event_routers_initialized_ = true; |
476 } | 491 } |
477 | 492 |
478 const Extension* ExtensionService::GetExtensionById( | 493 const Extension* ExtensionService::GetExtensionById( |
479 const std::string& id, bool include_disabled) const { | 494 const std::string& id, bool include_disabled) const { |
480 return GetExtensionByIdInternal(id, true, include_disabled); | 495 return GetExtensionByIdInternal(id, true, include_disabled); |
481 } | 496 } |
482 | 497 |
483 void ExtensionService::Init() { | 498 void ExtensionService::Init() { |
484 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 499 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
(...skipping 1270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1755 } | 1770 } |
1756 | 1771 |
1757 void ExtensionService::SetBeingUpgraded(const Extension* extension, | 1772 void ExtensionService::SetBeingUpgraded(const Extension* extension, |
1758 bool value) { | 1773 bool value) { |
1759 extension_runtime_data_[extension->id()].being_upgraded = value; | 1774 extension_runtime_data_[extension->id()].being_upgraded = value; |
1760 } | 1775 } |
1761 | 1776 |
1762 PropertyBag* ExtensionService::GetPropertyBag(const Extension* extension) { | 1777 PropertyBag* ExtensionService::GetPropertyBag(const Extension* extension) { |
1763 return &extension_runtime_data_[extension->id()].property_bag; | 1778 return &extension_runtime_data_[extension->id()].property_bag; |
1764 } | 1779 } |
OLD | NEW |