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