OLD | NEW |
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 // A proxy for NPObject that sends all calls to the object to an NPObjectStub | 5 // A proxy for NPObject that sends all calls to the object to an NPObjectStub |
6 // running in a different process. | 6 // running in a different process. |
7 | 7 |
8 #ifndef CONTENT_COMMON_NPOBJECT_PROXY_H_ | 8 #ifndef CONTENT_COMMON_NPOBJECT_PROXY_H_ |
9 #define CONTENT_COMMON_NPOBJECT_PROXY_H_ | 9 #define CONTENT_COMMON_NPOBJECT_PROXY_H_ |
10 #pragma once | 10 #pragma once |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 NPVariant *result); | 88 NPVariant *result); |
89 | 89 |
90 static NPObjectProxy* GetProxy(NPObject* object); | 90 static NPObjectProxy* GetProxy(NPObject* object); |
91 static const NPClass* npclass() { return &npclass_proxy_; } | 91 static const NPClass* npclass() { return &npclass_proxy_; } |
92 | 92 |
93 // NPObjectBase implementation. | 93 // NPObjectBase implementation. |
94 virtual NPObject* GetUnderlyingNPObject(); | 94 virtual NPObject* GetUnderlyingNPObject(); |
95 | 95 |
96 virtual IPC::Channel::Listener* GetChannelListener(); | 96 virtual IPC::Channel::Listener* GetChannelListener(); |
97 | 97 |
| 98 bool HasExceptionThrown() const { return has_exception_thrown_; } |
| 99 |
| 100 void SetExceptionThrown(bool has_thrown) { |
| 101 has_exception_thrown_ = has_thrown; |
| 102 } |
| 103 |
98 private: | 104 private: |
99 NPObjectProxy(NPChannelBase* channel, | 105 NPObjectProxy(NPChannelBase* channel, |
100 int route_id, | 106 int route_id, |
101 gfx::NativeViewId containing_window, | 107 gfx::NativeViewId containing_window, |
102 const GURL& page_url); | 108 const GURL& page_url); |
103 | 109 |
104 // IPC::Channel::Listener implementation: | 110 // IPC::Channel::Listener implementation: |
105 virtual bool OnMessageReceived(const IPC::Message& msg); | 111 virtual bool OnMessageReceived(const IPC::Message& msg); |
106 virtual void OnChannelError(); | 112 virtual void OnChannelError(); |
| 113 virtual void OnSetException(const std::string& msg); |
107 | 114 |
108 static NPObject* NPAllocate(NPP, NPClass*); | 115 static NPObject* NPAllocate(NPP, NPClass*); |
109 static void NPDeallocate(NPObject* npObj); | 116 static void NPDeallocate(NPObject* npObj); |
110 | 117 |
111 // This function is only caled on NPObjects from the plugin. | 118 // This function is only caled on NPObjects from the plugin. |
112 static void NPPInvalidate(NPObject *obj); | 119 static void NPPInvalidate(NPObject *obj); |
113 static NPClass npclass_proxy_; | 120 static NPClass npclass_proxy_; |
114 | 121 |
115 scoped_refptr<NPChannelBase> channel_; | 122 scoped_refptr<NPChannelBase> channel_; |
116 int route_id_; | 123 int route_id_; |
117 gfx::NativeViewId containing_window_; | 124 gfx::NativeViewId containing_window_; |
118 | 125 |
119 // The url of the main frame hosting the plugin. | 126 // The url of the main frame hosting the plugin. |
120 GURL page_url_; | 127 GURL page_url_; |
| 128 |
| 129 // Indicates whether an exception is set via NPN_SetException |
| 130 // called from plugin |
| 131 bool has_exception_thrown_; |
121 }; | 132 }; |
122 | 133 |
123 #endif // CONTENT_COMMON_NPOBJECT_PROXY_H_ | 134 #endif // CONTENT_COMMON_NPOBJECT_PROXY_H_ |
OLD | NEW |