Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | |
|
Nico
2012/08/14 21:14:12
I know, it's crazy how time flies when you're havi
sail
2012/08/15 05:26:20
Done.
| |
| 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 CHROME_RENDERER_WEBVIEW_ANIMATING_OVERLAY_H_ | |
| 6 #define CHROME_RENDERER_WEBVIEW_ANIMATING_OVERLAY_H_ | |
| 7 | |
| 8 #include "base/basictypes.h" | |
|
Nico
2012/08/14 21:14:12
not needed
sail
2012/08/15 05:26:20
Done.
| |
| 9 #include "base/compiler_specific.h" | |
| 10 #include "base/memory/scoped_ptr.h" | |
|
Nico
2012/08/14 21:14:12
not needed
sail
2012/08/15 05:26:20
Done.
| |
| 11 #include "base/time.h" | |
| 12 #include "base/timer.h" | |
| 13 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPageOverlay.h" | |
| 14 | |
| 15 namespace content { | |
| 16 class RenderView; | |
| 17 } | |
| 18 | |
| 19 // This class draws a gradient on a PageOverlay of a WebView. The gradient | |
| 20 // fades in when shown and fades out when hidden. | |
| 21 class WebViewAnimatingOverlay : public WebKit::WebPageOverlay { | |
| 22 public: | |
| 23 enum State { | |
| 24 ANIMATING_IN, | |
| 25 VISIBLE, | |
| 26 ANIMATING_OUT, | |
| 27 HIDDEN | |
| 28 }; | |
| 29 | |
| 30 explicit WebViewAnimatingOverlay(content::RenderView* render_view); | |
| 31 virtual ~WebViewAnimatingOverlay(); | |
| 32 void Show(); | |
| 33 void Hide(); | |
| 34 | |
| 35 State state() { return state_; } | |
| 36 | |
| 37 // WebKit::WebPageOverlay implementation: | |
| 38 virtual void paintPageOverlay(WebKit::WebCanvas* canvas) OVERRIDE; | |
| 39 | |
| 40 private: | |
| 41 void OnTimer(); | |
| 42 base::TimeDelta GetAnimationTimeRemaining() const; | |
| 43 float GetAnimationProgress() const; | |
| 44 | |
| 45 content::RenderView* render_view_; | |
| 46 State state_; | |
| 47 base::RepeatingTimer<WebViewAnimatingOverlay> timer_; | |
| 48 base::Time start_time_; | |
| 49 | |
| 50 DISALLOW_COPY_AND_ASSIGN(WebViewAnimatingOverlay); | |
| 51 }; | |
| 52 | |
| 53 #endif // CHROME_RENDERER_WEBVIEW_ANIMATING_OVERLAY_H_ | |
| OLD | NEW |