It can be both. In my every day use case, I am already chatting with somebody when during the conversation I think of a picture I should send him. In this case, I would consider it odd to leave the conversation UI, go to the image viewer, choose the image, tap "share", select service, select contact, ... both service and contact are already known and mustn't be re-entered. (Also, especially if the other party initiated the chat, I might not know easily which service we're using.) So I'd prefer a way to select and send files directly from the chat UI.