shell_extension_web_contents_observer.h 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. // Copyright 2014 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_SHELL_BROWSER_SHELL_EXTENSION_WEB_CONTENTS_OBSERVER_H_
  5. #define EXTENSIONS_SHELL_BROWSER_SHELL_EXTENSION_WEB_CONTENTS_OBSERVER_H_
  6. #include "content/public/browser/web_contents_user_data.h"
  7. #include "extensions/browser/extension_web_contents_observer.h"
  8. namespace extensions {
  9. // The app_shell version of ExtensionWebContentsObserver.
  10. class ShellExtensionWebContentsObserver
  11. : public ExtensionWebContentsObserver,
  12. public content::WebContentsUserData<ShellExtensionWebContentsObserver> {
  13. public:
  14. ShellExtensionWebContentsObserver(const ShellExtensionWebContentsObserver&) =
  15. delete;
  16. ShellExtensionWebContentsObserver& operator=(
  17. const ShellExtensionWebContentsObserver&) = delete;
  18. ~ShellExtensionWebContentsObserver() override;
  19. // Creates and initializes an instance of this class for the given
  20. // |web_contents|, if it doesn't already exist.
  21. static void CreateForWebContents(content::WebContents* web_contents);
  22. private:
  23. friend class content::WebContentsUserData<ShellExtensionWebContentsObserver>;
  24. explicit ShellExtensionWebContentsObserver(
  25. content::WebContents* web_contents);
  26. WEB_CONTENTS_USER_DATA_KEY_DECL();
  27. };
  28. } // namespace extensions
  29. #endif // EXTENSIONS_SHELL_BROWSER_SHELL_EXTENSION_WEB_CONTENTS_OBSERVER_H_