2015-07-16 23:40:01 +02: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.
|
|
|
|
|
|
|
|
#ifndef CEF_LIBCEF_BROWSER_EXTENSIONS_EXTENSION_WEB_CONTENTS_OBSERVER_H_
|
|
|
|
#define CEF_LIBCEF_BROWSER_EXTENSIONS_EXTENSION_WEB_CONTENTS_OBSERVER_H_
|
|
|
|
|
2017-08-04 00:55:19 +02:00
|
|
|
#include <memory>
|
|
|
|
|
|
|
|
#include "base/observer_list.h"
|
2015-07-16 23:40:01 +02:00
|
|
|
#include "content/public/browser/web_contents_user_data.h"
|
|
|
|
#include "extensions/browser/extension_web_contents_observer.h"
|
2017-08-04 00:55:19 +02:00
|
|
|
#include "extensions/browser/script_execution_observer.h"
|
|
|
|
#include "extensions/browser/script_executor.h"
|
2015-07-16 23:40:01 +02:00
|
|
|
|
|
|
|
namespace extensions {
|
|
|
|
|
|
|
|
// The CEF version of ExtensionWebContentsObserver.
|
|
|
|
class CefExtensionWebContentsObserver
|
|
|
|
: public ExtensionWebContentsObserver,
|
|
|
|
public content::WebContentsUserData<CefExtensionWebContentsObserver> {
|
2017-05-31 17:33:30 +02:00
|
|
|
public:
|
|
|
|
~CefExtensionWebContentsObserver() override;
|
|
|
|
|
2017-08-04 00:55:19 +02:00
|
|
|
ScriptExecutor* script_executor() { return script_executor_.get(); }
|
|
|
|
|
2015-07-16 23:40:01 +02:00
|
|
|
private:
|
|
|
|
friend class content::WebContentsUserData<CefExtensionWebContentsObserver>;
|
|
|
|
|
2017-05-17 11:29:28 +02:00
|
|
|
explicit CefExtensionWebContentsObserver(content::WebContents* web_contents);
|
2015-07-16 23:40:01 +02:00
|
|
|
|
2015-10-09 17:23:12 +02:00
|
|
|
// content::WebContentsObserver overrides.
|
2017-09-06 23:40:58 +02:00
|
|
|
void RenderFrameCreated(content::RenderFrameHost* render_frame_host) override;
|
2015-10-09 17:23:12 +02:00
|
|
|
|
2017-08-04 00:55:19 +02:00
|
|
|
// Our content script observers. Declare at top so that it will outlive all
|
|
|
|
// other members, since they might add themselves as observers.
|
|
|
|
base::ObserverList<ScriptExecutionObserver> script_execution_observers_;
|
|
|
|
|
|
|
|
std::unique_ptr<ScriptExecutor> script_executor_;
|
|
|
|
|
2015-07-16 23:40:01 +02:00
|
|
|
DISALLOW_COPY_AND_ASSIGN(CefExtensionWebContentsObserver);
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace extensions
|
|
|
|
|
|
|
|
#endif // CEF_LIBCEF_BROWSER_EXTENSIONS_EXTENSION_WEB_CONTENTS_OBSERVER_H_
|