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

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

Issue 134393003: app_shell: Convert ExtensionsWebContentsObserver to BrowserContext from Profile (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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 | Annotate | Revision Log
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 "content/public/browser/web_contents_observer.h" 8 #include "content/public/browser/web_contents_observer.h"
9 #include "content/public/browser/web_contents_user_data.h" 9 #include "content/public/browser/web_contents_user_data.h"
10 10
11 class Profile; 11 namespace content {
12 class BrowserContext;
13 }
12 14
13 namespace extensions { 15 namespace extensions {
14 class Extension; 16 class Extension;
15 struct Message; 17 struct Message;
16 18
17 // A web contents observer that's used for WebContents in renderer and extension 19 // A web contents observer that's used for WebContents in renderer and extension
18 // processes. 20 // processes. Grants the renderer access to certain URL patterns for extensions,
21 // notifies the renderer that the extension was loaded and routes messages to
22 // the MessageService.
19 class ExtensionWebContentsObserver 23 class ExtensionWebContentsObserver
20 : public content::WebContentsObserver, 24 : public content::WebContentsObserver,
21 public content::WebContentsUserData<ExtensionWebContentsObserver> { 25 public content::WebContentsUserData<ExtensionWebContentsObserver> {
22 public: 26 public:
23 virtual ~ExtensionWebContentsObserver(); 27 virtual ~ExtensionWebContentsObserver();
24 28
25 private: 29 private:
26 explicit ExtensionWebContentsObserver(content::WebContents* web_contents); 30 explicit ExtensionWebContentsObserver(content::WebContents* web_contents);
27 friend class content::WebContentsUserData<ExtensionWebContentsObserver>; 31 friend class content::WebContentsUserData<ExtensionWebContentsObserver>;
28 32
29 // content::WebContentsObserver overrides. 33 // content::WebContentsObserver overrides.
30 virtual void RenderViewCreated( 34 virtual void RenderViewCreated(
31 content::RenderViewHost* render_view_host) OVERRIDE; 35 content::RenderViewHost* render_view_host) OVERRIDE;
32 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; 36 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
33 37
34 void OnPostMessage(int port_id, const Message& message); 38 void OnPostMessage(int port_id, const Message& message);
35 39
36 // Gets the extension or app (if any) that is associated with a RVH. 40 // Gets the extension or app (if any) that is associated with a RVH.
37 const Extension* GetExtension(content::RenderViewHost* render_view_host); 41 const Extension* GetExtension(content::RenderViewHost* render_view_host);
38 42
39 Profile* profile_; 43 // The browser context for the web contents this is observing.
44 content::BrowserContext* browser_context_;
40 45
41 DISALLOW_COPY_AND_ASSIGN(ExtensionWebContentsObserver); 46 DISALLOW_COPY_AND_ASSIGN(ExtensionWebContentsObserver);
42 }; 47 };
43 48
44 } // namespace extensions 49 } // namespace extensions
45 50
46 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_WEB_CONTENTS_OBSERVER_H_ 51 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_WEB_CONTENTS_OBSERVER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698