| 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 #include "content/renderer/browser_plugin/browser_plugin_bindings.h" | 5 #include "content/renderer/browser_plugin/browser_plugin_bindings.h" |
| 6 | 6 |
| 7 #include <cstdlib> | 7 #include <cstdlib> |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| 11 #include "base/message_loop.h" | 11 #include "base/message_loop.h" |
| 12 #include "base/string16.h" | 12 #include "base/string16.h" |
| 13 #include "base/string_number_conversions.h" | |
| 14 #include "base/string_split.h" | 13 #include "base/string_split.h" |
| 15 #include "base/utf_string_conversions.h" | 14 #include "base/utf_string_conversions.h" |
| 16 #include "content/renderer/browser_plugin/browser_plugin.h" | 15 #include "content/renderer/browser_plugin/browser_plugin.h" |
| 17 #include "third_party/npapi/bindings/npapi.h" | 16 #include "third_party/npapi/bindings/npapi.h" |
| 18 #include "third_party/WebKit/Source/WebKit/chromium/public/WebBindings.h" | 17 #include "third_party/WebKit/Source/WebKit/chromium/public/WebBindings.h" |
| 19 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h" | 18 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h" |
| 20 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDOMMessageEvent.h" | 19 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDOMMessageEvent.h" |
| 21 #include "third_party/WebKit/Source/WebKit/chromium/public/WebElement.h" | 20 #include "third_party/WebKit/Source/WebKit/chromium/public/WebElement.h" |
| 22 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" | 21 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" |
| 23 #include "third_party/WebKit/Source/WebKit/chromium/public/WebNode.h" | 22 #include "third_party/WebKit/Source/WebKit/chromium/public/WebNode.h" |
| (...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 386 DISALLOW_COPY_AND_ASSIGN(BrowserPluginBindingTerminate); | 385 DISALLOW_COPY_AND_ASSIGN(BrowserPluginBindingTerminate); |
| 387 }; | 386 }; |
| 388 | 387 |
| 389 // BrowserPluginPropertyBinding ------------------------------------------------ | 388 // BrowserPluginPropertyBinding ------------------------------------------------ |
| 390 | 389 |
| 391 class BrowserPluginPropertyBinding { | 390 class BrowserPluginPropertyBinding { |
| 392 public: | 391 public: |
| 393 explicit BrowserPluginPropertyBinding(const char name[]) : name_(name) { | 392 explicit BrowserPluginPropertyBinding(const char name[]) : name_(name) { |
| 394 } | 393 } |
| 395 virtual ~BrowserPluginPropertyBinding() {} | 394 virtual ~BrowserPluginPropertyBinding() {} |
| 396 const std::string& name() const { return name_; } | |
| 397 bool MatchesName(NPIdentifier name) const { | 395 bool MatchesName(NPIdentifier name) const { |
| 398 return WebBindings::getStringIdentifier(name_.c_str()) == name; | 396 return WebBindings::getStringIdentifier(name_.c_str()) == name; |
| 399 } | 397 } |
| 400 virtual bool GetProperty(BrowserPluginBindings* bindings, | 398 virtual bool GetProperty(BrowserPluginBindings* bindings, |
| 401 NPVariant* result) = 0; | 399 NPVariant* result) = 0; |
| 402 virtual bool SetProperty(BrowserPluginBindings* bindings, | 400 virtual bool SetProperty(BrowserPluginBindings* bindings, |
| 403 NPObject* np_obj, | 401 NPObject* np_obj, |
| 404 const NPVariant* variant) = 0; | 402 const NPVariant* variant) = 0; |
| 405 virtual std::string GetDOMAttributeValue(BrowserPlugin* browser_plugin) = 0; | |
| 406 // Updates the DOM Attribute value with the current property value. | |
| 407 void UpdateDOMAttribute(BrowserPluginBindings* bindings) { | |
| 408 bindings->instance()->UpdateDOMAttribute(name(), | |
| 409 GetDOMAttributeValue(bindings->instance())); | |
| 410 } | |
| 411 private: | 403 private: |
| 412 std::string name_; | 404 std::string name_; |
| 413 | 405 |
| 414 DISALLOW_COPY_AND_ASSIGN(BrowserPluginPropertyBinding); | 406 DISALLOW_COPY_AND_ASSIGN(BrowserPluginPropertyBinding); |
| 415 }; | 407 }; |
| 416 | 408 |
| 417 class BrowserPluginPropertyBindingAutoSize | 409 class BrowserPluginPropertyBindingAutoSize |
| 418 : public BrowserPluginPropertyBinding { | 410 : public BrowserPluginPropertyBinding { |
| 419 public: | 411 public: |
| 420 BrowserPluginPropertyBindingAutoSize() : | 412 BrowserPluginPropertyBindingAutoSize() : |
| 421 BrowserPluginPropertyBinding(kAttributeAutoSize) { | 413 BrowserPluginPropertyBinding(kAttributeAutoSize) { |
| 422 } | 414 } |
| 423 virtual bool GetProperty(BrowserPluginBindings* bindings, | 415 virtual bool GetProperty(BrowserPluginBindings* bindings, |
| 424 NPVariant* result) OVERRIDE { | 416 NPVariant* result) OVERRIDE { |
| 425 bool auto_size = bindings->instance()->auto_size_attribute(); | 417 bool autosize = bindings->instance()->auto_size_attribute(); |
| 426 BOOLEAN_TO_NPVARIANT(auto_size, *result); | 418 BOOLEAN_TO_NPVARIANT(autosize, *result); |
| 427 return true; | 419 return true; |
| 428 } | 420 } |
| 429 virtual bool SetProperty(BrowserPluginBindings* bindings, | 421 virtual bool SetProperty(BrowserPluginBindings* bindings, |
| 430 NPObject* np_obj, | 422 NPObject* np_obj, |
| 431 const NPVariant* variant) OVERRIDE { | 423 const NPVariant* variant) OVERRIDE { |
| 432 bool auto_size = NPVARIANT_TO_BOOLEAN(*variant); | 424 bool autosize = NPVARIANT_TO_BOOLEAN(*variant); |
| 433 bindings->instance()->SetAutoSizeAttribute(auto_size); | 425 bindings->instance()->SetAutoSizeAttribute(autosize); |
| 434 return true; | 426 return true; |
| 435 } | 427 } |
| 436 virtual std::string GetDOMAttributeValue( | |
| 437 BrowserPlugin* browser_plugin) OVERRIDE { | |
| 438 return browser_plugin->auto_size_attribute() ? "true" : "false"; | |
| 439 } | |
| 440 private: | 428 private: |
| 441 DISALLOW_COPY_AND_ASSIGN(BrowserPluginPropertyBindingAutoSize); | 429 DISALLOW_COPY_AND_ASSIGN(BrowserPluginPropertyBindingAutoSize); |
| 442 }; | 430 }; |
| 443 | 431 |
| 444 class BrowserPluginPropertyBindingContentWindow | 432 class BrowserPluginPropertyBindingContentWindow |
| 445 : public BrowserPluginPropertyBinding { | 433 : public BrowserPluginPropertyBinding { |
| 446 public: | 434 public: |
| 447 BrowserPluginPropertyBindingContentWindow() : | 435 BrowserPluginPropertyBindingContentWindow() : |
| 448 BrowserPluginPropertyBinding(kAttributeContentWindow) { | 436 BrowserPluginPropertyBinding(kAttributeContentWindow) { |
| 449 } | 437 } |
| 450 virtual bool GetProperty(BrowserPluginBindings* bindings, | 438 virtual bool GetProperty(BrowserPluginBindings* bindings, |
| 451 NPVariant* result) OVERRIDE { | 439 NPVariant* result) OVERRIDE { |
| 452 NPObject* obj = bindings->instance()->GetContentWindow(); | 440 NPObject* obj = bindings->instance()->GetContentWindow(); |
| 453 if (obj) { | 441 if (obj) { |
| 454 result->type = NPVariantType_Object; | 442 result->type = NPVariantType_Object; |
| 455 result->value.objectValue = WebBindings::retainObject(obj); | 443 result->value.objectValue = WebBindings::retainObject(obj); |
| 456 } | 444 } |
| 457 return true; | 445 return true; |
| 458 } | 446 } |
| 459 virtual bool SetProperty(BrowserPluginBindings* bindings, | 447 virtual bool SetProperty(BrowserPluginBindings* bindings, |
| 460 NPObject* np_obj, | 448 NPObject* np_obj, |
| 461 const NPVariant* variant) OVERRIDE { | 449 const NPVariant* variant) OVERRIDE { |
| 462 return false; | 450 return false; |
| 463 } | 451 } |
| 464 virtual std::string GetDOMAttributeValue(BrowserPlugin* browser_plugin) { | |
| 465 return std::string(); | |
| 466 } | |
| 467 private: | 452 private: |
| 468 DISALLOW_COPY_AND_ASSIGN(BrowserPluginPropertyBindingContentWindow); | 453 DISALLOW_COPY_AND_ASSIGN(BrowserPluginPropertyBindingContentWindow); |
| 469 }; | 454 }; |
| 470 | 455 |
| 471 class BrowserPluginPropertyBindingMaxHeight | 456 class BrowserPluginPropertyBindingMaxHeight |
| 472 : public BrowserPluginPropertyBinding { | 457 : public BrowserPluginPropertyBinding { |
| 473 public: | 458 public: |
| 474 BrowserPluginPropertyBindingMaxHeight() : | 459 BrowserPluginPropertyBindingMaxHeight() : |
| 475 BrowserPluginPropertyBinding(kAttributeMaxHeight) { | 460 BrowserPluginPropertyBinding(kAttributeMaxHeight) { |
| 476 } | 461 } |
| 477 virtual bool GetProperty(BrowserPluginBindings* bindings, | 462 virtual bool GetProperty(BrowserPluginBindings* bindings, |
| 478 NPVariant* result) OVERRIDE { | 463 NPVariant* result) OVERRIDE { |
| 479 int max_height = bindings->instance()->max_height_attribute(); | 464 int max_height = bindings->instance()->max_height_attribute(); |
| 480 INT32_TO_NPVARIANT(max_height, *result); | 465 INT32_TO_NPVARIANT(max_height, *result); |
| 481 return true; | 466 return true; |
| 482 } | 467 } |
| 483 virtual bool SetProperty(BrowserPluginBindings* bindings, | 468 virtual bool SetProperty(BrowserPluginBindings* bindings, |
| 484 NPObject* np_obj, | 469 NPObject* np_obj, |
| 485 const NPVariant* variant) OVERRIDE { | 470 const NPVariant* variant) OVERRIDE { |
| 486 int max_height = Int32FromNPVariant(*variant); | 471 int max_height = Int32FromNPVariant(*variant); |
| 487 bindings->instance()->SetMaxHeightAttribute(max_height); | 472 bindings->instance()->SetMaxHeightAttribute(max_height); |
| 488 return true; | 473 return true; |
| 489 } | 474 } |
| 490 virtual std::string GetDOMAttributeValue( | |
| 491 BrowserPlugin* browser_plugin) OVERRIDE { | |
| 492 return base::IntToString(browser_plugin->max_height_attribute()); | |
| 493 } | |
| 494 private: | 475 private: |
| 495 DISALLOW_COPY_AND_ASSIGN(BrowserPluginPropertyBindingMaxHeight); | 476 DISALLOW_COPY_AND_ASSIGN(BrowserPluginPropertyBindingMaxHeight); |
| 496 }; | 477 }; |
| 497 | 478 |
| 498 class BrowserPluginPropertyBindingMaxWidth | 479 class BrowserPluginPropertyBindingMaxWidth |
| 499 : public BrowserPluginPropertyBinding { | 480 : public BrowserPluginPropertyBinding { |
| 500 public: | 481 public: |
| 501 BrowserPluginPropertyBindingMaxWidth() : | 482 BrowserPluginPropertyBindingMaxWidth() : |
| 502 BrowserPluginPropertyBinding(kAttributeMaxWidth) { | 483 BrowserPluginPropertyBinding(kAttributeMaxWidth) { |
| 503 } | 484 } |
| 504 virtual bool GetProperty(BrowserPluginBindings* bindings, | 485 virtual bool GetProperty(BrowserPluginBindings* bindings, |
| 505 NPVariant* result) OVERRIDE { | 486 NPVariant* result) OVERRIDE { |
| 506 int max_width = bindings->instance()->max_width_attribute(); | 487 int max_width = bindings->instance()->max_width_attribute(); |
| 507 INT32_TO_NPVARIANT(max_width, *result); | 488 INT32_TO_NPVARIANT(max_width, *result); |
| 508 return true; | 489 return true; |
| 509 } | 490 } |
| 510 virtual bool SetProperty(BrowserPluginBindings* bindings, | 491 virtual bool SetProperty(BrowserPluginBindings* bindings, |
| 511 NPObject* np_obj, | 492 NPObject* np_obj, |
| 512 const NPVariant* variant) OVERRIDE { | 493 const NPVariant* variant) OVERRIDE { |
| 513 int max_width = Int32FromNPVariant(*variant); | 494 int max_width = Int32FromNPVariant(*variant); |
| 514 bindings->instance()->SetMaxWidthAttribute(max_width); | 495 bindings->instance()->SetMaxWidthAttribute(max_width); |
| 515 return true; | 496 return true; |
| 516 } | 497 } |
| 517 virtual std::string GetDOMAttributeValue( | |
| 518 BrowserPlugin* browser_plugin) OVERRIDE { | |
| 519 return base::IntToString(browser_plugin->max_width_attribute()); | |
| 520 } | |
| 521 private: | 498 private: |
| 522 DISALLOW_COPY_AND_ASSIGN(BrowserPluginPropertyBindingMaxWidth); | 499 DISALLOW_COPY_AND_ASSIGN(BrowserPluginPropertyBindingMaxWidth); |
| 523 }; | 500 }; |
| 524 | 501 |
| 525 class BrowserPluginPropertyBindingMinHeight | 502 class BrowserPluginPropertyBindingMinHeight |
| 526 : public BrowserPluginPropertyBinding { | 503 : public BrowserPluginPropertyBinding { |
| 527 public: | 504 public: |
| 528 BrowserPluginPropertyBindingMinHeight() : | 505 BrowserPluginPropertyBindingMinHeight() : |
| 529 BrowserPluginPropertyBinding(kAttributeMinHeight) { | 506 BrowserPluginPropertyBinding(kAttributeMinHeight) { |
| 530 } | 507 } |
| 531 virtual bool GetProperty(BrowserPluginBindings* bindings, | 508 virtual bool GetProperty(BrowserPluginBindings* bindings, |
| 532 NPVariant* result) OVERRIDE { | 509 NPVariant* result) OVERRIDE { |
| 533 int min_height = bindings->instance()->min_height_attribute(); | 510 int min_height = bindings->instance()->min_height_attribute(); |
| 534 INT32_TO_NPVARIANT(min_height, *result); | 511 INT32_TO_NPVARIANT(min_height, *result); |
| 535 return true; | 512 return true; |
| 536 } | 513 } |
| 537 virtual bool SetProperty(BrowserPluginBindings* bindings, | 514 virtual bool SetProperty(BrowserPluginBindings* bindings, |
| 538 NPObject* np_obj, | 515 NPObject* np_obj, |
| 539 const NPVariant* variant) OVERRIDE { | 516 const NPVariant* variant) OVERRIDE { |
| 540 int min_height = Int32FromNPVariant(*variant); | 517 int min_height = Int32FromNPVariant(*variant); |
| 541 bindings->instance()->SetMinHeightAttribute(min_height); | 518 bindings->instance()->SetMinHeightAttribute(min_height); |
| 542 return true; | 519 return true; |
| 543 } | 520 } |
| 544 virtual std::string GetDOMAttributeValue( | |
| 545 BrowserPlugin* browser_plugin) OVERRIDE { | |
| 546 return base::IntToString(browser_plugin->min_height_attribute()); | |
| 547 } | |
| 548 private: | 521 private: |
| 549 DISALLOW_COPY_AND_ASSIGN(BrowserPluginPropertyBindingMinHeight); | 522 DISALLOW_COPY_AND_ASSIGN(BrowserPluginPropertyBindingMinHeight); |
| 550 }; | 523 }; |
| 551 | 524 |
| 552 class BrowserPluginPropertyBindingMinWidth | 525 class BrowserPluginPropertyBindingMinWidth |
| 553 : public BrowserPluginPropertyBinding { | 526 : public BrowserPluginPropertyBinding { |
| 554 public: | 527 public: |
| 555 BrowserPluginPropertyBindingMinWidth() : | 528 BrowserPluginPropertyBindingMinWidth() : |
| 556 BrowserPluginPropertyBinding(kAttributeMinWidth) { | 529 BrowserPluginPropertyBinding(kAttributeMinWidth) { |
| 557 } | 530 } |
| 558 virtual bool GetProperty(BrowserPluginBindings* bindings, | 531 virtual bool GetProperty(BrowserPluginBindings* bindings, |
| 559 NPVariant* result) OVERRIDE { | 532 NPVariant* result) OVERRIDE { |
| 560 int min_width = bindings->instance()->min_width_attribute(); | 533 int min_width = bindings->instance()->min_width_attribute(); |
| 561 INT32_TO_NPVARIANT(min_width, *result); | 534 INT32_TO_NPVARIANT(min_width, *result); |
| 562 return true; | 535 return true; |
| 563 } | 536 } |
| 564 virtual bool SetProperty(BrowserPluginBindings* bindings, | 537 virtual bool SetProperty(BrowserPluginBindings* bindings, |
| 565 NPObject* np_obj, | 538 NPObject* np_obj, |
| 566 const NPVariant* variant) OVERRIDE { | 539 const NPVariant* variant) OVERRIDE { |
| 567 int min_width = Int32FromNPVariant(*variant); | 540 int min_width = Int32FromNPVariant(*variant); |
| 568 bindings->instance()->SetMinWidthAttribute(min_width); | 541 bindings->instance()->SetMinWidthAttribute(min_width); |
| 569 return true; | 542 return true; |
| 570 } | 543 } |
| 571 virtual std::string GetDOMAttributeValue( | |
| 572 BrowserPlugin* browser_plugin) OVERRIDE { | |
| 573 return base::IntToString(browser_plugin->min_width_attribute()); | |
| 574 } | |
| 575 private: | 544 private: |
| 576 DISALLOW_COPY_AND_ASSIGN(BrowserPluginPropertyBindingMinWidth); | 545 DISALLOW_COPY_AND_ASSIGN(BrowserPluginPropertyBindingMinWidth); |
| 577 }; | 546 }; |
| 578 | 547 |
| 579 class BrowserPluginPropertyBindingPartition | 548 class BrowserPluginPropertyBindingPartition |
| 580 : public BrowserPluginPropertyBinding { | 549 : public BrowserPluginPropertyBinding { |
| 581 public: | 550 public: |
| 582 BrowserPluginPropertyBindingPartition() : | 551 BrowserPluginPropertyBindingPartition() : |
| 583 BrowserPluginPropertyBinding(kAttributePartition) { | 552 BrowserPluginPropertyBinding(kAttributePartition) { |
| 584 } | 553 } |
| 585 virtual bool GetProperty(BrowserPluginBindings* bindings, | 554 virtual bool GetProperty(BrowserPluginBindings* bindings, |
| 586 NPVariant* result) OVERRIDE { | 555 NPVariant* result) OVERRIDE { |
| 587 std::string partition_id = bindings->instance()->GetPartitionAttribute(); | 556 std::string partition_id = bindings->instance()->GetPartitionAttribute(); |
| 588 return StringToNPVariant(partition_id, result); | 557 return StringToNPVariant(partition_id, result); |
| 589 } | 558 } |
| 590 virtual bool SetProperty(BrowserPluginBindings* bindings, | 559 virtual bool SetProperty(BrowserPluginBindings* bindings, |
| 591 NPObject* np_obj, | 560 NPObject* np_obj, |
| 592 const NPVariant* variant) OVERRIDE { | 561 const NPVariant* variant) OVERRIDE { |
| 593 std::string partition_id = StringFromNPVariant(*variant); | 562 std::string partition_id = StringFromNPVariant(*variant); |
| 594 std::string error_message; | 563 std::string error_message; |
| 595 if (!bindings->instance()->SetPartitionAttribute(partition_id, | 564 if (!bindings->instance()->SetPartitionAttribute(partition_id, |
| 596 &error_message)) { | 565 &error_message)) { |
| 597 WebBindings::setException( | 566 WebBindings::setException( |
| 598 np_obj, static_cast<const NPUTF8 *>(error_message.c_str())); | 567 np_obj, static_cast<const NPUTF8 *>(error_message.c_str())); |
| 599 return false; | 568 return false; |
| 600 } | 569 } |
| 601 return true; | 570 return true; |
| 602 } | 571 } |
| 603 virtual std::string GetDOMAttributeValue( | |
| 604 BrowserPlugin* browser_plugin) OVERRIDE { | |
| 605 return browser_plugin->GetPartitionAttribute(); | |
| 606 } | |
| 607 private: | 572 private: |
| 608 DISALLOW_COPY_AND_ASSIGN(BrowserPluginPropertyBindingPartition); | 573 DISALLOW_COPY_AND_ASSIGN(BrowserPluginPropertyBindingPartition); |
| 609 }; | 574 }; |
| 610 | 575 |
| 611 class BrowserPluginPropertyBindingSrc : public BrowserPluginPropertyBinding { | 576 class BrowserPluginPropertyBindingSrc : public BrowserPluginPropertyBinding { |
| 612 public: | 577 public: |
| 613 BrowserPluginPropertyBindingSrc() : | 578 BrowserPluginPropertyBindingSrc() : |
| 614 BrowserPluginPropertyBinding(kAttributeSrc) { | 579 BrowserPluginPropertyBinding(kAttributeSrc) { |
| 615 } | 580 } |
| 616 virtual bool GetProperty(BrowserPluginBindings* bindings, | 581 virtual bool GetProperty(BrowserPluginBindings* bindings, |
| 617 NPVariant* result) OVERRIDE { | 582 NPVariant* result) OVERRIDE { |
| 618 std::string src = bindings->instance()->src_attribute(); | 583 std::string src = bindings->instance()->src_attribute(); |
| 619 return StringToNPVariant(src, result); | 584 return StringToNPVariant(src, result); |
| 620 } | 585 } |
| 621 virtual bool SetProperty(BrowserPluginBindings* bindings, | 586 virtual bool SetProperty(BrowserPluginBindings* bindings, |
| 622 NPObject* np_obj, | 587 NPObject* np_obj, |
| 623 const NPVariant* variant) OVERRIDE { | 588 const NPVariant* variant) OVERRIDE { |
| 624 std::string src = StringFromNPVariant(*variant); | 589 std::string src = StringFromNPVariant(*variant); |
| 625 std::string error_message; | 590 std::string error_message; |
| 626 if (!bindings->instance()->SetSrcAttribute(src, &error_message)) { | 591 if (!bindings->instance()->SetSrcAttribute(src, &error_message)) { |
| 627 WebBindings::setException( | 592 WebBindings::setException( |
| 628 np_obj, static_cast<const NPUTF8 *>(error_message.c_str())); | 593 np_obj, static_cast<const NPUTF8 *>(error_message.c_str())); |
| 629 return false; | 594 return false; |
| 630 } | 595 } |
| 631 return true; | 596 return true; |
| 632 } | 597 } |
| 633 virtual std::string GetDOMAttributeValue( | |
| 634 BrowserPlugin* browser_plugin) OVERRIDE { | |
| 635 return browser_plugin->src_attribute(); | |
| 636 } | |
| 637 private: | 598 private: |
| 638 DISALLOW_COPY_AND_ASSIGN(BrowserPluginPropertyBindingSrc); | 599 DISALLOW_COPY_AND_ASSIGN(BrowserPluginPropertyBindingSrc); |
| 639 }; | 600 }; |
| 640 | 601 |
| 641 | 602 |
| 642 // BrowserPluginBindings ------------------------------------------------------ | 603 // BrowserPluginBindings ------------------------------------------------------ |
| 643 | 604 |
| 644 BrowserPluginBindings::BrowserPluginNPObject::BrowserPluginNPObject() { | 605 BrowserPluginBindings::BrowserPluginNPObject::BrowserPluginNPObject() { |
| 645 } | 606 } |
| 646 | 607 |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 712 } | 673 } |
| 713 return false; | 674 return false; |
| 714 } | 675 } |
| 715 | 676 |
| 716 bool BrowserPluginBindings::SetProperty(NPObject* np_obj, | 677 bool BrowserPluginBindings::SetProperty(NPObject* np_obj, |
| 717 NPIdentifier name, | 678 NPIdentifier name, |
| 718 const NPVariant* variant) { | 679 const NPVariant* variant) { |
| 719 for (PropertyBindingList::iterator iter = property_bindings_.begin(); | 680 for (PropertyBindingList::iterator iter = property_bindings_.begin(); |
| 720 iter != property_bindings_.end(); | 681 iter != property_bindings_.end(); |
| 721 ++iter) { | 682 ++iter) { |
| 722 if ((*iter)->MatchesName(name)) { | 683 if ((*iter)->MatchesName(name)) |
| 723 if ((*iter)->SetProperty(this, np_obj, variant)) { | 684 return (*iter)->SetProperty(this, np_obj, variant); |
| 724 (*iter)->UpdateDOMAttribute(this); | |
| 725 return true; | |
| 726 } | |
| 727 break; | |
| 728 } | |
| 729 } | 685 } |
| 730 return false; | 686 return false; |
| 731 } | 687 } |
| 732 | 688 |
| 733 bool BrowserPluginBindings::GetProperty(NPIdentifier name, NPVariant* result) { | 689 bool BrowserPluginBindings::GetProperty(NPIdentifier name, NPVariant* result) { |
| 734 for (PropertyBindingList::iterator iter = property_bindings_.begin(); | 690 for (PropertyBindingList::iterator iter = property_bindings_.begin(); |
| 735 iter != property_bindings_.end(); | 691 iter != property_bindings_.end(); |
| 736 ++iter) { | 692 ++iter) { |
| 737 if ((*iter)->MatchesName(name)) | 693 if ((*iter)->MatchesName(name)) |
| 738 return (*iter)->GetProperty(this, result); | 694 return (*iter)->GetProperty(this, result); |
| 739 } | 695 } |
| 740 return false; | 696 return false; |
| 741 } | 697 } |
| 742 | 698 |
| 743 } // namespace content | 699 } // namespace content |
| OLD | NEW |