| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_PUBLIC_BROWSER_BROWSER_PPAPI_HOST_H_ | 5 #ifndef CONTENT_PUBLIC_BROWSER_BROWSER_PPAPI_HOST_H_ |
| 6 #define CONTENT_PUBLIC_BROWSER_BROWSER_PPAPI_HOST_H_ | 6 #define CONTENT_PUBLIC_BROWSER_BROWSER_PPAPI_HOST_H_ |
| 7 | 7 |
| 8 #include "base/callback_forward.h" |
| 8 #include "base/process.h" | 9 #include "base/process.h" |
| 9 #include "content/common/content_export.h" | 10 #include "content/common/content_export.h" |
| 11 #include "content/public/browser/browser_thread.h" |
| 12 #include "content/public/browser/render_view_host.h" |
| 13 #include "ppapi/c/pp_instance.h" |
| 10 | 14 |
| 11 namespace ppapi { | 15 namespace ppapi { |
| 12 namespace host { | 16 namespace host { |
| 13 class PpapiHost; | 17 class PpapiHost; |
| 14 } | 18 } |
| 15 } | 19 } |
| 16 | 20 |
| 17 namespace content { | 21 namespace content { |
| 18 | 22 |
| 19 // Interface that allows components in the embedder app to talk to the | 23 // Interface that allows components in the embedder app to talk to the |
| 20 // PpapiHost in the browser process. | 24 // PpapiHost in the browser process. |
| 21 // | 25 // |
| 22 // There will be one of these objects in the browser per plugin process. It | 26 // There will be one of these objects in the browser per plugin process. It |
| 23 // lives entirely on the I/O thread. | 27 // lives entirely on the I/O thread. |
| 24 class CONTENT_EXPORT BrowserPpapiHost { | 28 class CONTENT_EXPORT BrowserPpapiHost { |
| 25 public: | 29 public: |
| 26 // Returns the PpapiHost object. | 30 // Returns the PpapiHost object. |
| 27 virtual ppapi::host::PpapiHost* GetPpapiHost() = 0; | 31 virtual ppapi::host::PpapiHost* GetPpapiHost() = 0; |
| 28 | 32 |
| 29 // Returns the handle to the plugin process. | 33 // Returns the handle to the plugin process. |
| 30 virtual base::ProcessHandle GetPluginProcessHandle() const = 0; | 34 virtual base::ProcessHandle GetPluginProcessHandle() const = 0; |
| 31 | 35 |
| 36 // Returns true if the given PP_Instance is valid. |
| 37 virtual bool IsValidInstance(PP_Instance instance) const = 0; |
| 38 |
| 39 // Retrieves the process/view Ids associated with the RenderView containing |
| 40 // the given instance and returns true on success. If the instance is |
| 41 // invalid, the ids will be 0 and false will be returned. |
| 42 // |
| 43 // When a resource is created, the PP_Instance should already have been |
| 44 // validated, and the resource hosts will be deleted when the resource is |
| 45 // destroyed. So it should not generally be necessary to check for errors |
| 46 // from this function except as a last-minute sanity check if you convert the |
| 47 // IDs to a RenderView/ProcessHost on the UI thread. |
| 48 virtual bool GetRenderViewIDsForInstance(PP_Instance instance, |
| 49 int* render_process_id, |
| 50 int* render_view_id) const = 0; |
| 51 |
| 32 protected: | 52 protected: |
| 33 virtual ~BrowserPpapiHost() {} | 53 virtual ~BrowserPpapiHost() {} |
| 34 }; | 54 }; |
| 35 | 55 |
| 36 } // namespace content | 56 } // namespace content |
| 37 | 57 |
| 38 #endif // CONTENT_PUBLIC_BROWSER_BROWSER_PPAPI_HOST_H_ | 58 #endif // CONTENT_PUBLIC_BROWSER_BROWSER_PPAPI_HOST_H_ |
| OLD | NEW |