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

Side by Side Diff: content/renderer/browser_plugin/browser_plugin_bindings.cc

Issue 564973004: Move ContentWindow from BrowserPlugin To GuestView (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: More cleanup Created 6 years, 3 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
OLDNEW
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 #include "content/renderer/browser_plugin/browser_plugin_bindings.h" 5 #include "content/renderer/browser_plugin/browser_plugin_bindings.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "content/common/browser_plugin/browser_plugin_constants.h" 9 #include "content/common/browser_plugin/browser_plugin_constants.h"
10 #include "content/renderer/browser_plugin/browser_plugin.h" 10 #include "content/renderer/browser_plugin/browser_plugin.h"
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 } 181 }
182 virtual void RemoveProperty(BrowserPluginBindings* bindings, 182 virtual void RemoveProperty(BrowserPluginBindings* bindings,
183 NPObject* np_obj) OVERRIDE { 183 NPObject* np_obj) OVERRIDE {
184 bindings->instance()->RemoveDOMAttribute(name()); 184 bindings->instance()->RemoveDOMAttribute(name());
185 bindings->instance()->ParseAllowTransparencyAttribute(); 185 bindings->instance()->ParseAllowTransparencyAttribute();
186 } 186 }
187 private: 187 private:
188 DISALLOW_COPY_AND_ASSIGN(BrowserPluginPropertyBindingAllowTransparency); 188 DISALLOW_COPY_AND_ASSIGN(BrowserPluginPropertyBindingAllowTransparency);
189 }; 189 };
190 190
191 class BrowserPluginPropertyBindingContentWindow
192 : public BrowserPluginPropertyBinding {
193 public:
194 BrowserPluginPropertyBindingContentWindow()
195 : BrowserPluginPropertyBinding(browser_plugin::kAttributeContentWindow) {
196 }
197 virtual bool GetProperty(BrowserPluginBindings* bindings,
198 NPVariant* result) OVERRIDE {
199 NPObject* obj = bindings->instance()->GetContentWindow();
200 if (obj) {
201 result->type = NPVariantType_Object;
202 result->value.objectValue = WebBindings::retainObject(obj);
203 }
204 return true;
205 }
206 virtual bool SetProperty(BrowserPluginBindings* bindings,
207 NPObject* np_obj,
208 const NPVariant* variant) OVERRIDE {
209 return false;
210 }
211 virtual void RemoveProperty(BrowserPluginBindings* bindings,
212 NPObject* np_obj) OVERRIDE {}
213 private:
214 DISALLOW_COPY_AND_ASSIGN(BrowserPluginPropertyBindingContentWindow);
215 };
216
217 191
218 // BrowserPluginBindings ------------------------------------------------------ 192 // BrowserPluginBindings ------------------------------------------------------
219 193
220 BrowserPluginBindings::BrowserPluginNPObject::BrowserPluginNPObject() { 194 BrowserPluginBindings::BrowserPluginNPObject::BrowserPluginNPObject() {
221 } 195 }
222 196
223 BrowserPluginBindings::BrowserPluginNPObject::~BrowserPluginNPObject() { 197 BrowserPluginBindings::BrowserPluginNPObject::~BrowserPluginNPObject() {
224 } 198 }
225 199
226 BrowserPluginBindings::BrowserPluginBindings(BrowserPlugin* instance) 200 BrowserPluginBindings::BrowserPluginBindings(BrowserPlugin* instance)
227 : instance_(instance), 201 : instance_(instance),
228 np_object_(NULL), 202 np_object_(NULL),
229 weak_ptr_factory_(this) { 203 weak_ptr_factory_(this) {
230 NPObject* obj = 204 NPObject* obj =
231 WebBindings::createObject(instance->pluginNPP(), 205 WebBindings::createObject(instance->pluginNPP(),
232 &browser_plugin_message_class); 206 &browser_plugin_message_class);
233 np_object_ = static_cast<BrowserPluginBindings::BrowserPluginNPObject*>(obj); 207 np_object_ = static_cast<BrowserPluginBindings::BrowserPluginNPObject*>(obj);
234 np_object_->message_channel = weak_ptr_factory_.GetWeakPtr(); 208 np_object_->message_channel = weak_ptr_factory_.GetWeakPtr();
235 209
236 property_bindings_.push_back( 210 property_bindings_.push_back(
237 new BrowserPluginPropertyBindingAllowTransparency); 211 new BrowserPluginPropertyBindingAllowTransparency);
238 property_bindings_.push_back(new BrowserPluginPropertyBindingContentWindow);
239 } 212 }
240 213
241 BrowserPluginBindings::~BrowserPluginBindings() { 214 BrowserPluginBindings::~BrowserPluginBindings() {
242 WebBindings::releaseObject(np_object_); 215 WebBindings::releaseObject(np_object_);
243 } 216 }
244 217
245 bool BrowserPluginBindings::HasProperty(NPIdentifier name) const { 218 bool BrowserPluginBindings::HasProperty(NPIdentifier name) const {
246 for (PropertyBindingList::const_iterator iter = property_bindings_.begin(); 219 for (PropertyBindingList::const_iterator iter = property_bindings_.begin();
247 iter != property_bindings_.end(); 220 iter != property_bindings_.end();
248 ++iter) { 221 ++iter) {
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
285 for (PropertyBindingList::iterator iter = property_bindings_.begin(); 258 for (PropertyBindingList::iterator iter = property_bindings_.begin();
286 iter != property_bindings_.end(); 259 iter != property_bindings_.end();
287 ++iter) { 260 ++iter) {
288 if ((*iter)->MatchesName(name)) 261 if ((*iter)->MatchesName(name))
289 return (*iter)->GetProperty(this, result); 262 return (*iter)->GetProperty(this, result);
290 } 263 }
291 return false; 264 return false;
292 } 265 }
293 266
294 } // namespace content 267 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/browser_plugin/browser_plugin_bindings.h ('k') | extensions/browser/guest_view/guest_view_base.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698