Chromium Code Reviews| Index: pdf/out_of_process_instance.cc |
| diff --git a/pdf/out_of_process_instance.cc b/pdf/out_of_process_instance.cc |
| index 74544d90e2724c529408ae4f21d217e116c0e643..9e340cdd2ef3ca4401e62c18eb7c3780a0a4934e 100644 |
| --- a/pdf/out_of_process_instance.cc |
| +++ b/pdf/out_of_process_instance.cc |
| @@ -140,9 +140,12 @@ const char kJSGetSelectedTextType[] = "getSelectedText"; |
| const char kJSGetSelectedTextReplyType[] = "getSelectedTextReply"; |
| const char kJSSelectedText[] = "selectedText"; |
| -// List of named destinations (Plugin -> Page) |
| -const char kJSSetNamedDestinationsType[] = "setNamedDestinations"; |
| -const char kJSNamedDestinations[] = "namedDestinations"; |
| +// Get the named destinations (Page -> Plugin) |
|
raymes
2015/02/16 02:02:31
nit: Get the named destination with the given name
Deepak
2015/02/16 06:45:38
Done.
|
| +const char KJSGetNamedDestinationType[] = "getNamedDestination"; |
| +const char KJSGetNamedDestination[] = "namedDestination"; |
| +// Reply with page number of named destination (Plugin -> Page) |
|
raymes
2015/02/16 02:02:31
nit: Reply with the page number of the named desti
Deepak
2015/02/16 06:45:38
Done.
|
| +const char kJSGetNamedDestinationReplyType[] = "getNamedDestinationReply"; |
| +const char kJSNamedDestinationPageNumber[] = "namedDestinationPageNumber"; |
| // Selecting text in document (Plugin -> Page) |
| const char kJSSetIsSelectingType[] = "setIsSelecting"; |
| @@ -480,6 +483,15 @@ void OutOfProcessInstance::HandleMessage(const pp::Var& message) { |
| reply.Set(pp::Var(kType), pp::Var(kJSGetSelectedTextReplyType)); |
| reply.Set(pp::Var(kJSSelectedText), selected_text); |
| PostMessage(reply); |
| + } else if (type == KJSGetNamedDestinationType && |
| + dict.Get(pp::Var(KJSGetNamedDestination)).is_string()) { |
| + int page_number = engine_->GetNamedDestinationPage( |
| + dict.Get(pp::Var(KJSGetNamedDestination)).AsString()); |
| + pp::VarDictionary reply; |
| + reply.Set(pp::Var(kType), pp::Var(kJSGetNamedDestinationReplyType)); |
| + if (page_number >= 0) |
| + reply.Set(pp::Var(kJSNamedDestinationPageNumber), page_number); |
| + PostMessage(reply); |
| } else { |
| NOTREACHED(); |
| } |
| @@ -1095,14 +1107,6 @@ void OutOfProcessInstance::DocumentLoadComplete(int page_count) { |
| OnGeometryChanged(0, 0); |
| } |
| - pp::VarDictionary named_destinations_message; |
| - pp::VarDictionary named_destinations = engine_->GetNamedDestinations(); |
|
raymes
2015/02/16 02:02:31
nit: This function is now unused, let's remove it
Deepak
2015/02/16 06:45:38
Done.
|
| - named_destinations_message.Set(pp::Var(kType), |
| - pp::Var(kJSSetNamedDestinationsType)); |
| - named_destinations_message.Set(pp::Var(kJSNamedDestinations), |
| - pp::Var(named_destinations)); |
| - PostMessage(named_destinations_message); |
| - |
| pp::VarDictionary bookmarks_message; |
| bookmarks_message.Set(pp::Var(kType), pp::Var(kJSBookmarksType)); |
| bookmarks_message.Set(pp::Var(kJSBookmarks), engine_->GetBookmarks()); |