| 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/extension_action/extension_action_api.h" | 5 #include "chrome/browser/extensions/api/extension_action/extension_action_api.h" |
| 6 | 6 |
| 7 #include "base/base64.h" | 7 #include "base/base64.h" |
| 8 #include "base/lazy_instance.h" | 8 #include "base/lazy_instance.h" |
| 9 #include "base/strings/string_number_conversions.h" | 9 #include "base/strings/string_number_conversions.h" |
| 10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
| (...skipping 764 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 775 : response_sent_(false) { | 775 : response_sent_(false) { |
| 776 } | 776 } |
| 777 | 777 |
| 778 bool BrowserActionOpenPopupFunction::RunAsync() { | 778 bool BrowserActionOpenPopupFunction::RunAsync() { |
| 779 ExtensionToolbarModel* model = ExtensionToolbarModel::Get(GetProfile()); | 779 ExtensionToolbarModel* model = ExtensionToolbarModel::Get(GetProfile()); |
| 780 if (!model) { | 780 if (!model) { |
| 781 error_ = kInternalError; | 781 error_ = kInternalError; |
| 782 return false; | 782 return false; |
| 783 } | 783 } |
| 784 | 784 |
| 785 if (!model->ShowBrowserActionPopup(extension_)) { | 785 if (!model->ShowBrowserActionPopup(extension_.get())) { |
| 786 error_ = kOpenPopupError; | 786 error_ = kOpenPopupError; |
| 787 return false; | 787 return false; |
| 788 } | 788 } |
| 789 | 789 |
| 790 registrar_.Add(this, | 790 registrar_.Add(this, |
| 791 NOTIFICATION_EXTENSION_HOST_DID_STOP_LOADING, | 791 NOTIFICATION_EXTENSION_HOST_DID_STOP_LOADING, |
| 792 content::Source<Profile>(GetProfile())); | 792 content::Source<Profile>(GetProfile())); |
| 793 | 793 |
| 794 // Set a timeout for waiting for the notification that the popup is loaded. | 794 // Set a timeout for waiting for the notification that the popup is loaded. |
| 795 // Waiting is required so that the popup view can be retrieved by the custom | 795 // Waiting is required so that the popup view can be retrieved by the custom |
| (...skipping 28 matching lines...) Expand all Loading... |
| 824 if (host->extension_host_type() != VIEW_TYPE_EXTENSION_POPUP || | 824 if (host->extension_host_type() != VIEW_TYPE_EXTENSION_POPUP || |
| 825 host->extension()->id() != extension_->id()) | 825 host->extension()->id() != extension_->id()) |
| 826 return; | 826 return; |
| 827 | 827 |
| 828 SendResponse(true); | 828 SendResponse(true); |
| 829 response_sent_ = true; | 829 response_sent_ = true; |
| 830 registrar_.RemoveAll(); | 830 registrar_.RemoveAll(); |
| 831 } | 831 } |
| 832 | 832 |
| 833 } // namespace extensions | 833 } // namespace extensions |
| OLD | NEW |