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_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 "content/browser/browser_thread.h" | 8 #include "content/browser/browser_thread.h" |
9 | 9 |
10 namespace { | 10 namespace { |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 bool incognito_enabled) { | 45 bool incognito_enabled) { |
46 CheckOnValidThread(); | 46 CheckOnValidThread(); |
47 extensions_.Insert(extension); | 47 extensions_.Insert(extension); |
48 disabled_extensions_.Remove(extension->id()); | 48 disabled_extensions_.Remove(extension->id()); |
49 | 49 |
50 extra_data_[extension->id()].install_time = install_time; | 50 extra_data_[extension->id()].install_time = install_time; |
51 extra_data_[extension->id()].incognito_enabled = incognito_enabled; | 51 extra_data_[extension->id()].incognito_enabled = incognito_enabled; |
52 } | 52 } |
53 | 53 |
54 void ExtensionInfoMap::RemoveExtension(const std::string& extension_id, | 54 void ExtensionInfoMap::RemoveExtension(const std::string& extension_id, |
55 const UnloadedExtensionInfo::Reason reason) { | 55 const extension_misc::UnloadedExtensionReason reason) { |
56 CheckOnValidThread(); | 56 CheckOnValidThread(); |
57 const Extension* extension = extensions_.GetByID(extension_id); | 57 const Extension* extension = extensions_.GetByID(extension_id); |
58 extra_data_.erase(extension_id); // we don't care about disabled extra data | 58 extra_data_.erase(extension_id); // we don't care about disabled extra data |
59 if (extension) { | 59 if (extension) { |
60 if (reason == UnloadedExtensionInfo::DISABLE) | 60 if (reason == extension_misc::UNLOAD_REASON_DISABLE) |
61 disabled_extensions_.Insert(extension); | 61 disabled_extensions_.Insert(extension); |
62 extensions_.Remove(extension_id); | 62 extensions_.Remove(extension_id); |
63 } else if (reason != UnloadedExtensionInfo::DISABLE) { | 63 } else if (reason != extension_misc::UNLOAD_REASON_DISABLE) { |
64 // If the extension was uninstalled, make sure it's removed from the map of | 64 // If the extension was uninstalled, make sure it's removed from the map of |
65 // disabled extensions. | 65 // disabled extensions. |
66 disabled_extensions_.Remove(extension_id); | 66 disabled_extensions_.Remove(extension_id); |
67 } else { | 67 } else { |
68 // NOTE: This can currently happen if we receive multiple unload | 68 // NOTE: This can currently happen if we receive multiple unload |
69 // notifications, e.g. setting incognito-enabled state for a | 69 // notifications, e.g. setting incognito-enabled state for a |
70 // disabled extension (e.g., via sync). See | 70 // disabled extension (e.g., via sync). See |
71 // http://code.google.com/p/chromium/issues/detail?id=50582 . | 71 // http://code.google.com/p/chromium/issues/detail?id=50582 . |
72 NOTREACHED() << extension_id; | 72 NOTREACHED() << extension_id; |
73 } | 73 } |
(...skipping 13 matching lines...) Expand all Loading... |
87 if (iter != extra_data_.end()) | 87 if (iter != extra_data_.end()) |
88 return iter->second.incognito_enabled; | 88 return iter->second.incognito_enabled; |
89 return false; | 89 return false; |
90 } | 90 } |
91 | 91 |
92 bool ExtensionInfoMap::CanCrossIncognito(const Extension* extension) { | 92 bool ExtensionInfoMap::CanCrossIncognito(const Extension* extension) { |
93 // This is duplicated from ExtensionService :(. | 93 // This is duplicated from ExtensionService :(. |
94 return IsIncognitoEnabled(extension->id()) && | 94 return IsIncognitoEnabled(extension->id()) && |
95 !extension->incognito_split_mode(); | 95 !extension->incognito_split_mode(); |
96 } | 96 } |
OLD | NEW |