Add a webstorePrivate API to show a permission prompt for delegated bundle installs
[chromium-blink-merge.git] / chrome / browser / extensions / chrome_extension_web_contents_observer.h
blobc852e97876e91f1d349d36e3fea1a81051f3d565
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.
5 #ifndef CHROME_BROWSER_EXTENSIONS_CHROME_EXTENSION_WEB_CONTENTS_OBSERVER_H_
6 #define CHROME_BROWSER_EXTENSIONS_CHROME_EXTENSION_WEB_CONTENTS_OBSERVER_H_
8 #include "base/compiler_specific.h"
9 #include "base/strings/string16.h"
10 #include "content/public/browser/web_contents_user_data.h"
11 #include "extensions/browser/extension_web_contents_observer.h"
12 #include "extensions/common/stack_frame.h"
14 namespace content {
15 class RenderFrameHost;
18 namespace extensions {
20 // An ExtensionWebContentsObserver that adds support for the extension error
21 // console, reloading crashed extensions and routing extension messages between
22 // renderers.
23 class ChromeExtensionWebContentsObserver
24 : public ExtensionWebContentsObserver,
25 public content::WebContentsUserData<ChromeExtensionWebContentsObserver> {
26 private:
27 friend class content::WebContentsUserData<ChromeExtensionWebContentsObserver>;
29 explicit ChromeExtensionWebContentsObserver(
30 content::WebContents* web_contents);
31 ~ChromeExtensionWebContentsObserver() override;
33 // ExtensionWebContentsObserver:
34 void InitializeRenderFrame(
35 content::RenderFrameHost* render_frame_host) override;
37 // content::WebContentsObserver overrides.
38 void RenderViewCreated(content::RenderViewHost* render_view_host) override;
40 // Silence a warning about hiding a virtual function.
41 bool OnMessageReceived(const IPC::Message& message,
42 content::RenderFrameHost* render_frame_host) override;
44 // Adds a message to the extensions ErrorConsole.
45 void OnDetailedConsoleMessageAdded(const base::string16& message,
46 const base::string16& source,
47 const StackTrace& stack_trace,
48 int32 severity_level);
50 // Reloads an extension if it is on the terminated list.
51 void ReloadIfTerminated(content::RenderViewHost* render_view_host);
53 DISALLOW_COPY_AND_ASSIGN(ChromeExtensionWebContentsObserver);
56 } // namespace extensions
58 #endif // CHROME_BROWSER_EXTENSIONS_CHROME_EXTENSION_WEB_CONTENTS_OBSERVER_H_