When list is used in popup, sound playing.
[platform/framework/web/web-provider.git] / src / Core / BoxSchemeHandler.h
1 /*
2  * Copyright (c) 2013 Samsung Electronics Co., Ltd All Rights Reserved
3  *
4  *    Licensed under the Flora License, Version 1.1 (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
7  *
8  *        http://floralicense.org/license/
9  *
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.
15  */
16 /**
17  * @file    BoxSchemeHandler.h
18  * @author  Yunchan Cho (yunchan.cho@samsung.com)
19  */
20 #ifndef BOX_SCHEME_HANDLER_H
21 #define BOX_SCHEME_HANDLER_H
22
23 #include <string>
24 #include <map>
25 #include "Service/PeriodChanger.h"
26 #include "Service/MessageManager.h"
27
28 using namespace Service;
29
30 class Box;
31
32 #define EXPORT_CLASS __attribute__ ((visibility("default"))
33
34 class EXPORT_CLASS BoxSchemeHandler {
35     public:
36         static BoxSchemeHandler* Instance();
37         void registerBox(std::string& instanceId, Box* box);
38         void unregisterBox(std::string& instanceId);
39         bool process(std::string& instanceId, std::string& uri);
40         bool isBoxScheme(std::string& uri);
41
42     private:
43         Box* getBox(std::string& instanceId);
44         bool handleReload(std::string& instanceId);
45         bool handleChangePeriod(std::string& instanceId, float requestedPeriod = -1.0f);
46         bool handleLaunchBrowser(std::string& instanceId, std::string& url);
47         bool handleScroll(std::string& instanceId, bool start);
48         bool handleSendMessage(
49                 std::string& instanceId, 
50                 MessageManager::ReceiverType receiver, 
51                 std::string& message);
52         std::string parse(std::string& uri, std::string& key);
53
54         BoxSchemeHandler();
55         ~BoxSchemeHandler();
56
57         // members
58         typedef std::map<std::string, Box*> BoxMap;
59         typedef std::pair<std::string, Box*> BoxMapPair;
60         BoxMap m_boxMap;
61         // members for service
62         std::shared_ptr<PeriodChanger> m_periodChanger;
63         std::shared_ptr<MessageManager> m_messageManager;
64         static BoxSchemeHandler* s_instance;
65 };
66
67 #endif // BOX_SCHEME_HANDLER_H
68