1 /* 2 * Copyright 2011, Haiku, Inc. 3 * Distributed under the terms of the MIT License. 4 */ 5 #ifndef _PACKAGE__CONTEXT_H_ 6 #define _PACKAGE__CONTEXT_H_ 7 8 9 #include <Entry.h> 10 #include <String.h> 11 12 13 namespace BPackageKit { 14 15 16 class BJobStateListener; 17 namespace BPrivate { 18 class TempfileManager; 19 } 20 21 22 struct BDecisionProvider { 23 virtual ~BDecisionProvider(); 24 25 virtual bool YesNoDecisionNeeded(const BString& description, 26 const BString& question, 27 const BString& yes, const BString& no, 28 const BString& defaultChoice); 29 // virtual bool ActionsAcceptanceDecisionNeeded( 30 // const BString& description, 31 // const BString& question) = 0; 32 // virtual int32 ChoiceDecisionNeeded( 33 // const BString& question) = 0; 34 }; 35 36 37 class BContext { 38 public: 39 BContext(BDecisionProvider& decisionProvider, 40 BJobStateListener& jobStateListener); 41 ~BContext(); 42 43 status_t InitCheck() const; 44 45 status_t GetNewTempfile(const BString& baseName, 46 BEntry* entry) const; 47 48 BDecisionProvider& DecisionProvider() const; 49 BJobStateListener& JobStateListener() const; 50 51 private: 52 status_t _Initialize(); 53 54 BDecisionProvider& fDecisionProvider; 55 BJobStateListener& fJobStateListener; 56 status_t fInitStatus; 57 58 mutable BPrivate::TempfileManager* fTempfileManager; 59 }; 60 61 62 } // namespace BPackageKit 63 64 65 #endif // _PACKAGE__CONTEXT_H_ 66