Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(178)

Side by Side Diff: chrome/browser/extensions/chrome_extension_web_contents_observer.h

Issue 402673003: Move ExtensionHostMsg_PostMessage IPC handling from (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: use override thread Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROME_BROWSER_EXTENSIONS_CHROME_EXTENSION_WEB_CONTENTS_OBSERVER_H_ 5 #ifndef CHROME_BROWSER_EXTENSIONS_CHROME_EXTENSION_WEB_CONTENTS_OBSERVER_H_
6 #define CHROME_BROWSER_EXTENSIONS_CHROME_EXTENSION_WEB_CONTENTS_OBSERVER_H_ 6 #define CHROME_BROWSER_EXTENSIONS_CHROME_EXTENSION_WEB_CONTENTS_OBSERVER_H_
7 7
8 #include "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "base/strings/string16.h" 9 #include "base/strings/string16.h"
10 #include "content/public/browser/web_contents_user_data.h" 10 #include "content/public/browser/web_contents_user_data.h"
11 #include "extensions/browser/extension_web_contents_observer.h" 11 #include "extensions/browser/extension_web_contents_observer.h"
12 #include "extensions/common/stack_frame.h" 12 #include "extensions/common/stack_frame.h"
13 13
14 namespace content { 14 namespace content {
15 class RenderFrameHost; 15 class RenderFrameHost;
16 } 16 }
17 17
18 namespace extensions { 18 namespace extensions {
19 struct Message;
20 19
21 // An ExtensionWebContentsObserver that adds support for the extension error 20 // An ExtensionWebContentsObserver that adds support for the extension error
22 // console, reloading crashed extensions and routing extension messages between 21 // console, reloading crashed extensions and routing extension messages between
23 // renderers. 22 // renderers.
24 class ChromeExtensionWebContentsObserver 23 class ChromeExtensionWebContentsObserver
25 : public ExtensionWebContentsObserver, 24 : public ExtensionWebContentsObserver,
26 public content::WebContentsUserData<ChromeExtensionWebContentsObserver> { 25 public content::WebContentsUserData<ChromeExtensionWebContentsObserver> {
27 private: 26 private:
28 friend class content::WebContentsUserData<ChromeExtensionWebContentsObserver>; 27 friend class content::WebContentsUserData<ChromeExtensionWebContentsObserver>;
29 28
30 explicit ChromeExtensionWebContentsObserver( 29 explicit ChromeExtensionWebContentsObserver(
31 content::WebContents* web_contents); 30 content::WebContents* web_contents);
32 virtual ~ChromeExtensionWebContentsObserver(); 31 virtual ~ChromeExtensionWebContentsObserver();
33 32
34 // content::WebContentsObserver overrides. 33 // content::WebContentsObserver overrides.
35 virtual void RenderViewCreated(content::RenderViewHost* render_view_host) 34 virtual void RenderViewCreated(content::RenderViewHost* render_view_host)
36 OVERRIDE; 35 OVERRIDE;
37 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
38 virtual bool OnMessageReceived( 36 virtual bool OnMessageReceived(
39 const IPC::Message& message, 37 const IPC::Message& message,
40 content::RenderFrameHost* render_frame_host) OVERRIDE; 38 content::RenderFrameHost* render_frame_host) OVERRIDE;
41 39
42 // Routes a message to the extensions MessageService.
43 void OnPostMessage(int port_id, const Message& message);
44
45 // Adds a message to the extensions ErrorConsole. 40 // Adds a message to the extensions ErrorConsole.
46 void OnDetailedConsoleMessageAdded(const base::string16& message, 41 void OnDetailedConsoleMessageAdded(const base::string16& message,
47 const base::string16& source, 42 const base::string16& source,
48 const StackTrace& stack_trace, 43 const StackTrace& stack_trace,
49 int32 severity_level); 44 int32 severity_level);
50 45
51 // Reloads an extension if it is on the terminated list. 46 // Reloads an extension if it is on the terminated list.
52 void ReloadIfTerminated(content::RenderViewHost* render_view_host); 47 void ReloadIfTerminated(content::RenderViewHost* render_view_host);
53 48
54 DISALLOW_COPY_AND_ASSIGN(ChromeExtensionWebContentsObserver); 49 DISALLOW_COPY_AND_ASSIGN(ChromeExtensionWebContentsObserver);
55 }; 50 };
56 51
57 } // namespace extensions 52 } // namespace extensions
58 53
59 #endif // CHROME_BROWSER_EXTENSIONS_CHROME_EXTENSION_WEB_CONTENTS_OBSERVER_H_ 54 #endif // CHROME_BROWSER_EXTENSIONS_CHROME_EXTENSION_WEB_CONTENTS_OBSERVER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698