Salesforce – How to retrieve list of Chatter Files related to a record?

Files associated with a record can be stored in 2 ways: as an attachment (in the Notes & Attachments related list) as well as Salesforce Content (using Chatter Files).

Recently I had a task to create Visualforce pages, which put on the Page Layout as inline Visualforce showed the files posted by Chatter Files associated with the record. Adding files was carried out by the Chatter. Assigning Topics to an entry in Chatter allowed to filter files by this as a category.