2 * Copyright (c) 2013 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 * @file i_context_manager.h
18 * @author Iwanek Tomasz (t.iwanek@samsung.com)
20 * @brief Abstract file for handling operation regarding Ewk_Context.
23 #ifndef ABSTRACT_CONTEXT_MANAGER_H
24 #define ABSTRACT_CONTEXT_MANAGER_H
28 #include <i_view_module.h>
30 class Ewk_Context; // forward declaration of context type
32 namespace ViewModule {
34 class IContextManager;
35 typedef std::shared_ptr<IContextManager> ContextManagerPtr;
37 typedef std::function<ContextManagerPtr (const std::string&, Ewk_Context*, ViewModule::IViewModulePtr)> ContextManagerFactoryMethod;
40 * @brief The AbstractContextManager class Factory for ewk context
42 * This is interface class for ewk context factory.
43 * It's uses tizenId, view module to initialize it approriatly context.
45 * Constructor should create new context only if ewkContext parameter is NULL.
46 * If ewkContext parameter is not NULL, context should not be destroyed in destructor.
47 * This means used context is managed by manager only if was created internally.
49 * NOTE: This interface in not visible outside core module and it should not be.
50 * Reason for this code is not modify RunnableWidgetObject behaviour for mocks.
52 class IContextManager {
55 const std::string& tizenAppId,
56 Ewk_Context* ewkContext,
57 ViewModule::IViewModulePtr viewModule) :
58 m_appId(tizenAppId), m_ewkContext(ewkContext), m_view(viewModule) {}
59 virtual ~IContextManager() {}
61 * @brief getEwkContext returns ewk context
64 virtual Ewk_Context* getEwkContext() const = 0;
66 * @brief handleLowMemory
68 * Handles low memory conditions
70 virtual void handleLowMemory() = 0;
73 Ewk_Context* m_ewkContext;
74 IViewModulePtr m_view;
77 ContextManagerPtr contextManagerFactoryMethod(const std::string& id, Ewk_Context* c, IViewModulePtr view);
79 ContextManagerFactoryMethod makeContextManagerFactoryMethod();
81 } // namespace ViewModule
83 #endif // ABSTRACT_CONTEXT_MANAGER_H