Upstream version 8.36.169.0
[platform/framework/web/crosswalk.git] / src / xwalk / runtime / browser / ui / splash_screen.h
1 // Copyright (c) 2014 Intel Corporation. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef XWALK_RUNTIME_BROWSER_UI_SPLASH_SCREEN_H_
6 #define XWALK_RUNTIME_BROWSER_UI_SPLASH_SCREEN_H_
7
8 #include "base/files/file_path.h"
9 #include "content/public/browser/web_contents_observer.h"
10 #include "ui/compositor/layer_animation_observer.h"
11
12 namespace content {
13 class WebContents;
14 class RenderViewHost;
15 }
16
17 namespace ui {
18 class Layer;
19 }
20
21 namespace views {
22 class Widget;
23 }
24
25 namespace xwalk {
26
27 class SplashScreen : public content::WebContentsObserver,
28                      public ui::ImplicitAnimationObserver {
29  public:
30   SplashScreen(views::Widget* host,
31                const base::FilePath& file,
32                content::WebContents* web_contents);
33   ~SplashScreen();
34
35   void Start();
36   void Stop();
37
38   // Overridden from content::WebContentsObserver.
39   virtual void DidFinishLoad(int64 frame_id,
40                              const GURL& validated_url,
41                              bool is_main_frame,
42                              content::RenderViewHost* render_view_host)
43                              OVERRIDE;
44
45   virtual void DidFailLoad(int64 frame_id,
46                            const GURL& validated_url,
47                            bool is_main_frame,
48                            int error_code,
49                            const base::string16& error_description,
50                            content::RenderViewHost* render_view_host) OVERRIDE;
51
52   // ui::ImplicitAnimationObserver overrides:
53   virtual void OnImplicitAnimationsCompleted() OVERRIDE;
54
55  private:
56   views::Widget* widget_host_;
57   base::FilePath splash_screen_image_;
58
59   scoped_ptr<ui::Layer> layer_;
60   class SplashScreenLayerDelegate;
61   scoped_ptr<SplashScreenLayerDelegate> layer_delegate_;
62
63   bool is_started;
64
65   DISALLOW_COPY_AND_ASSIGN(SplashScreen);
66 };
67
68 }  // namespace xwalk
69
70 #endif  // XWALK_RUNTIME_BROWSER_UI_SPLASH_SCREEN_H_