extension_host_observer.h 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  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
  3. // found in the LICENSE file.
  4. #ifndef EXTENSIONS_BROWSER_EXTENSION_HOST_OBSERVER_H_
  5. #define EXTENSIONS_BROWSER_EXTENSION_HOST_OBSERVER_H_
  6. #include <stdint.h>
  7. #include <string>
  8. namespace extensions {
  9. class ExtensionHost;
  10. class ExtensionHostObserver {
  11. public:
  12. virtual ~ExtensionHostObserver() {}
  13. // TODO(kalman): Why do these all return const ExtensionHosts? It seems
  14. // perfectly reasonable for an Observer implementation to mutate any
  15. // ExtensionHost it's given.
  16. // Called when an ExtensionHost is destroyed.
  17. virtual void OnExtensionHostDestroyed(ExtensionHost* host) {}
  18. // Called when the ExtensionHost has finished the first load.
  19. virtual void OnExtensionHostDidStopFirstLoad(const ExtensionHost* host) {}
  20. // Called when a message has been disptached to the event page corresponding
  21. // to |host|.
  22. virtual void OnBackgroundEventDispatched(const ExtensionHost* host,
  23. const std::string& event_name,
  24. int event_id) {}
  25. // Called when a previously dispatched message has been acked by the
  26. // event page for |host|.
  27. virtual void OnBackgroundEventAcked(const ExtensionHost* host, int event_id) {
  28. }
  29. // Called when the extension associated with |host| starts a new network
  30. // request.
  31. virtual void OnNetworkRequestStarted(const ExtensionHost* host,
  32. uint64_t request_id) {}
  33. // Called when the network request with |request_id| is done.
  34. virtual void OnNetworkRequestDone(const ExtensionHost* host,
  35. uint64_t request_id) {}
  36. };
  37. } // namespace extensions
  38. #endif // EXTENSIONS_BROWSER_EXTENSION_HOST_OBSERVER_H_