OLD | NEW |
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/extensions/api/developer_private/extension_info_generat
or.h" | 5 #include "chrome/browser/extensions/api/developer_private/extension_info_generat
or.h" |
6 | 6 |
7 #include "base/base64.h" | 7 #include "base/base64.h" |
8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
9 #include "chrome/browser/extensions/api/developer_private/inspectable_views_find
er.h" | 9 #include "chrome/browser/extensions/api/developer_private/inspectable_views_find
er.h" |
10 #include "chrome/browser/extensions/api/extension_action/extension_action_api.h" | 10 #include "chrome/browser/extensions/api/extension_action/extension_action_api.h" |
(...skipping 490 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
501 void ExtensionInfoGenerator::OnImageLoaded( | 501 void ExtensionInfoGenerator::OnImageLoaded( |
502 scoped_ptr<developer::ExtensionInfo> info, | 502 scoped_ptr<developer::ExtensionInfo> info, |
503 const gfx::Image& icon) { | 503 const gfx::Image& icon) { |
504 info->icon_url = GetIconUrlFromImage( | 504 info->icon_url = GetIconUrlFromImage( |
505 icon, info->state != developer::EXTENSION_STATE_ENABLED); | 505 icon, info->state != developer::EXTENSION_STATE_ENABLED); |
506 list_.push_back(make_linked_ptr(info.release())); | 506 list_.push_back(make_linked_ptr(info.release())); |
507 | 507 |
508 --pending_image_loads_; | 508 --pending_image_loads_; |
509 | 509 |
510 if (pending_image_loads_ == 0) { // All done! | 510 if (pending_image_loads_ == 0) { // All done! |
511 // We assign to a temporary and Reset() so that at the end of the method, | 511 // We assign to a temporary callback and list and reset the stored values so |
512 // any stored refs are destroyed. | 512 // that at the end of the method, any stored refs are destroyed. |
| 513 ExtensionInfoList list; |
| 514 list.swap(list_); |
513 ExtensionInfosCallback callback = callback_; | 515 ExtensionInfosCallback callback = callback_; |
514 callback_.Reset(); | 516 callback_.Reset(); |
515 callback.Run(list_); | 517 callback.Run(list); // WARNING: |this| is possibly deleted after this line! |
516 list_.clear(); | |
517 } | 518 } |
518 } | 519 } |
519 | 520 |
520 } // namespace extensions | 521 } // namespace extensions |
OLD | NEW |