| 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/callback_forward.h" |
| 9 #include "base/process/process.h" | 9 #include "base/process/process.h" |
| 10 #include "content/common/content_export.h" | 10 #include "content/common/content_export.h" |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 | 29 |
| 30 // Interface that allows components in the embedder app to talk to the | 30 // Interface that allows components in the embedder app to talk to the |
| 31 // PpapiHost in the browser process. | 31 // PpapiHost in the browser process. |
| 32 // | 32 // |
| 33 // There will be one of these objects in the browser per plugin process. It | 33 // There will be one of these objects in the browser per plugin process. It |
| 34 // lives entirely on the I/O thread. | 34 // lives entirely on the I/O thread. |
| 35 class CONTENT_EXPORT BrowserPpapiHost { | 35 class CONTENT_EXPORT BrowserPpapiHost { |
| 36 public: | 36 public: |
| 37 struct OnKeepaliveInstanceStruct { | 37 struct OnKeepaliveInstanceStruct { |
| 38 int render_process_id; | 38 int render_process_id; |
| 39 int render_view_id; | 39 int render_frame_id; |
| 40 GURL document_url; | 40 GURL document_url; |
| 41 }; | 41 }; |
| 42 typedef std::vector<OnKeepaliveInstanceStruct> OnKeepaliveInstanceData; | 42 typedef std::vector<OnKeepaliveInstanceStruct> OnKeepaliveInstanceData; |
| 43 typedef base::Callback< | 43 typedef base::Callback< |
| 44 void (const OnKeepaliveInstanceData& instance_data, | 44 void (const OnKeepaliveInstanceData& instance_data, |
| 45 const base::FilePath& profile_data_directory)> | 45 const base::FilePath& profile_data_directory)> |
| 46 OnKeepaliveCallback; | 46 OnKeepaliveCallback; |
| 47 | 47 |
| 48 // Creates a browser host and sets up an out-of-process proxy for an external | 48 // Creates a browser host and sets up an out-of-process proxy for an external |
| 49 // pepper plugin process. | 49 // pepper plugin process. |
| (...skipping 10 matching lines...) Expand all Loading... |
| 60 | 60 |
| 61 // Returns the PpapiHost object. | 61 // Returns the PpapiHost object. |
| 62 virtual ppapi::host::PpapiHost* GetPpapiHost() = 0; | 62 virtual ppapi::host::PpapiHost* GetPpapiHost() = 0; |
| 63 | 63 |
| 64 // Returns the handle to the plugin process. | 64 // Returns the handle to the plugin process. |
| 65 virtual base::ProcessHandle GetPluginProcessHandle() const = 0; | 65 virtual base::ProcessHandle GetPluginProcessHandle() const = 0; |
| 66 | 66 |
| 67 // Returns true if the given PP_Instance is valid. | 67 // Returns true if the given PP_Instance is valid. |
| 68 virtual bool IsValidInstance(PP_Instance instance) const = 0; | 68 virtual bool IsValidInstance(PP_Instance instance) const = 0; |
| 69 | 69 |
| 70 // Retrieves the process/view Ids associated with the RenderView containing | 70 // Retrieves the process/frame Ids associated with the RenderFrame containing |
| 71 // the given instance and returns true on success. If the instance is | 71 // the given instance and returns true on success. If the instance is |
| 72 // invalid, the ids will be 0 and false will be returned. | 72 // invalid, the ids will be 0 and false will be returned. |
| 73 // | 73 // |
| 74 // When a resource is created, the PP_Instance should already have been | 74 // When a resource is created, the PP_Instance should already have been |
| 75 // validated, and the resource hosts will be deleted when the resource is | 75 // validated, and the resource hosts will be deleted when the resource is |
| 76 // destroyed. So it should not generally be necessary to check for errors | 76 // destroyed. So it should not generally be necessary to check for errors |
| 77 // from this function except as a last-minute sanity check if you convert the | 77 // from this function except as a last-minute sanity check if you convert the |
| 78 // IDs to a RenderView/ProcessHost on the UI thread. | 78 // IDs to a RenderFrame/ProcessHost on the UI thread. |
| 79 virtual bool GetRenderViewIDsForInstance(PP_Instance instance, | 79 virtual bool GetRenderFrameIDsForInstance(PP_Instance instance, |
| 80 int* render_process_id, | 80 int* render_process_id, |
| 81 int* render_view_id) const = 0; | 81 int* render_frame_id) const = 0; |
| 82 | 82 |
| 83 // Returns the name of the plugin. | 83 // Returns the name of the plugin. |
| 84 virtual const std::string& GetPluginName() = 0; | 84 virtual const std::string& GetPluginName() = 0; |
| 85 | 85 |
| 86 // Returns the path of the plugin. | 86 // Returns the path of the plugin. |
| 87 virtual const base::FilePath& GetPluginPath() = 0; | 87 virtual const base::FilePath& GetPluginPath() = 0; |
| 88 | 88 |
| 89 // Returns the user's profile data directory. | 89 // Returns the user's profile data directory. |
| 90 virtual const base::FilePath& GetProfileDataDirectory() = 0; | 90 virtual const base::FilePath& GetProfileDataDirectory() = 0; |
| 91 | 91 |
| 92 // Get the Document/Plugin URLs for the given PP_Instance. | 92 // Get the Document/Plugin URLs for the given PP_Instance. |
| 93 virtual GURL GetDocumentURLForInstance(PP_Instance instance) = 0; | 93 virtual GURL GetDocumentURLForInstance(PP_Instance instance) = 0; |
| 94 virtual GURL GetPluginURLForInstance(PP_Instance instance) = 0; | 94 virtual GURL GetPluginURLForInstance(PP_Instance instance) = 0; |
| 95 | 95 |
| 96 // Sets a callback the BrowserPpapiHost will run when the plugin messages | 96 // Sets a callback the BrowserPpapiHost will run when the plugin messages |
| 97 // that it is active. | 97 // that it is active. |
| 98 virtual void SetOnKeepaliveCallback(const OnKeepaliveCallback& callback) = 0; | 98 virtual void SetOnKeepaliveCallback(const OnKeepaliveCallback& callback) = 0; |
| 99 }; | 99 }; |
| 100 | 100 |
| 101 } // namespace content | 101 } // namespace content |
| 102 | 102 |
| 103 #endif // CONTENT_PUBLIC_BROWSER_BROWSER_PPAPI_HOST_H_ | 103 #endif // CONTENT_PUBLIC_BROWSER_BROWSER_PPAPI_HOST_H_ |
| OLD | NEW |