OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/extensions_service.h" | 5 #include "chrome/browser/extensions/extensions_service.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 579 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
590 backend_ = new ExtensionsServiceBackend(profile->GetPrefs(), | 590 backend_ = new ExtensionsServiceBackend(profile->GetPrefs(), |
591 install_directory_); | 591 install_directory_); |
592 | 592 |
593 // Use monochrome icons for Omnibox icons. | 593 // Use monochrome icons for Omnibox icons. |
594 omnibox_popup_icon_manager_.set_monochrome(true); | 594 omnibox_popup_icon_manager_.set_monochrome(true); |
595 omnibox_icon_manager_.set_monochrome(true); | 595 omnibox_icon_manager_.set_monochrome(true); |
596 omnibox_icon_manager_.set_padding(gfx::Insets(0, kOmniboxIconPaddingLeft, | 596 omnibox_icon_manager_.set_padding(gfx::Insets(0, kOmniboxIconPaddingLeft, |
597 0, kOmniboxIconPaddingRight)); | 597 0, kOmniboxIconPaddingRight)); |
598 } | 598 } |
599 | 599 |
| 600 const ExtensionList* ExtensionsService::extensions() const { |
| 601 return &extensions_; |
| 602 } |
| 603 |
| 604 const ExtensionList* ExtensionsService::disabled_extensions() const { |
| 605 return &disabled_extensions_; |
| 606 } |
| 607 |
| 608 const PendingExtensionMap& ExtensionsService::pending_extensions() const { |
| 609 return pending_extensions_; |
| 610 } |
| 611 |
| 612 bool ExtensionsService::HasInstalledExtensions() { |
| 613 return !(extensions_.empty() && disabled_extensions_.empty()); |
| 614 } |
| 615 |
600 ExtensionsService::~ExtensionsService() { | 616 ExtensionsService::~ExtensionsService() { |
601 DCHECK(!profile_); // Profile should have told us it's going away. | 617 DCHECK(!profile_); // Profile should have told us it's going away. |
602 UnloadAllExtensions(); | 618 UnloadAllExtensions(); |
603 if (updater_.get()) { | 619 if (updater_.get()) { |
604 updater_->Stop(); | 620 updater_->Stop(); |
605 } | 621 } |
606 } | 622 } |
607 | 623 |
608 void ExtensionsService::InitEventRouters() { | 624 void ExtensionsService::InitEventRouters() { |
609 if (event_routers_initialized_) | 625 if (event_routers_initialized_) |
(...skipping 739 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1349 UnloadExtension(to_be_removed[i]); | 1365 UnloadExtension(to_be_removed[i]); |
1350 } | 1366 } |
1351 } | 1367 } |
1352 | 1368 |
1353 void ExtensionsService::DestroyingProfile() { | 1369 void ExtensionsService::DestroyingProfile() { |
1354 pref_change_registrar_.RemoveAll(); | 1370 pref_change_registrar_.RemoveAll(); |
1355 profile_ = NULL; | 1371 profile_ = NULL; |
1356 toolbar_model_.DestroyingProfile(); | 1372 toolbar_model_.DestroyingProfile(); |
1357 } | 1373 } |
1358 | 1374 |
| 1375 ExtensionPrefs* ExtensionsService::extension_prefs() { |
| 1376 return extension_prefs_; |
| 1377 } |
| 1378 |
1359 void ExtensionsService::CheckAdminBlacklist() { | 1379 void ExtensionsService::CheckAdminBlacklist() { |
1360 std::vector<std::string> to_be_removed; | 1380 std::vector<std::string> to_be_removed; |
1361 // Loop through extensions list, unload installed extensions. | 1381 // Loop through extensions list, unload installed extensions. |
1362 for (ExtensionList::const_iterator iter = extensions_.begin(); | 1382 for (ExtensionList::const_iterator iter = extensions_.begin(); |
1363 iter != extensions_.end(); ++iter) { | 1383 iter != extensions_.end(); ++iter) { |
1364 const Extension* extension = (*iter); | 1384 const Extension* extension = (*iter); |
1365 if (!extension_prefs_->IsExtensionAllowedByPolicy(extension->id())) | 1385 if (!extension_prefs_->IsExtensionAllowedByPolicy(extension->id())) |
1366 to_be_removed.push_back(extension->id()); | 1386 to_be_removed.push_back(extension->id()); |
1367 } | 1387 } |
1368 | 1388 |
(...skipping 717 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2086 } | 2106 } |
2087 | 2107 |
2088 void ExtensionsService::SetBeingUpgraded(const Extension* extension, | 2108 void ExtensionsService::SetBeingUpgraded(const Extension* extension, |
2089 bool value) { | 2109 bool value) { |
2090 extension_runtime_data_[extension->id()].being_upgraded = value; | 2110 extension_runtime_data_[extension->id()].being_upgraded = value; |
2091 } | 2111 } |
2092 | 2112 |
2093 PropertyBag* ExtensionsService::GetPropertyBag(const Extension* extension) { | 2113 PropertyBag* ExtensionsService::GetPropertyBag(const Extension* extension) { |
2094 return &extension_runtime_data_[extension->id()].property_bag; | 2114 return &extension_runtime_data_[extension->id()].property_bag; |
2095 } | 2115 } |
OLD | NEW |