| Index: content/renderer/browser_plugin/browser_plugin.cc
|
| diff --git a/content/renderer/browser_plugin/browser_plugin.cc b/content/renderer/browser_plugin/browser_plugin.cc
|
| index a2c0ed0a5ea10bd3e55e91d59f33a5780092191c..c0e255ea54eaea7f901d2cfdba5d7b1513a4e55d 100644
|
| --- a/content/renderer/browser_plugin/browser_plugin.cc
|
| +++ b/content/renderer/browser_plugin/browser_plugin.cc
|
| @@ -6,6 +6,7 @@
|
|
|
| #include "base/json/json_string_value_serializer.h"
|
| #include "base/message_loop.h"
|
| +#include "base/string_number_conversions.h"
|
| #include "base/string_util.h"
|
| #include "base/utf_string_conversions.h"
|
| #include "content/common/browser_plugin_messages.h"
|
| @@ -66,8 +67,8 @@ const char kOldWidth[] = "oldWidth";
|
| const char kPartition[] = "partition";
|
| const char kPersistPrefix[] = "persist:";
|
| const char kProcessId[] = "processId";
|
| -const char kSrc[] = "src";
|
| const char kReason[] = "reason";
|
| +const char kSrc[] = "src";
|
| const char kURL[] = "url";
|
|
|
| // Error messages.
|
| @@ -259,6 +260,27 @@ bool BrowserPlugin::DamageBufferMatches(
|
| }
|
| #endif
|
|
|
| +void BrowserPlugin::UpdateDOMAttribute(
|
| + const std::string& attribute_name,
|
| + const std::string& attribute_value) {
|
| + if (!container())
|
| + return;
|
| +
|
| + WebKit::WebElement element = container()->element();
|
| + WebKit::WebString web_attribute_name =
|
| + WebKit::WebString::fromUTF8(attribute_name);
|
| + std::string current_value(element.getAttribute(web_attribute_name).utf8());
|
| + if (current_value == attribute_value)
|
| + return;
|
| +
|
| + if (attribute_value.empty()) {
|
| + element.removeAttribute(web_attribute_name);
|
| + } else {
|
| + element.setAttribute(web_attribute_name,
|
| + WebKit::WebString::fromUTF8(attribute_value));
|
| + }
|
| +}
|
| +
|
| void BrowserPlugin::SetMaxHeightAttribute(int max_height) {
|
| if (max_height_ == max_height)
|
| return;
|
| @@ -613,8 +635,10 @@ void BrowserPlugin::LoadCommit(
|
| // If the guest has just committed a new navigation then it is no longer
|
| // crashed.
|
| guest_crashed_ = false;
|
| - if (params.is_top_level)
|
| + if (params.is_top_level) {
|
| src_ = params.url.spec();
|
| + UpdateDOMAttribute(kSrc, src_.c_str());
|
| + }
|
| process_id_ = params.process_id;
|
| current_nav_entry_index_ = params.current_entry_index;
|
| nav_entry_count_ = params.entry_count;
|
|
|