| 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/base64.h" | 7 #include "base/base64.h" |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/files/file_util.h" | 9 #include "base/files/file_util.h" |
| 10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
| (...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 301 extensions::UninstallReason reason) { | 301 extensions::UninstallReason reason) { |
| 302 DCHECK(profile_->IsSameProfile(Profile::FromBrowserContext(browser_context))); | 302 DCHECK(profile_->IsSameProfile(Profile::FromBrowserContext(browser_context))); |
| 303 BroadcastItemStateChanged( | 303 BroadcastItemStateChanged( |
| 304 browser_context, developer::EVENT_TYPE_UNINSTALLED, extension->id()); | 304 browser_context, developer::EVENT_TYPE_UNINSTALLED, extension->id()); |
| 305 } | 305 } |
| 306 | 306 |
| 307 void DeveloperPrivateEventRouter::OnErrorAdded(const ExtensionError* error) { | 307 void DeveloperPrivateEventRouter::OnErrorAdded(const ExtensionError* error) { |
| 308 // We don't want to handle errors thrown by extensions subscribed to these | 308 // We don't want to handle errors thrown by extensions subscribed to these |
| 309 // events (currently only the Apps Developer Tool), because doing so risks | 309 // events (currently only the Apps Developer Tool), because doing so risks |
| 310 // entering a loop. | 310 // entering a loop. |
| 311 if (extension_ids_.find(error->extension_id()) != extension_ids_.end()) | 311 if (extension_ids_.count(error->extension_id())) |
| 312 return; | 312 return; |
| 313 | 313 |
| 314 BroadcastItemStateChanged( | 314 BroadcastItemStateChanged( |
| 315 profile_, developer::EVENT_TYPE_ERROR_ADDED, error->extension_id()); | 315 profile_, developer::EVENT_TYPE_ERROR_ADDED, error->extension_id()); |
| 316 } | 316 } |
| 317 | 317 |
| 318 void DeveloperPrivateEventRouter::OnErrorsRemoved( |
| 319 const std::set<std::string>& removed_ids) { |
| 320 for (const std::string& id : removed_ids) { |
| 321 if (!extension_ids_.count(id)) { |
| 322 BroadcastItemStateChanged( |
| 323 profile_, developer::EVENT_TYPE_ERRORS_REMOVED, id); |
| 324 } |
| 325 } |
| 326 } |
| 327 |
| 318 void DeveloperPrivateEventRouter::OnExtensionFrameRegistered( | 328 void DeveloperPrivateEventRouter::OnExtensionFrameRegistered( |
| 319 const std::string& extension_id, | 329 const std::string& extension_id, |
| 320 content::RenderFrameHost* render_frame_host) { | 330 content::RenderFrameHost* render_frame_host) { |
| 321 BroadcastItemStateChanged( | 331 BroadcastItemStateChanged( |
| 322 profile_, developer::EVENT_TYPE_VIEW_REGISTERED, extension_id); | 332 profile_, developer::EVENT_TYPE_VIEW_REGISTERED, extension_id); |
| 323 } | 333 } |
| 324 | 334 |
| 325 void DeveloperPrivateEventRouter::OnExtensionFrameUnregistered( | 335 void DeveloperPrivateEventRouter::OnExtensionFrameUnregistered( |
| 326 const std::string& extension_id, | 336 const std::string& extension_id, |
| 327 content::RenderFrameHost* render_frame_host) { | 337 content::RenderFrameHost* render_frame_host) { |
| (...skipping 1045 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1373 // We explicitly show manifest.json in order to work around an issue in OSX | 1383 // We explicitly show manifest.json in order to work around an issue in OSX |
| 1374 // where opening the directory doesn't focus the Finder. | 1384 // where opening the directory doesn't focus the Finder. |
| 1375 platform_util::ShowItemInFolder(GetProfile(), | 1385 platform_util::ShowItemInFolder(GetProfile(), |
| 1376 extension->path().Append(kManifestFilename)); | 1386 extension->path().Append(kManifestFilename)); |
| 1377 return RespondNow(NoArguments()); | 1387 return RespondNow(NoArguments()); |
| 1378 } | 1388 } |
| 1379 | 1389 |
| 1380 } // namespace api | 1390 } // namespace api |
| 1381 | 1391 |
| 1382 } // namespace extensions | 1392 } // namespace extensions |
| OLD | NEW |