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

Side by Side Diff: extensions/browser/runtime_data.cc

Issue 2839373003: struct UnloadedExtensionInfo -> enum UnloadedExtensionInfoReason (Closed)
Patch Set: Rebase Created 3 years, 7 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
« no previous file with comments | « extensions/browser/runtime_data.h ('k') | extensions/browser/runtime_data_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "extensions/browser/runtime_data.h" 5 #include "extensions/browser/runtime_data.h"
6 6
7 #include "extensions/browser/extension_registry.h" 7 #include "extensions/browser/extension_registry.h"
8 #include "extensions/common/extension.h" 8 #include "extensions/common/extension.h"
9 #include "extensions/common/manifest_handlers/background_info.h" 9 #include "extensions/common/manifest_handlers/background_info.h"
10 10
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 const std::string& extension_id) const { 42 const std::string& extension_id) const {
43 return extension_flags_.find(extension_id) != extension_flags_.end(); 43 return extension_flags_.find(extension_id) != extension_flags_.end();
44 } 44 }
45 45
46 void RuntimeData::ClearAll() { 46 void RuntimeData::ClearAll() {
47 extension_flags_.clear(); 47 extension_flags_.clear();
48 } 48 }
49 49
50 void RuntimeData::OnExtensionUnloaded(content::BrowserContext* browser_context, 50 void RuntimeData::OnExtensionUnloaded(content::BrowserContext* browser_context,
51 const Extension* extension, 51 const Extension* extension,
52 UnloadedExtensionInfo::Reason reason) { 52 UnloadedExtensionReason reason) {
53 ExtensionFlagsMap::iterator iter = extension_flags_.find(extension->id()); 53 ExtensionFlagsMap::iterator iter = extension_flags_.find(extension->id());
54 if (iter != extension_flags_.end()) 54 if (iter != extension_flags_.end())
55 iter->second = iter->second & kPersistAcrossUnloadMask; 55 iter->second = iter->second & kPersistAcrossUnloadMask;
56 } 56 }
57 57
58 bool RuntimeData::HasFlag(const std::string& extension_id, 58 bool RuntimeData::HasFlag(const std::string& extension_id,
59 RuntimeFlag flag) const { 59 RuntimeFlag flag) const {
60 ExtensionFlagsMap::const_iterator it = extension_flags_.find(extension_id); 60 ExtensionFlagsMap::const_iterator it = extension_flags_.find(extension_id);
61 if (it == extension_flags_.end()) 61 if (it == extension_flags_.end())
62 return false; 62 return false;
63 return !!(it->second & flag); 63 return !!(it->second & flag);
64 } 64 }
65 65
66 void RuntimeData::SetFlag(const std::string& extension_id, 66 void RuntimeData::SetFlag(const std::string& extension_id,
67 RuntimeFlag flag, 67 RuntimeFlag flag,
68 bool value) { 68 bool value) {
69 if (value) 69 if (value)
70 extension_flags_[extension_id] |= flag; 70 extension_flags_[extension_id] |= flag;
71 else 71 else
72 extension_flags_[extension_id] &= ~flag; 72 extension_flags_[extension_id] &= ~flag;
73 } 73 }
74 74
75 } // namespace extensions 75 } // namespace extensions
OLDNEW
« no previous file with comments | « extensions/browser/runtime_data.h ('k') | extensions/browser/runtime_data_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698