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

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

Issue 8113006: Add js api for hosted/pacakged apps to request notification authorization (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebased Created 9 years, 2 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 (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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_MESSAGE_HANDLER_H_ 5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_MESSAGE_HANDLER_H_
6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_MESSAGE_HANDLER_H_ 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_MESSAGE_HANDLER_H_
7 #pragma once 7 #pragma once
8 8
9 #include "base/memory/weak_ptr.h"
10 #include "chrome/browser/extensions/app_notify_channel_setup.h"
9 #include "content/browser/renderer_host/render_view_host_observer.h" 11 #include "content/browser/renderer_host/render_view_host_observer.h"
10 12
13 class GURL;
11 class Profile; 14 class Profile;
12 struct ExtensionHostMsg_DomMessage_Params; 15 struct ExtensionHostMsg_DomMessage_Params;
13 16
14 // Filters and dispatches extension-related IPC messages that arrive from 17 // Filters and dispatches extension-related IPC messages that arrive from
15 // renderers. There is one of these objects for each RenderViewHost in Chrome. 18 // renderers. There is one of these objects for each RenderViewHost in Chrome.
16 // Contrast this with ExtensionTabHelper, which is only created for TabContents. 19 // Contrast this with ExtensionTabHelper, which is only created for TabContents.
17 // 20 //
18 // TODO(aa): Handling of content script messaging should be able to move to EFD 21 // TODO(aa): Handling of content script messaging should be able to move to EFD
19 // once there is an EFD for every RVHD where extension code can run. Then we 22 // once there is an EFD for every RVHD where extension code can run. Then we
20 // could eliminate this class. Right now, we don't end up with an EFD for tab 23 // could eliminate this class. Right now, we don't end up with an EFD for tab
21 // contents unless that tab contents is hosting chrome-extension:// URLs. That 24 // contents unless that tab contents is hosting chrome-extension:// URLs. That
22 // still leaves content scripts. See also: crbug.com/80307. 25 // still leaves content scripts. See also: crbug.com/80307.
23 class ExtensionMessageHandler : public RenderViewHostObserver { 26 class ExtensionMessageHandler
27 : public RenderViewHostObserver,
28 public AppNotifyChannelSetup::Delegate,
29 public base::SupportsWeakPtr<ExtensionMessageHandler> {
24 public: 30 public:
25 // |sender| is guaranteed to outlive this object. 31 // |sender| is guaranteed to outlive this object.
26 explicit ExtensionMessageHandler(RenderViewHost* render_view_host); 32 explicit ExtensionMessageHandler(RenderViewHost* render_view_host);
27 virtual ~ExtensionMessageHandler(); 33 virtual ~ExtensionMessageHandler();
28 34
29 // RenderViewHostObserver overrides. 35 // RenderViewHostObserver overrides.
30 virtual void RenderViewHostInitialized() OVERRIDE; 36 virtual void RenderViewHostInitialized() OVERRIDE;
31 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; 37 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
32 38
39 // Implementing the AppNotifyChannelSetup::Delegate interface.
40 virtual void AppNotifyChannelSetupComplete(int request_id,
41 const std::string& channel_id,
42 const std::string& error);
43
33 private: 44 private:
34 // Message handlers. 45 // Message handlers.
35 void OnPostMessage(int port_id, const std::string& message); 46 void OnPostMessage(int port_id, const std::string& message);
47 void OnGetAppNotifyChannel(int request_id,
48 const GURL& requestor_url,
49 const std::string& client_id);
36 50
37 DISALLOW_COPY_AND_ASSIGN(ExtensionMessageHandler); 51 DISALLOW_COPY_AND_ASSIGN(ExtensionMessageHandler);
38 }; 52 };
39 53
40 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_MESSAGE_HANDLER_H_ 54 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_MESSAGE_HANDLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698