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

Side by Side Diff: chrome/browser/chromeos/launcher_search_provider/launcher_search_provider_service.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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/chromeos/launcher_search_provider/launcher_search_provi der_service.h" 5 #include "chrome/browser/chromeos/launcher_search_provider/launcher_search_provi der_service.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include <utility> 9 #include <utility>
10 10
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 bool Service::IsQueryRunning() const { 145 bool Service::IsQueryRunning() const {
146 return is_query_running_; 146 return is_query_running_;
147 } 147 }
148 148
149 void Service::OnExtensionLoaded(content::BrowserContext* browser_context, 149 void Service::OnExtensionLoaded(content::BrowserContext* browser_context,
150 const extensions::Extension* extension) { 150 const extensions::Extension* extension) {
151 // Invalidate cache. 151 // Invalidate cache.
152 cached_listener_extension_ids_.reset(); 152 cached_listener_extension_ids_.reset();
153 } 153 }
154 154
155 void Service::OnExtensionUnloaded( 155 void Service::OnExtensionUnloaded(content::BrowserContext* browser_context,
156 content::BrowserContext* browser_context, 156 const extensions::Extension* extension,
157 const extensions::Extension* extension, 157 extensions::UnloadedExtensionReason reason) {
158 extensions::UnloadedExtensionInfo::Reason reason) {
159 // Invalidate cache. 158 // Invalidate cache.
160 cached_listener_extension_ids_.reset(); 159 cached_listener_extension_ids_.reset();
161 } 160 }
162 161
163 void Service::CacheListenerExtensionIds() { 162 void Service::CacheListenerExtensionIds() {
164 // If it's already cached, do nothing. 163 // If it's already cached, do nothing.
165 if (cached_listener_extension_ids_) 164 if (cached_listener_extension_ids_)
166 return; 165 return;
167 166
168 cached_listener_extension_ids_.reset(new std::set<ExtensionId>()); 167 cached_listener_extension_ids_.reset(new std::set<ExtensionId>());
169 168
170 const ExtensionSet& extension_set = extension_registry_->enabled_extensions(); 169 const ExtensionSet& extension_set = extension_registry_->enabled_extensions();
171 for (scoped_refptr<const extensions::Extension> extension : extension_set) { 170 for (scoped_refptr<const extensions::Extension> extension : extension_set) {
172 const extensions::PermissionsData* permission_data = 171 const extensions::PermissionsData* permission_data =
173 extension->permissions_data(); 172 extension->permissions_data();
174 const bool has_permission = permission_data->HasAPIPermission( 173 const bool has_permission = permission_data->HasAPIPermission(
175 extensions::APIPermission::kLauncherSearchProvider); 174 extensions::APIPermission::kLauncherSearchProvider);
176 if (has_permission) 175 if (has_permission)
177 cached_listener_extension_ids_->insert(extension->id()); 176 cached_listener_extension_ids_->insert(extension->id());
178 } 177 }
179 } 178 }
180 179
181 } // namespace launcher_search_provider 180 } // namespace launcher_search_provider
182 } // namespace chromeos 181 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698