OLD | NEW |
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 CONTENT_RENDERER_PEPPER_PEPPER_BROWSER_CONNECTION_H_ | 5 #ifndef CONTENT_RENDERER_PEPPER_PEPPER_BROWSER_CONNECTION_H_ |
6 #define CONTENT_RENDERER_PEPPER_PEPPER_BROWSER_CONNECTION_H_ | 6 #define CONTENT_RENDERER_PEPPER_PEPPER_BROWSER_CONNECTION_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "base/callback.h" | 12 #include "base/callback.h" |
13 #include "base/files/file_path.h" | 13 #include "base/files/file_path.h" |
14 #include "content/public/renderer/render_view_observer.h" | 14 #include "content/public/renderer/render_frame_observer.h" |
15 #include "content/public/renderer/render_view_observer_tracker.h" | 15 #include "content/public/renderer/render_frame_observer_tracker.h" |
16 #include "ppapi/c/pp_file_info.h" | 16 #include "ppapi/c/pp_file_info.h" |
17 #include "ppapi/c/pp_instance.h" | 17 #include "ppapi/c/pp_instance.h" |
18 #include "ppapi/c/pp_resource.h" | 18 #include "ppapi/c/pp_resource.h" |
19 | 19 |
| 20 class GURL; |
| 21 |
20 namespace content { | 22 namespace content { |
21 | 23 |
22 // This class represents a connection from the renderer to the browser for | 24 // This class represents a connection from the renderer to the browser for |
23 // sending/receiving pepper ResourceHost related messages. When the browser | 25 // sending/receiving pepper ResourceHost related messages. When the browser |
24 // and renderer communicate about ResourceHosts, they should pass the plugin | 26 // and renderer communicate about ResourceHosts, they should pass the plugin |
25 // process ID to identify which plugin they are talking about. | 27 // process ID to identify which plugin they are talking about. |
26 class PepperBrowserConnection | 28 class PepperBrowserConnection |
27 : public RenderViewObserver, | 29 : public RenderFrameObserver, |
28 public RenderViewObserverTracker<PepperBrowserConnection> { | 30 public RenderFrameObserverTracker<PepperBrowserConnection> { |
29 public: | 31 public: |
30 typedef base::Callback<void(const std::vector<int>&)> | 32 typedef base::Callback<void(const std::vector<int>&)> |
31 PendingResourceIDCallback; | 33 PendingResourceIDCallback; |
32 explicit PepperBrowserConnection(RenderView* render_view); | 34 explicit PepperBrowserConnection(RenderFrame* render_frame); |
33 virtual ~PepperBrowserConnection(); | 35 virtual ~PepperBrowserConnection(); |
34 | 36 |
35 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; | 37 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; |
36 | 38 |
37 // TODO(teravest): Instead of having separate methods per message, we should | 39 // TODO(teravest): Instead of having separate methods per message, we should |
38 // add generic functionality similar to PluginResource::Call(). | 40 // add generic functionality similar to PluginResource::Call(). |
39 | 41 |
40 // Sends a request to the browser to create ResourceHosts for the given | 42 // Sends a request to the browser to create ResourceHosts for the given |
41 // |instance| of a plugin identified by |child_process_id|. |callback| will be | 43 // |instance| of a plugin identified by |child_process_id|. |callback| will be |
42 // run when a reply is received with the pending resource IDs. | 44 // run when a reply is received with the pending resource IDs. |
(...skipping 24 matching lines...) Expand all Loading... |
67 int32_t next_sequence_number_; | 69 int32_t next_sequence_number_; |
68 | 70 |
69 // Maps a sequence number to the callback to be run. | 71 // Maps a sequence number to the callback to be run. |
70 std::map<int32_t, PendingResourceIDCallback> pending_create_map_; | 72 std::map<int32_t, PendingResourceIDCallback> pending_create_map_; |
71 DISALLOW_COPY_AND_ASSIGN(PepperBrowserConnection); | 73 DISALLOW_COPY_AND_ASSIGN(PepperBrowserConnection); |
72 }; | 74 }; |
73 | 75 |
74 } // namespace content | 76 } // namespace content |
75 | 77 |
76 #endif // CONTENT_RENDERER_PEPPER_PEPPER_BROWSER_CONNECTION_H_ | 78 #endif // CONTENT_RENDERER_PEPPER_PEPPER_BROWSER_CONNECTION_H_ |
OLD | NEW |