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 NPIdentifier name, | 401 NPIdentifier name, |
400 NPVariant* result) = 0; | 402 NPVariant* result) = 0; |
401 virtual bool SetProperty(BrowserPluginBindings* bindings, | 403 virtual bool SetProperty(BrowserPluginBindings* bindings, |
402 NPObject* np_obj, | 404 NPObject* np_obj, |
403 NPIdentifier name, | 405 NPIdentifier name, |
404 const NPVariant* variant) = 0; | 406 const NPVariant* variant) = 0; |
407 virtual void UpdateDOMAttribute(BrowserPluginBindings* bindings) = 0; | |
lazyboy
2012/11/30 22:11:36
I'd make this non pure virtual, and remove empty i
Fady Samuel
2012/11/30 22:57:12
Done.
| |
405 private: | 408 private: |
406 std::string name_; | 409 std::string name_; |
407 | 410 |
408 DISALLOW_COPY_AND_ASSIGN(BrowserPluginPropertyBinding); | 411 DISALLOW_COPY_AND_ASSIGN(BrowserPluginPropertyBinding); |
409 }; | 412 }; |
410 | 413 |
411 class BrowserPluginPropertyBindingAutoSize | 414 class BrowserPluginPropertyBindingAutoSize |
412 : public BrowserPluginPropertyBinding { | 415 : public BrowserPluginPropertyBinding { |
413 public: | 416 public: |
414 BrowserPluginPropertyBindingAutoSize() : | 417 BrowserPluginPropertyBindingAutoSize() : |
415 BrowserPluginPropertyBinding(kAttributeAutoSize) { | 418 BrowserPluginPropertyBinding(kAttributeAutoSize) { |
416 } | 419 } |
417 virtual bool GetProperty(BrowserPluginBindings* bindings, | 420 virtual bool GetProperty(BrowserPluginBindings* bindings, |
418 NPIdentifier name, | 421 NPIdentifier name, |
419 NPVariant* result) OVERRIDE { | 422 NPVariant* result) OVERRIDE { |
420 bool autosize = bindings->instance()->auto_size_attribute(); | 423 bool auto_size = bindings->instance()->auto_size_attribute(); |
421 BOOLEAN_TO_NPVARIANT(autosize, *result); | 424 BOOLEAN_TO_NPVARIANT(auto_size, *result); |
422 return true; | 425 return true; |
423 } | 426 } |
424 virtual bool SetProperty(BrowserPluginBindings* bindings, | 427 virtual bool SetProperty(BrowserPluginBindings* bindings, |
425 NPObject* np_obj, | 428 NPObject* np_obj, |
426 NPIdentifier name, | 429 NPIdentifier name, |
427 const NPVariant* variant) OVERRIDE { | 430 const NPVariant* variant) OVERRIDE { |
428 bool autosize = NPVARIANT_TO_BOOLEAN(*variant); | 431 bool auto_size = NPVARIANT_TO_BOOLEAN(*variant); |
429 bindings->instance()->SetAutoSizeAttribute(autosize); | 432 bindings->instance()->SetAutoSizeAttribute(auto_size); |
430 return true; | 433 return true; |
431 } | 434 } |
435 virtual void UpdateDOMAttribute(BrowserPluginBindings* bindings) OVERRIDE { | |
436 bool auto_size = bindings->instance()->auto_size_attribute(); | |
437 bindings->instance()->UpdateDOMAttribute( | |
438 name(), auto_size ? "true" : "false"); | |
439 } | |
432 private: | 440 private: |
433 DISALLOW_COPY_AND_ASSIGN(BrowserPluginPropertyBindingAutoSize); | 441 DISALLOW_COPY_AND_ASSIGN(BrowserPluginPropertyBindingAutoSize); |
434 }; | 442 }; |
435 | 443 |
436 class BrowserPluginPropertyBindingContentWindow | 444 class BrowserPluginPropertyBindingContentWindow |
437 : public BrowserPluginPropertyBinding { | 445 : public BrowserPluginPropertyBinding { |
438 public: | 446 public: |
439 BrowserPluginPropertyBindingContentWindow() : | 447 BrowserPluginPropertyBindingContentWindow() : |
440 BrowserPluginPropertyBinding(kAttributeContentWindow) { | 448 BrowserPluginPropertyBinding(kAttributeContentWindow) { |
441 } | 449 } |
442 virtual bool GetProperty(BrowserPluginBindings* bindings, | 450 virtual bool GetProperty(BrowserPluginBindings* bindings, |
443 NPIdentifier name, | 451 NPIdentifier name, |
444 NPVariant* result) OVERRIDE { | 452 NPVariant* result) OVERRIDE { |
445 NPObject* obj = bindings->instance()->GetContentWindow(); | 453 NPObject* obj = bindings->instance()->GetContentWindow(); |
446 if (obj) { | 454 if (obj) { |
447 result->type = NPVariantType_Object; | 455 result->type = NPVariantType_Object; |
448 result->value.objectValue = WebBindings::retainObject(obj); | 456 result->value.objectValue = WebBindings::retainObject(obj); |
449 } | 457 } |
450 return true; | 458 return true; |
451 } | 459 } |
452 virtual bool SetProperty(BrowserPluginBindings* bindings, | 460 virtual bool SetProperty(BrowserPluginBindings* bindings, |
453 NPObject* np_obj, | 461 NPObject* np_obj, |
454 NPIdentifier name, | 462 NPIdentifier name, |
455 const NPVariant* variant) OVERRIDE { | 463 const NPVariant* variant) OVERRIDE { |
456 return false; | 464 return false; |
457 } | 465 } |
466 virtual void UpdateDOMAttribute(BrowserPluginBindings* bindings) OVERRIDE { | |
467 } | |
458 private: | 468 private: |
459 DISALLOW_COPY_AND_ASSIGN(BrowserPluginPropertyBindingContentWindow); | 469 DISALLOW_COPY_AND_ASSIGN(BrowserPluginPropertyBindingContentWindow); |
460 }; | 470 }; |
461 | 471 |
462 class BrowserPluginPropertyBindingMaxHeight | 472 class BrowserPluginPropertyBindingMaxHeight |
463 : public BrowserPluginPropertyBinding { | 473 : public BrowserPluginPropertyBinding { |
464 public: | 474 public: |
465 BrowserPluginPropertyBindingMaxHeight() : | 475 BrowserPluginPropertyBindingMaxHeight() : |
466 BrowserPluginPropertyBinding(kAttributeMaxHeight) { | 476 BrowserPluginPropertyBinding(kAttributeMaxHeight) { |
467 } | 477 } |
468 virtual bool GetProperty(BrowserPluginBindings* bindings, | 478 virtual bool GetProperty(BrowserPluginBindings* bindings, |
469 NPIdentifier name, | 479 NPIdentifier name, |
470 NPVariant* result) OVERRIDE { | 480 NPVariant* result) OVERRIDE { |
471 int max_height = bindings->instance()->max_height_attribute(); | 481 int max_height = bindings->instance()->max_height_attribute(); |
472 INT32_TO_NPVARIANT(max_height, *result); | 482 INT32_TO_NPVARIANT(max_height, *result); |
473 return true; | 483 return true; |
474 } | 484 } |
475 virtual bool SetProperty(BrowserPluginBindings* bindings, | 485 virtual bool SetProperty(BrowserPluginBindings* bindings, |
476 NPObject* np_obj, | 486 NPObject* np_obj, |
477 NPIdentifier name, | 487 NPIdentifier name, |
478 const NPVariant* variant) OVERRIDE { | 488 const NPVariant* variant) OVERRIDE { |
479 int max_height = Int32FromNPVariant(*variant); | 489 int max_height = Int32FromNPVariant(*variant); |
480 bindings->instance()->SetMaxHeightAttribute(max_height); | 490 bindings->instance()->SetMaxHeightAttribute(max_height); |
481 return true; | 491 return true; |
482 } | 492 } |
493 virtual void UpdateDOMAttribute(BrowserPluginBindings* bindings) OVERRIDE { | |
494 int max_height = bindings->instance()->max_height_attribute(); | |
495 bindings->instance()->UpdateDOMAttribute( | |
496 name(), base::IntToString(max_height)); | |
497 } | |
483 private: | 498 private: |
484 DISALLOW_COPY_AND_ASSIGN(BrowserPluginPropertyBindingMaxHeight); | 499 DISALLOW_COPY_AND_ASSIGN(BrowserPluginPropertyBindingMaxHeight); |
485 }; | 500 }; |
486 | 501 |
487 class BrowserPluginPropertyBindingMaxWidth | 502 class BrowserPluginPropertyBindingMaxWidth |
488 : public BrowserPluginPropertyBinding { | 503 : public BrowserPluginPropertyBinding { |
489 public: | 504 public: |
490 BrowserPluginPropertyBindingMaxWidth() : | 505 BrowserPluginPropertyBindingMaxWidth() : |
491 BrowserPluginPropertyBinding(kAttributeMaxWidth) { | 506 BrowserPluginPropertyBinding(kAttributeMaxWidth) { |
492 } | 507 } |
493 virtual bool GetProperty(BrowserPluginBindings* bindings, | 508 virtual bool GetProperty(BrowserPluginBindings* bindings, |
494 NPIdentifier name, | 509 NPIdentifier name, |
495 NPVariant* result) OVERRIDE { | 510 NPVariant* result) OVERRIDE { |
496 int max_width = bindings->instance()->max_width_attribute(); | 511 int max_width = bindings->instance()->max_width_attribute(); |
497 INT32_TO_NPVARIANT(max_width, *result); | 512 INT32_TO_NPVARIANT(max_width, *result); |
498 return true; | 513 return true; |
499 } | 514 } |
500 virtual bool SetProperty(BrowserPluginBindings* bindings, | 515 virtual bool SetProperty(BrowserPluginBindings* bindings, |
501 NPObject* np_obj, | 516 NPObject* np_obj, |
502 NPIdentifier name, | 517 NPIdentifier name, |
503 const NPVariant* variant) OVERRIDE { | 518 const NPVariant* variant) OVERRIDE { |
504 int max_width = Int32FromNPVariant(*variant); | 519 int max_width = Int32FromNPVariant(*variant); |
505 bindings->instance()->SetMaxWidthAttribute(max_width); | 520 bindings->instance()->SetMaxWidthAttribute(max_width); |
506 return true; | 521 return true; |
507 } | 522 } |
523 virtual void UpdateDOMAttribute(BrowserPluginBindings* bindings) OVERRIDE { | |
524 int max_width = bindings->instance()->max_width_attribute(); | |
525 bindings->instance()->UpdateDOMAttribute( | |
526 name(), base::IntToString(max_width)); | |
527 } | |
508 private: | 528 private: |
509 DISALLOW_COPY_AND_ASSIGN(BrowserPluginPropertyBindingMaxWidth); | 529 DISALLOW_COPY_AND_ASSIGN(BrowserPluginPropertyBindingMaxWidth); |
510 }; | 530 }; |
511 | 531 |
512 class BrowserPluginPropertyBindingMinHeight | 532 class BrowserPluginPropertyBindingMinHeight |
513 : public BrowserPluginPropertyBinding { | 533 : public BrowserPluginPropertyBinding { |
514 public: | 534 public: |
515 BrowserPluginPropertyBindingMinHeight() : | 535 BrowserPluginPropertyBindingMinHeight() : |
516 BrowserPluginPropertyBinding(kAttributeMinHeight) { | 536 BrowserPluginPropertyBinding(kAttributeMinHeight) { |
517 } | 537 } |
518 virtual bool GetProperty(BrowserPluginBindings* bindings, | 538 virtual bool GetProperty(BrowserPluginBindings* bindings, |
519 NPIdentifier name, | 539 NPIdentifier name, |
520 NPVariant* result) OVERRIDE { | 540 NPVariant* result) OVERRIDE { |
521 int min_height = bindings->instance()->min_height_attribute(); | 541 int min_height = bindings->instance()->min_height_attribute(); |
522 INT32_TO_NPVARIANT(min_height, *result); | 542 INT32_TO_NPVARIANT(min_height, *result); |
523 return true; | 543 return true; |
524 } | 544 } |
525 virtual bool SetProperty(BrowserPluginBindings* bindings, | 545 virtual bool SetProperty(BrowserPluginBindings* bindings, |
526 NPObject* np_obj, | 546 NPObject* np_obj, |
527 NPIdentifier name, | 547 NPIdentifier name, |
528 const NPVariant* variant) OVERRIDE { | 548 const NPVariant* variant) OVERRIDE { |
529 int min_height = Int32FromNPVariant(*variant); | 549 int min_height = Int32FromNPVariant(*variant); |
530 bindings->instance()->SetMinHeightAttribute(min_height); | 550 bindings->instance()->SetMinHeightAttribute(min_height); |
531 return true; | 551 return true; |
532 } | 552 } |
553 virtual void UpdateDOMAttribute(BrowserPluginBindings* bindings) OVERRIDE { | |
554 int min_height = bindings->instance()->min_height_attribute(); | |
555 bindings->instance()->UpdateDOMAttribute( | |
556 name(), base::IntToString(min_height)); | |
557 } | |
533 private: | 558 private: |
534 DISALLOW_COPY_AND_ASSIGN(BrowserPluginPropertyBindingMinHeight); | 559 DISALLOW_COPY_AND_ASSIGN(BrowserPluginPropertyBindingMinHeight); |
535 }; | 560 }; |
536 | 561 |
537 class BrowserPluginPropertyBindingMinWidth | 562 class BrowserPluginPropertyBindingMinWidth |
538 : public BrowserPluginPropertyBinding { | 563 : public BrowserPluginPropertyBinding { |
539 public: | 564 public: |
540 BrowserPluginPropertyBindingMinWidth() : | 565 BrowserPluginPropertyBindingMinWidth() : |
541 BrowserPluginPropertyBinding(kAttributeMinWidth) { | 566 BrowserPluginPropertyBinding(kAttributeMinWidth) { |
542 } | 567 } |
543 virtual bool GetProperty(BrowserPluginBindings* bindings, | 568 virtual bool GetProperty(BrowserPluginBindings* bindings, |
544 NPIdentifier name, | 569 NPIdentifier name, |
545 NPVariant* result) OVERRIDE { | 570 NPVariant* result) OVERRIDE { |
546 int min_width = bindings->instance()->min_width_attribute(); | 571 int min_width = bindings->instance()->min_width_attribute(); |
547 INT32_TO_NPVARIANT(min_width, *result); | 572 INT32_TO_NPVARIANT(min_width, *result); |
548 return true; | 573 return true; |
549 } | 574 } |
550 virtual bool SetProperty(BrowserPluginBindings* bindings, | 575 virtual bool SetProperty(BrowserPluginBindings* bindings, |
551 NPObject* np_obj, | 576 NPObject* np_obj, |
552 NPIdentifier name, | 577 NPIdentifier name, |
553 const NPVariant* variant) OVERRIDE { | 578 const NPVariant* variant) OVERRIDE { |
554 int min_width = Int32FromNPVariant(*variant); | 579 int min_width = Int32FromNPVariant(*variant); |
555 bindings->instance()->SetMinWidthAttribute(min_width); | 580 bindings->instance()->SetMinWidthAttribute(min_width); |
556 return true; | 581 return true; |
557 } | 582 } |
583 virtual void UpdateDOMAttribute(BrowserPluginBindings* bindings) OVERRIDE { | |
584 int min_width = bindings->instance()->min_width_attribute(); | |
585 bindings->instance()->UpdateDOMAttribute( | |
586 name(), base::IntToString(min_width)); | |
587 } | |
558 private: | 588 private: |
559 DISALLOW_COPY_AND_ASSIGN(BrowserPluginPropertyBindingMinWidth); | 589 DISALLOW_COPY_AND_ASSIGN(BrowserPluginPropertyBindingMinWidth); |
560 }; | 590 }; |
561 | 591 |
562 class BrowserPluginPropertyBindingPartition | 592 class BrowserPluginPropertyBindingPartition |
563 : public BrowserPluginPropertyBinding { | 593 : public BrowserPluginPropertyBinding { |
564 public: | 594 public: |
565 BrowserPluginPropertyBindingPartition() : | 595 BrowserPluginPropertyBindingPartition() : |
566 BrowserPluginPropertyBinding(kAttributePartition) { | 596 BrowserPluginPropertyBinding(kAttributePartition) { |
567 } | 597 } |
(...skipping 10 matching lines...) Expand all Loading... | |
578 std::string partition_id = StringFromNPVariant(*variant); | 608 std::string partition_id = StringFromNPVariant(*variant); |
579 std::string error_message; | 609 std::string error_message; |
580 if (!bindings->instance()->SetPartitionAttribute(partition_id, | 610 if (!bindings->instance()->SetPartitionAttribute(partition_id, |
581 &error_message)) { | 611 &error_message)) { |
582 WebBindings::setException( | 612 WebBindings::setException( |
583 np_obj, static_cast<const NPUTF8 *>(error_message.c_str())); | 613 np_obj, static_cast<const NPUTF8 *>(error_message.c_str())); |
584 return false; | 614 return false; |
585 } | 615 } |
586 return true; | 616 return true; |
587 } | 617 } |
618 virtual void UpdateDOMAttribute(BrowserPluginBindings* bindings) OVERRIDE { | |
619 std::string partition_id = bindings->instance()->GetPartitionAttribute(); | |
620 bindings->instance()->UpdateDOMAttribute(name(), partition_id); | |
621 } | |
588 private: | 622 private: |
589 DISALLOW_COPY_AND_ASSIGN(BrowserPluginPropertyBindingPartition); | 623 DISALLOW_COPY_AND_ASSIGN(BrowserPluginPropertyBindingPartition); |
590 }; | 624 }; |
591 | 625 |
592 class BrowserPluginPropertyBindingSrc : public BrowserPluginPropertyBinding { | 626 class BrowserPluginPropertyBindingSrc : public BrowserPluginPropertyBinding { |
593 public: | 627 public: |
594 BrowserPluginPropertyBindingSrc() : | 628 BrowserPluginPropertyBindingSrc() : |
595 BrowserPluginPropertyBinding(kAttributeSrc) { | 629 BrowserPluginPropertyBinding(kAttributeSrc) { |
596 } | 630 } |
597 virtual bool GetProperty(BrowserPluginBindings* bindings, | 631 virtual bool GetProperty(BrowserPluginBindings* bindings, |
598 NPIdentifier name, | 632 NPIdentifier name, |
599 NPVariant* result) OVERRIDE { | 633 NPVariant* result) OVERRIDE { |
600 std::string src = bindings->instance()->src_attribute(); | 634 std::string src = bindings->instance()->src_attribute(); |
601 return StringToNPVariant(src, result); | 635 return StringToNPVariant(src, result); |
602 } | 636 } |
603 virtual bool SetProperty(BrowserPluginBindings* bindings, | 637 virtual bool SetProperty(BrowserPluginBindings* bindings, |
604 NPObject* np_obj, | 638 NPObject* np_obj, |
605 NPIdentifier name, | 639 NPIdentifier name, |
606 const NPVariant* variant) OVERRIDE { | 640 const NPVariant* variant) OVERRIDE { |
607 std::string src = StringFromNPVariant(*variant); | 641 std::string src = StringFromNPVariant(*variant); |
608 std::string error_message; | 642 std::string error_message; |
609 if (!bindings->instance()->SetSrcAttribute(src, &error_message)) { | 643 if (!bindings->instance()->SetSrcAttribute(src, &error_message)) { |
610 WebBindings::setException( | 644 WebBindings::setException( |
611 np_obj, static_cast<const NPUTF8 *>(error_message.c_str())); | 645 np_obj, static_cast<const NPUTF8 *>(error_message.c_str())); |
612 return false; | 646 return false; |
613 } | 647 } |
614 return true; | 648 return true; |
615 } | 649 } |
650 virtual void UpdateDOMAttribute(BrowserPluginBindings* bindings) OVERRIDE { | |
651 std::string src = bindings->instance()->src_attribute(); | |
652 bindings->instance()->UpdateDOMAttribute(name(), src); | |
653 } | |
616 private: | 654 private: |
617 DISALLOW_COPY_AND_ASSIGN(BrowserPluginPropertyBindingSrc); | 655 DISALLOW_COPY_AND_ASSIGN(BrowserPluginPropertyBindingSrc); |
618 }; | 656 }; |
619 | 657 |
620 | 658 |
621 // BrowserPluginBindings ------------------------------------------------------ | 659 // BrowserPluginBindings ------------------------------------------------------ |
622 | 660 |
623 BrowserPluginBindings::BrowserPluginNPObject::BrowserPluginNPObject() { | 661 BrowserPluginBindings::BrowserPluginNPObject::BrowserPluginNPObject() { |
624 } | 662 } |
625 | 663 |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
691 } | 729 } |
692 return false; | 730 return false; |
693 } | 731 } |
694 | 732 |
695 bool BrowserPluginBindings::SetProperty(NPObject* np_obj, | 733 bool BrowserPluginBindings::SetProperty(NPObject* np_obj, |
696 NPIdentifier name, | 734 NPIdentifier name, |
697 const NPVariant* variant) { | 735 const NPVariant* variant) { |
698 for (PropertyBindingList::iterator iter = property_bindings_.begin(); | 736 for (PropertyBindingList::iterator iter = property_bindings_.begin(); |
699 iter != property_bindings_.end(); | 737 iter != property_bindings_.end(); |
700 ++iter) { | 738 ++iter) { |
701 if ((*iter)->MatchesName(name)) | 739 if ((*iter)->MatchesName(name)) { |
702 return (*iter)->SetProperty(this, np_obj, name, variant); | 740 if ((*iter)->SetProperty(this, np_obj, name, variant)) { |
741 (*iter)->UpdateDOMAttribute(this); | |
742 return true; | |
743 } | |
744 return false; | |
lazyboy
2012/11/30 22:11:36
nit: is break; more readable? not sure.
Fady Samuel
2012/11/30 22:57:12
I'm indifferent. I just changed it to break;
| |
745 } | |
703 } | 746 } |
704 return false; | 747 return false; |
705 } | 748 } |
706 | 749 |
707 bool BrowserPluginBindings::GetProperty(NPIdentifier name, NPVariant* result) { | 750 bool BrowserPluginBindings::GetProperty(NPIdentifier name, NPVariant* result) { |
708 for (PropertyBindingList::iterator iter = property_bindings_.begin(); | 751 for (PropertyBindingList::iterator iter = property_bindings_.begin(); |
709 iter != property_bindings_.end(); | 752 iter != property_bindings_.end(); |
710 ++iter) { | 753 ++iter) { |
711 if ((*iter)->MatchesName(name)) | 754 if ((*iter)->MatchesName(name)) |
712 return (*iter)->GetProperty(this, name, result); | 755 return (*iter)->GetProperty(this, name, result); |
713 } | 756 } |
714 return false; | 757 return false; |
715 } | 758 } |
716 | 759 |
717 } // namespace content | 760 } // namespace content |
OLD | NEW |