9 * Initial Contributors: |
9 * Initial Contributors: |
10 * Nokia Corporation - initial contribution. |
10 * Nokia Corporation - initial contribution. |
11 * |
11 * |
12 * Contributors: |
12 * Contributors: |
13 * |
13 * |
14 * Description: Content plugin manager class for Active idle framework. |
14 * Description: Plugin factory class for Active idle framework. |
15 * |
15 * |
16 */ |
16 */ |
17 |
17 |
18 |
18 |
19 |
19 |
20 #ifndef C_AIPLUGINASYNCFACTORY_H |
20 #ifndef _AIPLUGINCFACTORY_H |
21 #define C_AIPLUGINASYNCFACTORY_H |
21 #define _AIPLUGINCFACTORY_H |
22 |
22 |
23 #include "aicontentpublisher.h" |
23 // System includes |
24 #include "aipropertyextension.h" |
|
25 #include "aifwdefs.h" |
|
26 #include <e32base.h> |
24 #include <e32base.h> |
|
25 #include <ecom/implementationinformation.h> |
27 |
26 |
28 class MAiContentObserver; |
27 // User includes |
29 class MAiEventHandlerExtension; |
|
30 class MAiContentItemIterator; |
|
31 class CAiContentPublisher; |
|
32 class CAiUiController; |
|
33 class CAiPluginActivityRegistry; |
|
34 class CImplementationInformation; |
|
35 class CAiContentPluginManager; |
|
36 class MAiPluginTool; |
|
37 class MAiPluginLifecycleObserver; |
|
38 |
28 |
|
29 // Forward declarations |
|
30 class CAiUiControllerManager; |
|
31 class CAiStateManager; |
|
32 class CHsContentPublisher; |
|
33 class THsPublisherInfo; |
|
34 |
|
35 // Class declaration |
39 /** |
36 /** |
40 * @ingroup group_aifw |
37 * @ingroup group_aifw |
41 * |
38 * |
42 * Content plugin factory class for Active idle framework. |
39 * Plugin factory class for Active idle framework. |
43 * |
40 * |
44 * @lib aifw |
41 * @lib aifw |
45 * @since S60 3.2 |
42 * @since S60 5.2 |
46 */ |
43 */ |
47 NONSHARABLE_CLASS( CAiPluginFactory ) : public CBase |
44 NONSHARABLE_CLASS( CAiPluginFactory ) : public CBase |
48 { |
45 { |
49 public: |
46 public: |
|
47 // Constructors and destructor |
|
48 |
|
49 /** |
|
50 * Two-phased constructor. |
|
51 */ |
|
52 static CAiPluginFactory* NewL( CAiUiControllerManager& aManager ); |
50 |
53 |
51 // Constructor and destructor |
54 /** |
|
55 * Destructor |
|
56 */ |
|
57 ~CAiPluginFactory(); |
|
58 |
|
59 public: |
|
60 // new functions |
52 |
61 |
53 static CAiPluginFactory* NewL( RPointerArray<CAiContentPublisher>& aPlugins, |
62 /** |
54 CAiContentPluginManager& aManager ); |
63 * Create plugin |
|
64 * |
|
65 * @since S60 5.2 |
|
66 * @param aPublisherInfo plugin to create. Factory keeps plugin's ownership. |
|
67 * @return KErrNone if plugin is created succesfully, otherwise system wide error code. |
|
68 */ |
|
69 TInt CreatePlugin( |
|
70 const THsPublisherInfo& aPublisherInfo ); |
|
71 |
|
72 /** |
|
73 * Destroy plugin |
|
74 * |
|
75 * @since S60 5.2 |
|
76 * @param aPublisherInfo plugin to destroy. |
|
77 */ |
|
78 void DestroyPlugin( |
|
79 const THsPublisherInfo& aPublisherInfo ); |
|
80 |
|
81 /** |
|
82 * Finds plugin by publisher info. |
|
83 * |
|
84 * @since S60 5.2 |
|
85 * @param aInfo publisher info. |
|
86 * @return Pointer to plugin, NULL if not found. Factory keeps plugin's ownership. |
|
87 */ |
|
88 CHsContentPublisher* PluginByInfo( |
|
89 const THsPublisherInfo& aPublisherInfo ) const; |
|
90 |
|
91 /** |
|
92 * Finds plugin by uid. |
|
93 * |
|
94 * @since S60 5.2 |
|
95 * @param aInfo publisher uid. |
|
96 * @return Pointer to plugin, NULL if not found. Factory keeps plugin's ownership. |
|
97 */ |
|
98 CHsContentPublisher* PluginByUid( const TUid& aUid ) const; |
|
99 |
|
100 /** |
|
101 * Finds plugin by name. |
|
102 * |
|
103 * @since S60 5.2 |
|
104 * @param aInfo publisher info. |
|
105 * @return Pointer to plugin, NULL if not found. Factory keeps plugin's ownership. |
|
106 */ |
|
107 CHsContentPublisher* PluginByName( const TDesC& aName ) const; |
|
108 |
|
109 private: |
|
110 // private constructors |
|
111 |
|
112 /** |
|
113 * Leaving constructor |
|
114 */ |
|
115 void ConstructL(); |
|
116 |
|
117 /** |
|
118 * C++ default constructor |
|
119 */ |
|
120 CAiPluginFactory( CAiUiControllerManager& aManager ); |
55 |
121 |
56 virtual ~CAiPluginFactory(); |
122 private: |
|
123 // new functions |
|
124 |
|
125 void CreatePluginL( |
|
126 const THsPublisherInfo& aPublisherInfo ); |
|
127 |
|
128 void SubscribeContentObserversL( |
|
129 CHsContentPublisher& aContentPublisher, |
|
130 const THsPublisherInfo& aPublisherInfo ); |
|
131 |
|
132 void ConfigurePluginL( |
|
133 CHsContentPublisher& aContentPublisher, |
|
134 const THsPublisherInfo& aPublisherInfo ); |
|
135 |
|
136 RPointerArray< CHsContentPublisher >& Publishers() const; |
|
137 |
|
138 void ResolvePluginsToUpgradeL( |
|
139 RArray< THsPublisherInfo >& aArray ); |
|
140 |
|
141 private: |
|
142 // data |
57 |
143 |
58 // New functions |
144 /** UI Controller Manager, Not owned */ |
59 |
145 CAiUiControllerManager& iUiControllerManager; |
60 /** |
146 /** Array of loaded data plugins, Owned */ |
61 * Create plugin |
147 mutable RPointerArray< CHsContentPublisher > iPublishers; |
62 * |
148 /** Ecom implementation info, Owned */ |
63 * @since S60 5.0 |
149 RImplInfoPtrArray iEComPlugins; |
64 * @param aPublisherInfo plugin to load. |
150 |
65 * @param aControllerArray array of active UI controllers. |
151 private: |
66 */ |
152 // friend classes |
67 void CreatePluginL( const TAiPublisherInfo& aPublisherInfo, |
153 friend class CAiStateManager; |
68 RPointerArray<CAiUiController>& aControllerArray ); |
154 |
69 |
155 #ifdef _AIFW_UNIT_TEST |
70 /** |
156 friend class UT_AiPluginFactory; |
71 * Destroy plugin |
157 #endif |
72 * |
|
73 * @since S60 5.0 |
|
74 * @param aPublisherInfo plugin to destroy. |
|
75 * @param aControllerArray array of active UI controllers. |
|
76 */ |
|
77 void DestroyPluginL( const TAiPublisherInfo& aPublisherInfo, |
|
78 RPointerArray<CAiUiController>& aControllerArray ); |
|
79 |
|
80 /** |
|
81 * Destroys all plugins |
|
82 * |
|
83 * @since S60 5.0 |
|
84 */ |
|
85 void DestroyPlugins(); |
|
86 |
|
87 |
|
88 void AddLifecycleObserverL( MAiPluginLifecycleObserver& aObserver ); |
|
89 |
|
90 /** |
|
91 * Finds plugin by publisher info. |
|
92 * |
|
93 * @since S60 5.0 |
|
94 * @param aInfo publisher info. |
|
95 * @return Pointer to plugin, NULL if not found. |
|
96 */ |
|
97 CAiContentPublisher* PluginByInfoL( const TAiPublisherInfo& aInfo ) const; |
|
98 |
|
99 /** |
|
100 * Finds plugin by name. |
|
101 * |
|
102 * @since S60 5.0 |
|
103 * @param aInfo publisher info. |
|
104 * @return Pointer to plugin, NULL if not found. |
|
105 */ |
|
106 CAiContentPublisher* PluginByNameL( const TDesC& aName ) const; |
|
107 |
|
108 private: |
|
109 |
|
110 // Constructors |
|
111 |
|
112 CAiPluginFactory( RPointerArray<CAiContentPublisher>& aPlugins, |
|
113 CAiContentPluginManager& aManager ); |
|
114 |
|
115 void ConstructL(); |
|
116 |
|
117 // New functions |
|
118 |
|
119 CAiContentPublisher* CreatePluginLC( const TAiPublisherInfo& aPluginInfo ); |
|
120 |
|
121 void SubscribeContentObserversL( CAiContentPublisher& aContentPublisher, |
|
122 const TAiPublisherInfo& aPublisherInfo, |
|
123 RPointerArray<CAiUiController>& aControllerArray ); |
|
124 |
|
125 void ConfigurePluginL( RPointerArray<CAiUiController>& aControllerArray, |
|
126 CAiContentPublisher& aContentPublisher, |
|
127 const TAiPublisherInfo& aPubInfo ); |
|
128 |
|
129 private: // Data |
|
130 // Array of loaded data plugins, Not owned |
|
131 RPointerArray<CAiContentPublisher>& iPlugins; |
|
132 // Content plugin manager, Not owned |
|
133 CAiContentPluginManager& iManager; |
|
134 // Ecom implementation info, Owned |
|
135 RImplInfoPtrArray iEComPlugins; |
|
136 // Plugin tool from utility lib, Owned |
|
137 MAiPluginTool* iPluginTool; |
|
138 // Life cycle observers, Owned |
|
139 RPointerArray<MAiPluginLifecycleObserver> iLifecycleObservers; |
|
140 }; |
158 }; |
141 |
159 |
142 #endif // C_AIPLUGINASYNCFACTORY_H |
160 #endif // _AIPLUGINCFACTORY_H |
143 |
161 |
144 // End of File. |
162 // End of File. |