| OLD | NEW |
| (Empty) |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_POPUP_API_H_ | |
| 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_POPUP_API_H_ | |
| 7 #pragma once | |
| 8 | |
| 9 #include "chrome/browser/extensions/extension_function.h" | |
| 10 #include "chrome/common/notification_observer.h" | |
| 11 #include "chrome/common/notification_registrar.h" | |
| 12 | |
| 13 class Profile; | |
| 14 class ExtensionPopup; | |
| 15 | |
| 16 // This extension function shows a pop-up extension view. It is asynchronous | |
| 17 // because the callback must be invoked only after the associated render | |
| 18 // process/view has been created and fully initialized. | |
| 19 class PopupShowFunction : public AsyncExtensionFunction, | |
| 20 public NotificationObserver { | |
| 21 public: | |
| 22 PopupShowFunction(); | |
| 23 | |
| 24 virtual void Run(); | |
| 25 virtual bool RunImpl(); | |
| 26 DECLARE_EXTENSION_FUNCTION_NAME("experimental.popup.show") | |
| 27 | |
| 28 private: | |
| 29 // NotificationObserver methods. | |
| 30 virtual void Observe(NotificationType type, | |
| 31 const NotificationSource& source, | |
| 32 const NotificationDetails& details); | |
| 33 NotificationRegistrar registrar_; | |
| 34 | |
| 35 #if defined(TOOLKIT_VIEWS) | |
| 36 // The pop-up view created by this function, saved for access during | |
| 37 // event notification. The pop-up is not owned by the PopupShowFunction | |
| 38 // instance. | |
| 39 ExtensionPopup* popup_; | |
| 40 #endif | |
| 41 }; | |
| 42 | |
| 43 // Event router class for events related to the chrome.popup.* set of APIs. | |
| 44 class PopupEventRouter { | |
| 45 public: | |
| 46 static void OnPopupClosed(Profile* profile, | |
| 47 int routing_id); | |
| 48 private: | |
| 49 DISALLOW_COPY_AND_ASSIGN(PopupEventRouter); | |
| 50 }; | |
| 51 | |
| 52 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_POPUP_API_H_ | |
| OLD | NEW |