OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/api/developer_private/developer_private_api.
h" | 5 #include "chrome/browser/extensions/api/developer_private/developer_private_api.
h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/files/file_util.h" | 8 #include "base/files/file_util.h" |
9 #include "base/lazy_instance.h" | 9 #include "base/lazy_instance.h" |
10 #include "base/metrics/histogram_macros.h" | 10 #include "base/metrics/histogram_macros.h" |
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
239 const Extension* extension, | 239 const Extension* extension, |
240 extensions::UninstallReason reason) { | 240 extensions::UninstallReason reason) { |
241 DCHECK(profile_->IsSameProfile(Profile::FromBrowserContext(browser_context))); | 241 DCHECK(profile_->IsSameProfile(Profile::FromBrowserContext(browser_context))); |
242 BroadcastItemStateChanged(developer::EVENT_TYPE_UNINSTALLED, extension->id()); | 242 BroadcastItemStateChanged(developer::EVENT_TYPE_UNINSTALLED, extension->id()); |
243 } | 243 } |
244 | 244 |
245 void DeveloperPrivateEventRouter::OnErrorAdded(const ExtensionError* error) { | 245 void DeveloperPrivateEventRouter::OnErrorAdded(const ExtensionError* error) { |
246 // We don't want to handle errors thrown by extensions subscribed to these | 246 // We don't want to handle errors thrown by extensions subscribed to these |
247 // events (currently only the Apps Developer Tool), because doing so risks | 247 // events (currently only the Apps Developer Tool), because doing so risks |
248 // entering a loop. | 248 // entering a loop. |
249 if (extension_ids_.find(error->extension_id()) != extension_ids_.end()) | 249 if (extension_ids_.count(error->extension_id())) |
250 return; | 250 return; |
251 | 251 |
252 BroadcastItemStateChanged(developer::EVENT_TYPE_ERROR_ADDED, | 252 BroadcastItemStateChanged(developer::EVENT_TYPE_ERROR_ADDED, |
253 error->extension_id()); | 253 error->extension_id()); |
254 } | 254 } |
255 | 255 |
| 256 void DeveloperPrivateEventRouter::OnErrorsRemoved( |
| 257 const std::set<std::string>& removed_ids) { |
| 258 for (const std::string& id : removed_ids) { |
| 259 if (!extension_ids_.count(id)) |
| 260 BroadcastItemStateChanged(developer::EVENT_TYPE_ERRORS_REMOVED, id); |
| 261 } |
| 262 } |
| 263 |
256 void DeveloperPrivateEventRouter::OnExtensionFrameRegistered( | 264 void DeveloperPrivateEventRouter::OnExtensionFrameRegistered( |
257 const std::string& extension_id, | 265 const std::string& extension_id, |
258 content::RenderFrameHost* render_frame_host) { | 266 content::RenderFrameHost* render_frame_host) { |
259 BroadcastItemStateChanged(developer::EVENT_TYPE_VIEW_REGISTERED, | 267 BroadcastItemStateChanged(developer::EVENT_TYPE_VIEW_REGISTERED, |
260 extension_id); | 268 extension_id); |
261 } | 269 } |
262 | 270 |
263 void DeveloperPrivateEventRouter::OnExtensionFrameUnregistered( | 271 void DeveloperPrivateEventRouter::OnExtensionFrameUnregistered( |
264 const std::string& extension_id, | 272 const std::string& extension_id, |
265 content::RenderFrameHost* render_frame_host) { | 273 content::RenderFrameHost* render_frame_host) { |
(...skipping 1069 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1335 // We explicitly show manifest.json in order to work around an issue in OSX | 1343 // We explicitly show manifest.json in order to work around an issue in OSX |
1336 // where opening the directory doesn't focus the Finder. | 1344 // where opening the directory doesn't focus the Finder. |
1337 platform_util::ShowItemInFolder(GetProfile(), | 1345 platform_util::ShowItemInFolder(GetProfile(), |
1338 extension->path().Append(kManifestFilename)); | 1346 extension->path().Append(kManifestFilename)); |
1339 return RespondNow(NoArguments()); | 1347 return RespondNow(NoArguments()); |
1340 } | 1348 } |
1341 | 1349 |
1342 } // namespace api | 1350 } // namespace api |
1343 | 1351 |
1344 } // namespace extensions | 1352 } // namespace extensions |
OLD | NEW |