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

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

Issue 8496024: Don't close crashed tabs from extensions with background pages. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: mpcomplete's Created 9 years, 1 month 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
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_info_map.h" 5 #include "chrome/browser/extensions/extension_info_map.h"
6 6
7 #include "chrome/common/extensions/extension.h" 7 #include "chrome/common/extensions/extension.h"
8 #include "chrome/common/extensions/extension_set.h" 8 #include "chrome/common/extensions/extension_set.h"
9 #include "chrome/common/url_constants.h" 9 #include "chrome/common/url_constants.h"
10 #include "content/public/browser/browser_thread.h" 10 #include "content/public/browser/browser_thread.h"
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 57
58 extra_data_[extension->id()].install_time = install_time; 58 extra_data_[extension->id()].install_time = install_time;
59 extra_data_[extension->id()].incognito_enabled = incognito_enabled; 59 extra_data_[extension->id()].incognito_enabled = incognito_enabled;
60 } 60 }
61 61
62 void ExtensionInfoMap::RemoveExtension(const std::string& extension_id, 62 void ExtensionInfoMap::RemoveExtension(const std::string& extension_id,
63 const extension_misc::UnloadedExtensionReason reason) { 63 const extension_misc::UnloadedExtensionReason reason) {
64 CheckOnValidThread(); 64 CheckOnValidThread();
65 const Extension* extension = extensions_.GetByID(extension_id); 65 const Extension* extension = extensions_.GetByID(extension_id);
66 extra_data_.erase(extension_id); // we don't care about disabled extra data 66 extra_data_.erase(extension_id); // we don't care about disabled extra data
67 bool was_uninstalled = (reason != extension_misc::UNLOAD_REASON_DISABLE &&
68 reason != extension_misc::UNLOAD_REASON_TERMINATE);
67 if (extension) { 69 if (extension) {
68 if (reason == extension_misc::UNLOAD_REASON_DISABLE) 70 if (!was_uninstalled)
69 disabled_extensions_.Insert(extension); 71 disabled_extensions_.Insert(extension);
70 extensions_.Remove(extension_id); 72 extensions_.Remove(extension_id);
71 } else if (reason != extension_misc::UNLOAD_REASON_DISABLE) { 73 } else if (was_uninstalled) {
72 // If the extension was uninstalled, make sure it's removed from the map of 74 // If the extension was uninstalled, make sure it's removed from the map of
73 // disabled extensions. 75 // disabled extensions.
74 disabled_extensions_.Remove(extension_id); 76 disabled_extensions_.Remove(extension_id);
75 } else { 77 } else {
76 // NOTE: This can currently happen if we receive multiple unload 78 // NOTE: This can currently happen if we receive multiple unload
77 // notifications, e.g. setting incognito-enabled state for a 79 // notifications, e.g. setting incognito-enabled state for a
78 // disabled extension (e.g., via sync). See 80 // disabled extension (e.g., via sync). See
79 // http://code.google.com/p/chromium/issues/detail?id=50582 . 81 // http://code.google.com/p/chromium/issues/detail?id=50582 .
80 NOTREACHED() << extension_id; 82 NOTREACHED() << extension_id;
81 } 83 }
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 ExtensionSet::ExtensionMap::const_iterator i = extensions_.begin(); 139 ExtensionSet::ExtensionMap::const_iterator i = extensions_.begin();
138 for (; i != extensions_.end(); ++i) { 140 for (; i != extensions_.end(); ++i) {
139 if (i->second->web_extent().MatchesSecurityOrigin(origin) && 141 if (i->second->web_extent().MatchesSecurityOrigin(origin) &&
140 process_map_.Contains(i->first, process_id) && 142 process_map_.Contains(i->first, process_id) &&
141 i->second->HasAPIPermission(permission)) { 143 i->second->HasAPIPermission(permission)) {
142 return true; 144 return true;
143 } 145 }
144 } 146 }
145 return false; 147 return false;
146 } 148 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_crash_recovery_browsertest.cc ('k') | chrome/browser/extensions/extension_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698