Chromium Code Reviews| Index: chrome/renderer/webview_animating_overlay.h |
| diff --git a/chrome/renderer/webview_animating_overlay.h b/chrome/renderer/webview_animating_overlay.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..f7d5eaaabe3bfcabb246ce5fbede39c41d8535b9 |
| --- /dev/null |
| +++ b/chrome/renderer/webview_animating_overlay.h |
| @@ -0,0 +1,53 @@ |
| +// 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.
|
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef CHROME_RENDERER_WEBVIEW_ANIMATING_OVERLAY_H_ |
| +#define CHROME_RENDERER_WEBVIEW_ANIMATING_OVERLAY_H_ |
| + |
| +#include "base/basictypes.h" |
|
Nico
2012/08/14 21:14:12
not needed
sail
2012/08/15 05:26:20
Done.
|
| +#include "base/compiler_specific.h" |
| +#include "base/memory/scoped_ptr.h" |
|
Nico
2012/08/14 21:14:12
not needed
sail
2012/08/15 05:26:20
Done.
|
| +#include "base/time.h" |
| +#include "base/timer.h" |
| +#include "third_party/WebKit/Source/WebKit/chromium/public/WebPageOverlay.h" |
| + |
| +namespace content { |
| +class RenderView; |
| +} |
| + |
| +// This class draws a gradient on a PageOverlay of a WebView. The gradient |
| +// fades in when shown and fades out when hidden. |
| +class WebViewAnimatingOverlay : public WebKit::WebPageOverlay { |
| + public: |
| + enum State { |
| + ANIMATING_IN, |
| + VISIBLE, |
| + ANIMATING_OUT, |
| + HIDDEN |
| + }; |
| + |
| + explicit WebViewAnimatingOverlay(content::RenderView* render_view); |
| + virtual ~WebViewAnimatingOverlay(); |
| + void Show(); |
| + void Hide(); |
| + |
| + State state() { return state_; } |
| + |
| + // WebKit::WebPageOverlay implementation: |
| + virtual void paintPageOverlay(WebKit::WebCanvas* canvas) OVERRIDE; |
| + |
| + private: |
| + void OnTimer(); |
| + base::TimeDelta GetAnimationTimeRemaining() const; |
| + float GetAnimationProgress() const; |
| + |
| + content::RenderView* render_view_; |
| + State state_; |
| + base::RepeatingTimer<WebViewAnimatingOverlay> timer_; |
| + base::Time start_time_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(WebViewAnimatingOverlay); |
| +}; |
| + |
| +#endif // CHROME_RENDERER_WEBVIEW_ANIMATING_OVERLAY_H_ |