diff options
author | Tommi Komulainen <tko@litl.com> | 2009-08-25 10:46:11 (GMT) |
---|---|---|
committer | Marco Pesenti Gritti <marcopg@litl.com> | 2010-07-27 22:04:22 (GMT) |
commit | 60cc60c16e52601993c77076dab3eeb9d1f0ab1a (patch) | |
tree | 70c6252fbcaf4eddb0dc168b9082d111cce0589e | |
parent | ae40e6243010b7049525f02b3d6d6f6497d1a70c (diff) |
browser-plugin: notify browser of title changes
PDF loading may (or may not) finish after the browser has had its change
to set up the magicWrapper so let the browser know about the document
title.
Example:
let embed = document.embeds[0];
embed.magicWrapper = {
onTitleChanged: function() {
// update document / page title to that of the PDF file
document.title = embed.title;
}
};
-rw-r--r-- | browser-plugin/plugin.cpp | 2 | ||||
-rw-r--r-- | browser-plugin/scriptable.cpp | 4 |
2 files changed, 6 insertions, 0 deletions
diff --git a/browser-plugin/plugin.cpp b/browser-plugin/plugin.cpp index 978f9c0..8398db3 100644 --- a/browser-plugin/plugin.cpp +++ b/browser-plugin/plugin.cpp @@ -246,6 +246,8 @@ Plugin::LoadJobFinishedCallback (EvJob *job, gpointer data) if (doc_info->fields_mask & EV_DOCUMENT_INFO_TITLE) { plugin->mTitle = g_strdup (doc_info->title); + + plugin->CallBrowser ("onTitleChanged"); } ev_document_info_free (doc_info); diff --git a/browser-plugin/scriptable.cpp b/browser-plugin/scriptable.cpp index ff4f064..6272c7d 100644 --- a/browser-plugin/scriptable.cpp +++ b/browser-plugin/scriptable.cpp @@ -287,6 +287,10 @@ ScriptablePluginObject::SetProperty (NPIdentifier name, const NPVariant *value) } mMagicWrapper = newWrapper; + if (plugin->mTitle) { + CallBrowser ("onTitleChanged"); + } + return true; } |