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

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

Issue 133003003: Make ErrorConsole catch errors from Extension WebContents Views (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add missing license Created 6 years, 11 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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_EXTENSION_WEB_CONTENTS_OBSERVER_H_ 5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_WEB_CONTENTS_OBSERVER_H_
6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_WEB_CONTENTS_OBSERVER_H_ 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_WEB_CONTENTS_OBSERVER_H_
7 7
8 #include "base/basictypes.h"
9 #include "base/strings/string16.h"
8 #include "content/public/browser/web_contents_observer.h" 10 #include "content/public/browser/web_contents_observer.h"
9 #include "content/public/browser/web_contents_user_data.h" 11 #include "content/public/browser/web_contents_user_data.h"
12 #include "extensions/common/stack_frame.h"
10 13
11 namespace content { 14 namespace content {
12 class BrowserContext; 15 class BrowserContext;
13 } 16 }
14 17
15 namespace extensions { 18 namespace extensions {
16 class Extension; 19 class Extension;
17 struct Message; 20 struct Message;
18 21
19 // A web contents observer that's used for WebContents in renderer and extension 22 // A web contents observer that's used for WebContents in renderer and extension
20 // processes. Grants the renderer access to certain URL patterns for extensions, 23 // processes. Grants the renderer access to certain URL patterns for extensions,
21 // notifies the renderer that the extension was loaded and routes messages to 24 // notifies the renderer that the extension was loaded and routes messages to
22 // the MessageService. 25 // the MessageService.
23 class ExtensionWebContentsObserver 26 class ExtensionWebContentsObserver
24 : public content::WebContentsObserver, 27 : public content::WebContentsObserver,
25 public content::WebContentsUserData<ExtensionWebContentsObserver> { 28 public content::WebContentsUserData<ExtensionWebContentsObserver> {
26 public: 29 public:
27 virtual ~ExtensionWebContentsObserver(); 30 virtual ~ExtensionWebContentsObserver();
28 31
29 private: 32 private:
30 explicit ExtensionWebContentsObserver(content::WebContents* web_contents); 33 explicit ExtensionWebContentsObserver(content::WebContents* web_contents);
31 friend class content::WebContentsUserData<ExtensionWebContentsObserver>; 34 friend class content::WebContentsUserData<ExtensionWebContentsObserver>;
32 35
33 // content::WebContentsObserver overrides. 36 // content::WebContentsObserver overrides.
34 virtual void RenderViewCreated( 37 virtual void RenderViewCreated(
35 content::RenderViewHost* render_view_host) OVERRIDE; 38 content::RenderViewHost* render_view_host) OVERRIDE;
36 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; 39 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
37 40
38 void OnPostMessage(int port_id, const Message& message); 41 void OnPostMessage(int port_id, const Message& message);
42 void OnDetailedConsoleMessageAdded(const base::string16& message,
43 const base::string16& source,
44 const StackTrace& stack_trace,
45 int32 severity_level);
46
39 47
40 // Gets the extension or app (if any) that is associated with a RVH. 48 // Gets the extension or app (if any) that is associated with a RVH.
41 const Extension* GetExtension(content::RenderViewHost* render_view_host); 49 const Extension* GetExtension(content::RenderViewHost* render_view_host);
42 50
43 // The browser context for the web contents this is observing. 51 // The browser context for the web contents this is observing.
44 content::BrowserContext* browser_context_; 52 content::BrowserContext* browser_context_;
45 53
46 DISALLOW_COPY_AND_ASSIGN(ExtensionWebContentsObserver); 54 DISALLOW_COPY_AND_ASSIGN(ExtensionWebContentsObserver);
47 }; 55 };
48 56
49 } // namespace extensions 57 } // namespace extensions
50 58
51 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_WEB_CONTENTS_OBSERVER_H_ 59 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_WEB_CONTENTS_OBSERVER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698