xref: /haiku/src/servers/registrar/mime/UpdateMimeInfoThread.cpp (revision 1deede7388b04dbeec5af85cae7164735ea9e70d)
1 /*
2  * Copyright 2002-2013, Haiku, Inc. All Rights Reserved.
3  * Distributed under the terms of the MIT License.
4  *
5  * Authors:
6  *		Tyler Dauwalder
7  *		Jonas Sundström, jonas@kirilla.com
8  *		Michael Lotz, mmlr@mlotz.ch
9  *		Ingo Weinhold, ingo_weinhold@gmx.de
10  */
11 /*!
12 	\file UpdateMimeInfoThread.h
13 	UpdateMimeInfoThread implementation
14 */
15 
16 
17 #include "UpdateMimeInfoThread.h"
18 
19 
20 namespace BPrivate {
21 namespace Storage {
22 namespace Mime {
23 
24 
25 //! Creates a new UpdateMimeInfoThread object
26 UpdateMimeInfoThread::UpdateMimeInfoThread(const char* name, int32 priority,
27 	Database* database, MimeEntryProcessor::DatabaseLocker* databaseLocker,
28 	BMessenger managerMessenger, const entry_ref* root, bool recursive,
29 	int32 force, BMessage* replyee)
30 	:
31 	MimeUpdateThread(name, priority, database, managerMessenger, root,
32 		recursive, force, replyee),
33 	fUpdater(database, databaseLocker, force)
34 {
35 }
36 
37 
38 /*! \brief Performs an update_mime_info() update on the given entry
39 
40 	If the entry has no \c BEOS:TYPE attribute, or if \c fForce is true, the
41 	entry is sniffed and its \c BEOS:TYPE attribute is set accordingly.
42 */
43 status_t
44 UpdateMimeInfoThread::DoMimeUpdate(const entry_ref* entry, bool* _entryIsDir)
45 {
46 	if (entry == NULL)
47 		return B_BAD_VALUE;
48 
49 	return fUpdater.Do(*entry, _entryIsDir);
50 }
51 
52 
53 }	// namespace Mime
54 }	// namespace Storage
55 }	// namespace BPrivate
56 
57