2019-07-24 23:01:08 +00:00
|
|
|
// Copyright 2014 The Chromium Authors. All rights reserved.
|
|
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
|
|
// found in the LICENSE file.
|
|
|
|
|
2020-02-03 22:01:10 +00:00
|
|
|
#ifndef SHELL_BROWSER_EXTENSIONS_ELECTRON_EXTENSION_WEB_CONTENTS_OBSERVER_H_
|
|
|
|
#define SHELL_BROWSER_EXTENSIONS_ELECTRON_EXTENSION_WEB_CONTENTS_OBSERVER_H_
|
2019-07-24 23:01:08 +00:00
|
|
|
|
|
|
|
#include "content/public/browser/web_contents_user_data.h"
|
|
|
|
#include "extensions/browser/extension_web_contents_observer.h"
|
|
|
|
|
|
|
|
namespace extensions {
|
|
|
|
|
|
|
|
// The app_shell version of ExtensionWebContentsObserver.
|
2020-02-03 22:01:10 +00:00
|
|
|
class ElectronExtensionWebContentsObserver
|
2019-07-24 23:01:08 +00:00
|
|
|
: public ExtensionWebContentsObserver,
|
2020-02-03 22:01:10 +00:00
|
|
|
public content::WebContentsUserData<
|
|
|
|
ElectronExtensionWebContentsObserver> {
|
2019-07-24 23:01:08 +00:00
|
|
|
public:
|
2020-02-03 22:01:10 +00:00
|
|
|
~ElectronExtensionWebContentsObserver() override;
|
2019-07-24 23:01:08 +00:00
|
|
|
|
2021-11-03 11:41:45 +00:00
|
|
|
// disable copy
|
|
|
|
ElectronExtensionWebContentsObserver(
|
|
|
|
const ElectronExtensionWebContentsObserver&) = delete;
|
|
|
|
ElectronExtensionWebContentsObserver& operator=(
|
|
|
|
const ElectronExtensionWebContentsObserver&) = delete;
|
|
|
|
|
2019-07-24 23:01:08 +00:00
|
|
|
// Creates and initializes an instance of this class for the given
|
|
|
|
// |web_contents|, if it doesn't already exist.
|
|
|
|
static void CreateForWebContents(content::WebContents* web_contents);
|
|
|
|
|
|
|
|
private:
|
2020-02-03 22:01:10 +00:00
|
|
|
friend class content::WebContentsUserData<
|
|
|
|
ElectronExtensionWebContentsObserver>;
|
2019-07-24 23:01:08 +00:00
|
|
|
|
2020-02-03 22:01:10 +00:00
|
|
|
explicit ElectronExtensionWebContentsObserver(
|
|
|
|
content::WebContents* web_contents);
|
2019-07-24 23:01:08 +00:00
|
|
|
|
|
|
|
WEB_CONTENTS_USER_DATA_KEY_DECL();
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace extensions
|
|
|
|
|
2020-02-03 22:01:10 +00:00
|
|
|
#endif // SHELL_BROWSER_EXTENSIONS_ELECTRON_EXTENSION_WEB_CONTENTS_OBSERVER_H_
|