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

Side by Side Diff: chrome/browser/extensions/extension_service.cc

Issue 8333021: Fix a crash in PageActionImageView when extensions are reloaded due to incognito settings changing. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 2 months 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 1708 matching lines...) Expand 10 before | Expand all | Expand 10 after
1719 void ExtensionService::CheckForUpdatesSoon() { 1719 void ExtensionService::CheckForUpdatesSoon() {
1720 if (updater()) { 1720 if (updater()) {
1721 updater()->CheckSoon(); 1721 updater()->CheckSoon();
1722 } else { 1722 } else {
1723 LOG(WARNING) << "CheckForUpdatesSoon() called with auto-update turned off"; 1723 LOG(WARNING) << "CheckForUpdatesSoon() called with auto-update turned off";
1724 } 1724 }
1725 } 1725 }
1726 1726
1727 namespace { 1727 namespace {
1728 bool IsSyncableNone(const Extension& extension) { return false; } 1728 bool IsSyncableNone(const Extension& extension) { return false; }
1729 } // namespace 1729 } // namespace
1730 1730
1731 ExtensionService::SyncBundle::SyncBundle() 1731 ExtensionService::SyncBundle::SyncBundle()
1732 : filter(IsSyncableNone), 1732 : filter(IsSyncableNone),
1733 sync_processor(NULL) { 1733 sync_processor(NULL) {
1734 } 1734 }
1735 1735
1736 ExtensionService::SyncBundle::~SyncBundle() { 1736 ExtensionService::SyncBundle::~SyncBundle() {
1737 } 1737 }
1738 1738
1739 bool ExtensionService::SyncBundle::HasExtensionId(const std::string& id) const { 1739 bool ExtensionService::SyncBundle::HasExtensionId(const std::string& id) const {
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after
2021 bool old_enabled = extension_prefs_->IsIncognitoEnabled(extension_id); 2021 bool old_enabled = extension_prefs_->IsIncognitoEnabled(extension_id);
2022 if (enabled == old_enabled) 2022 if (enabled == old_enabled)
2023 return; 2023 return;
2024 2024
2025 extension_prefs_->SetIsIncognitoEnabled(extension_id, enabled); 2025 extension_prefs_->SetIsIncognitoEnabled(extension_id, enabled);
2026 2026
2027 // If the extension is enabled (and not terminated), unload and 2027 // If the extension is enabled (and not terminated), unload and
2028 // reload it to update UI. 2028 // reload it to update UI.
2029 const Extension* enabled_extension = GetExtensionById(extension_id, false); 2029 const Extension* enabled_extension = GetExtensionById(extension_id, false);
2030 if (enabled_extension) { 2030 if (enabled_extension) {
2031 ExtensionList::iterator iter = std::find(extensions_.begin(),
Aaron Boodman 2011/10/20 15:21:49 Can we just call ReloadExtension() instead? That i
Matt Perry 2011/10/24 18:48:56 Honestly, I don't know. I didn't realize the two u
2032 extensions_.end(),
2033 enabled_extension);
2034 extensions_.erase(iter);
2031 NotifyExtensionUnloaded( 2035 NotifyExtensionUnloaded(
2032 enabled_extension, extension_misc::UNLOAD_REASON_DISABLE); 2036 enabled_extension, extension_misc::UNLOAD_REASON_DISABLE);
2037 extensions_.push_back(make_scoped_refptr(enabled_extension));
2033 NotifyExtensionLoaded(enabled_extension); 2038 NotifyExtensionLoaded(enabled_extension);
2034 } 2039 }
2035 2040
2036 if (extension) 2041 if (extension)
2037 SyncExtensionChangeIfNeeded(*extension); 2042 SyncExtensionChangeIfNeeded(*extension);
2038 } 2043 }
2039 2044
2040 bool ExtensionService::CanCrossIncognito(const Extension* extension) { 2045 bool ExtensionService::CanCrossIncognito(const Extension* extension) {
2041 // We allow the extension to see events and data from another profile iff it 2046 // We allow the extension to see events and data from another profile iff it
2042 // uses "spanning" behavior and it has incognito access. "split" mode 2047 // uses "spanning" behavior and it has incognito access. "split" mode
(...skipping 960 matching lines...) Expand 10 before | Expand all | Expand 10 after
3003 3008
3004 ExtensionService::NaClModuleInfoList::iterator 3009 ExtensionService::NaClModuleInfoList::iterator
3005 ExtensionService::FindNaClModule(const GURL& url) { 3010 ExtensionService::FindNaClModule(const GURL& url) {
3006 for (NaClModuleInfoList::iterator iter = nacl_module_list_.begin(); 3011 for (NaClModuleInfoList::iterator iter = nacl_module_list_.begin();
3007 iter != nacl_module_list_.end(); ++iter) { 3012 iter != nacl_module_list_.end(); ++iter) {
3008 if (iter->url == url) 3013 if (iter->url == url)
3009 return iter; 3014 return iter;
3010 } 3015 }
3011 return nacl_module_list_.end(); 3016 return nacl_module_list_.end();
3012 } 3017 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698