| 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 | 9 |
| 9 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| 10 #include "base/command_line.h" | 11 #include "base/command_line.h" |
| 11 #include "base/file_util.h" | 12 #include "base/file_util.h" |
| 12 #include "base/metrics/histogram.h" | 13 #include "base/metrics/histogram.h" |
| 13 #include "base/stl_util-inl.h" | 14 #include "base/stl_util-inl.h" |
| 14 #include "base/string16.h" | 15 #include "base/string16.h" |
| 15 #include "base/string_number_conversions.h" | 16 #include "base/string_number_conversions.h" |
| 16 #include "base/string_util.h" | 17 #include "base/string_util.h" |
| 17 #include "base/stringprintf.h" | 18 #include "base/stringprintf.h" |
| (...skipping 476 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 494 provider->ServiceShutdown(); | 495 provider->ServiceShutdown(); |
| 495 } | 496 } |
| 496 } | 497 } |
| 497 | 498 |
| 498 void ExtensionService::InitEventRouters() { | 499 void ExtensionService::InitEventRouters() { |
| 499 if (event_routers_initialized_) | 500 if (event_routers_initialized_) |
| 500 return; | 501 return; |
| 501 | 502 |
| 502 ExtensionHistoryEventRouter::GetInstance()->ObserveProfile(profile_); | 503 ExtensionHistoryEventRouter::GetInstance()->ObserveProfile(profile_); |
| 503 ExtensionAccessibilityEventRouter::GetInstance()->ObserveProfile(profile_); | 504 ExtensionAccessibilityEventRouter::GetInstance()->ObserveProfile(profile_); |
| 504 ExtensionBrowserEventRouter::GetInstance()->Init(profile_); | 505 browser_event_router_.reset(new ExtensionBrowserEventRouter(profile_)); |
| 506 browser_event_router_->Init(); |
| 505 ExtensionBookmarkEventRouter::GetInstance()->Observe( | 507 ExtensionBookmarkEventRouter::GetInstance()->Observe( |
| 506 profile_->GetBookmarkModel()); | 508 profile_->GetBookmarkModel()); |
| 507 ExtensionCookiesEventRouter::GetInstance()->Init(); | 509 ExtensionCookiesEventRouter::GetInstance()->Init(); |
| 508 ExtensionManagementEventRouter::GetInstance()->Init(); | 510 ExtensionManagementEventRouter::GetInstance()->Init(); |
| 509 ExtensionProcessesEventRouter::GetInstance()->ObserveProfile(profile_); | 511 ExtensionProcessesEventRouter::GetInstance()->ObserveProfile(profile_); |
| 510 ExtensionWebNavigationEventRouter::GetInstance()->Init(); | 512 ExtensionWebNavigationEventRouter::GetInstance()->Init(); |
| 511 event_routers_initialized_ = true; | 513 event_routers_initialized_ = true; |
| 512 } | 514 } |
| 513 | 515 |
| 514 const Extension* ExtensionService::GetExtensionById(const std::string& id, | 516 const Extension* ExtensionService::GetExtensionById(const std::string& id, |
| (...skipping 724 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1239 } | 1241 } |
| 1240 | 1242 |
| 1241 // UnloadExtension will change the extensions_ list. So, we should | 1243 // UnloadExtension will change the extensions_ list. So, we should |
| 1242 // call it outside the iterator loop. | 1244 // call it outside the iterator loop. |
| 1243 for (unsigned int i = 0; i < to_be_removed.size(); ++i) { | 1245 for (unsigned int i = 0; i < to_be_removed.size(); ++i) { |
| 1244 UnloadExtension(to_be_removed[i], UnloadedExtensionInfo::DISABLE); | 1246 UnloadExtension(to_be_removed[i], UnloadedExtensionInfo::DISABLE); |
| 1245 } | 1247 } |
| 1246 } | 1248 } |
| 1247 | 1249 |
| 1248 void ExtensionService::DestroyingProfile() { | 1250 void ExtensionService::DestroyingProfile() { |
| 1251 browser_event_router_.reset(); |
| 1249 pref_change_registrar_.RemoveAll(); | 1252 pref_change_registrar_.RemoveAll(); |
| 1250 profile_ = NULL; | 1253 profile_ = NULL; |
| 1251 toolbar_model_.DestroyingProfile(); | 1254 toolbar_model_.DestroyingProfile(); |
| 1252 } | 1255 } |
| 1253 | 1256 |
| 1254 ExtensionPrefs* ExtensionService::extension_prefs() { | 1257 ExtensionPrefs* ExtensionService::extension_prefs() { |
| 1255 return extension_prefs_; | 1258 return extension_prefs_; |
| 1256 } | 1259 } |
| 1257 | 1260 |
| 1258 void ExtensionService::CheckAdminBlacklist() { | 1261 void ExtensionService::CheckAdminBlacklist() { |
| (...skipping 716 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1975 } | 1978 } |
| 1976 | 1979 |
| 1977 void ExtensionService::SetBeingUpgraded(const Extension* extension, | 1980 void ExtensionService::SetBeingUpgraded(const Extension* extension, |
| 1978 bool value) { | 1981 bool value) { |
| 1979 extension_runtime_data_[extension->id()].being_upgraded = value; | 1982 extension_runtime_data_[extension->id()].being_upgraded = value; |
| 1980 } | 1983 } |
| 1981 | 1984 |
| 1982 PropertyBag* ExtensionService::GetPropertyBag(const Extension* extension) { | 1985 PropertyBag* ExtensionService::GetPropertyBag(const Extension* extension) { |
| 1983 return &extension_runtime_data_[extension->id()].property_bag; | 1986 return &extension_runtime_data_[extension->id()].property_bag; |
| 1984 } | 1987 } |
| OLD | NEW |