Prevent duplicated call of |Terminate|
[platform/framework/web/crosswalk-tizen.git] / runtime / browser / splash_screen.h
1 /*
2  * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
3  *
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
7  *
8  *        http://www.apache.org/licenses/LICENSE-2.0
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 #ifndef XWALK_RUNTIME_BROWSER_SPLASH_SCREEN_H_
18 #define XWALK_RUNTIME_BROWSER_SPLASH_SCREEN_H_
19
20 #include <map>
21 #include <memory>
22 #include <utility>
23 #include <string>
24 #include <vector>
25
26 #include <Elementary.h>
27
28 #include "runtime/browser/native_window.h"
29 #include "wgt_manifest_handlers/launch_screen_handler.h"
30
31 namespace runtime {
32
33 class SplashScreen {
34  public:
35   typedef std::pair<int, int> SplashScreenBound;
36   enum class HideReason { RENDERED, LOADFINISHED, CUSTOM };
37
38   SplashScreen(NativeWindow* window,
39                std::shared_ptr<const wgt::parse::LaunchScreenInfo> ss_info,
40                const std::string& app_path);
41   void HideSplashScreen(HideReason reason);
42
43  private:
44   std::pair<int, int> GetDimensions();
45   void SetBackground(const wgt::parse::LaunchScreenData& splash_data,
46                      Evas_Object* parent, const SplashScreenBound& bound,
47                      const std::string& app_path);
48
49   void SetImage(const wgt::parse::LaunchScreenData& splash_data,
50                 Evas_Object* parent, const SplashScreenBound& bound,
51                 const std::string& app_path);
52
53   std::shared_ptr<const wgt::parse::LaunchScreenInfo> ss_info_;
54   NativeWindow* window_;
55   Evas_Object* image_;
56   Evas_Object* background_;
57   Evas_Object* background_image_;
58   bool is_active_;
59 };
60 }  // namespace runtime
61 #endif  // XWALK_RUNTIME_BROWSER_SPLASH_SCREEN_H_