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

Side by Side Diff: chrome/renderer/pepper/pepper_extensions_common_host.h

Issue 12567028: Apps V2 in Pepper: Host side implementation of ExntensionsCommon - Part 1. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 8 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) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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_RENDERER_PEPPER_PEPPER_EXTENSIONS_COMMON_HOST_H_ 5 #ifndef CHROME_RENDERER_PEPPER_PEPPER_EXTENSIONS_COMMON_HOST_H_
6 #define CHROME_RENDERER_PEPPER_PEPPER_EXTENSIONS_COMMON_HOST_H_ 6 #define CHROME_RENDERER_PEPPER_PEPPER_EXTENSIONS_COMMON_HOST_H_
7 7
8 #include <map> 8 #include <map>
9 #include <string> 9 #include <string>
10 10
11 #include "base/basictypes.h" 11 #include "base/basictypes.h"
12 #include "base/compiler_specific.h" 12 #include "base/compiler_specific.h"
13 #include "base/memory/linked_ptr.h" 13 #include "base/memory/linked_ptr.h"
14 #include "chrome/renderer/extensions/request_sender.h"
14 #include "ppapi/host/resource_host.h" 15 #include "ppapi/host/resource_host.h"
15 16
16 namespace base { 17 namespace base {
17 class ListValue; 18 class ListValue;
18 } 19 }
19 20
20 namespace content { 21 namespace content {
21 class RendererPpapiHost; 22 class RendererPpapiHost;
22 } 23 }
23 24
24 namespace ppapi { 25 namespace ppapi {
25 namespace host { 26 namespace host {
26 struct ReplyMessageContext; 27 struct ReplyMessageContext;
27 } 28 }
28 } 29 }
29 30
31 namespace extensions {
32 class Dispatcher;
33 }
34
30 namespace chrome { 35 namespace chrome {
31 36
32 class PepperExtensionsCommonHost : public ppapi::host::ResourceHost { 37 class PepperExtensionsCommonHost : public ppapi::host::ResourceHost,
38 public extensions::RequestSender::Source {
33 public: 39 public:
34 virtual ~PepperExtensionsCommonHost(); 40 virtual ~PepperExtensionsCommonHost();
35 41
36 static PepperExtensionsCommonHost* Create(content::RendererPpapiHost* host, 42 static PepperExtensionsCommonHost* Create(content::RendererPpapiHost* host,
37 PP_Instance instance, 43 PP_Instance instance,
38 PP_Resource resource); 44 PP_Resource resource);
39 45
40 // ppapi::host::ResourceMessageHandler overrides. 46 // ppapi::host::ResourceMessageHandler overrides.
41 virtual int32_t OnResourceMessageReceived( 47 virtual int32_t OnResourceMessageReceived(
42 const IPC::Message& msg, 48 const IPC::Message& msg,
43 ppapi::host::HostMessageContext* context) OVERRIDE; 49 ppapi::host::HostMessageContext* context) OVERRIDE;
44 50
51 // extensions::RequestSender::Source implementation.
52 virtual extensions::ChromeV8Context* GetContext() OVERRIDE;
53 virtual void OnResponseReceived(const std::string& name,
54 int request_id,
55 bool success,
56 const base::ListValue& response,
57 const std::string& error) OVERRIDE;
45 private: 58 private:
46 typedef std::map<int, linked_ptr<ppapi::host::ReplyMessageContext> > 59 typedef std::map<int, linked_ptr<ppapi::host::ReplyMessageContext> >
47 PendingRequestMap; 60 PendingRequestMap;
48 61
49 PepperExtensionsCommonHost(content::RendererPpapiHost* host, 62 PepperExtensionsCommonHost(content::RendererPpapiHost* host,
50 PP_Instance instance, 63 PP_Instance instance,
51 PP_Resource resource); 64 PP_Resource resource,
65 extensions::Dispatcher* dispatcher);
52 66
53 int32_t OnPost(ppapi::host::HostMessageContext* context, 67 int32_t OnPost(ppapi::host::HostMessageContext* context,
54 const std::string& request_name, 68 const std::string& request_name,
55 const base::ListValue& args); 69 base::ListValue& args);
56 70
57 int32_t OnCall(ppapi::host::HostMessageContext* context, 71 int32_t OnCall(ppapi::host::HostMessageContext* context,
58 const std::string& request_name, 72 const std::string& request_name,
59 const base::ListValue& args); 73 base::ListValue& args);
60 74
61 // Non-owning pointer. 75 // Non-owning pointer.
62 content::RendererPpapiHost* renderer_ppapi_host_; 76 content::RendererPpapiHost* renderer_ppapi_host_;
77 // Non-owning pointer.
78 extensions::Dispatcher* dispatcher_;
63 79
64 PendingRequestMap pending_request_map_; 80 PendingRequestMap pending_request_map_;
65 81
66 DISALLOW_COPY_AND_ASSIGN(PepperExtensionsCommonHost); 82 DISALLOW_COPY_AND_ASSIGN(PepperExtensionsCommonHost);
67 }; 83 };
68 84
69 } // namespace chrome 85 } // namespace chrome
70 86
71 #endif // CHROME_RENDERER_PEPPER_PEPPER_EXTENSIONS_COMMON_HOST_H_ 87 #endif // CHROME_RENDERER_PEPPER_PEPPER_EXTENSIONS_COMMON_HOST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698