diff options
author | sammc <sammc@chromium.org> | 2015-08-27 03:25:35 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-08-27 10:26:28 +0000 |
commit | 2dd06eeefec484e31debecc4552ddd3f3cf96726 (patch) | |
tree | 193b66102ec48da9f2bc961c74a964c621ccaf55 /pdf/out_of_process_instance.cc | |
parent | 2ceaaf510f1e9fcc6b4e8560af16cf5d2f81328e (diff) | |
download | chromium_src-2dd06eeefec484e31debecc4552ddd3f3cf96726.zip chromium_src-2dd06eeefec484e31debecc4552ddd3f3cf96726.tar.gz chromium_src-2dd06eeefec484e31debecc4552ddd3f3cf96726.tar.bz2 |
PDF: Use PDF metadata for the title instead of the last path element.
Review URL: https://codereview.chromium.org/1303103003
Cr-Commit-Position: refs/heads/master@{#345838}
Diffstat (limited to 'pdf/out_of_process_instance.cc')
-rw-r--r-- | pdf/out_of_process_instance.cc | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/pdf/out_of_process_instance.cc b/pdf/out_of_process_instance.cc index dbe3968..5f60a4b 100644 --- a/pdf/out_of_process_instance.cc +++ b/pdf/out_of_process_instance.cc @@ -77,9 +77,10 @@ const char kJSPageHeight[] = "height"; // Document load progress arguments (Plugin -> Page) const char kJSLoadProgressType[] = "loadProgress"; const char kJSProgressPercentage[] = "progress"; -// Bookmarks -const char kJSBookmarksType[] = "bookmarks"; +// Metadata +const char kJSMetadataType[] = "metadata"; const char kJSBookmarks[] = "bookmarks"; +const char kJSTitle[] = "title"; // Get password arguments (Plugin -> Page) const char kJSGetPasswordType[] = "getPassword"; // Get password complete arguments (Page -> Plugin) @@ -1126,10 +1127,14 @@ void OutOfProcessInstance::DocumentLoadComplete(int page_count) { OnGeometryChanged(0, 0); } - pp::VarDictionary bookmarks_message; - bookmarks_message.Set(pp::Var(kType), pp::Var(kJSBookmarksType)); - bookmarks_message.Set(pp::Var(kJSBookmarks), engine_->GetBookmarks()); - PostMessage(bookmarks_message); + pp::VarDictionary metadata_message; + metadata_message.Set(pp::Var(kType), pp::Var(kJSMetadataType)); + std::string title = engine_->GetMetadata("Title"); + if (!title.empty()) + metadata_message.Set(pp::Var(kJSTitle), pp::Var(title)); + + metadata_message.Set(pp::Var(kJSBookmarks), engine_->GetBookmarks()); + PostMessage(metadata_message); pp::VarDictionary progress_message; progress_message.Set(pp::Var(kType), pp::Var(kJSLoadProgressType)); |