summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/browser/chrome_content_browser_client.cc1
-rw-r--r--chrome/chrome_renderer.gypi2
-rw-r--r--chrome/chrome_tests.gypi1
-rw-r--r--chrome/renderer/chrome_render_view_observer.cc33
-rw-r--r--chrome/renderer/chrome_render_view_observer.h4
-rw-r--r--chrome/renderer/webview_animating_overlay.cc112
-rw-r--r--chrome/renderer/webview_animating_overlay.h53
-rw-r--r--chrome/renderer/webview_animating_overlay_browsertest.cc32
-rw-r--r--content/public/renderer/render_view.h4
-rw-r--r--content/public/test/render_view_test.cc8
-rw-r--r--content/public/test/render_view_test.h5
-rw-r--r--content/renderer/render_view_impl.cc4
-rw-r--r--content/renderer/render_view_impl.h1
-rw-r--r--ui/base/animation/animation_unittest.cc12
-rw-r--r--ui/base/animation/linear_animation.cc12
-rw-r--r--ui/base/animation/linear_animation.h8
16 files changed, 11 insertions, 281 deletions
diff --git a/chrome/browser/chrome_content_browser_client.cc b/chrome/browser/chrome_content_browser_client.cc
index a0a31c4..b00811f 100644
--- a/chrome/browser/chrome_content_browser_client.cc
+++ b/chrome/browser/chrome_content_browser_client.cc
@@ -850,7 +850,6 @@ void ChromeContentBrowserClient::AppendExtraCommandLineSwitches(
switches::kEnableBundledPpapiFlash,
switches::kEnableCrxlessWebApps,
switches::kEnableExperimentalExtensionApis,
- switches::kEnableFramelessConstrainedDialogs,
switches::kEnableHighDPIPDFPlugin,
switches::kEnableIPCFuzzing,
switches::kEnableNaCl,
diff --git a/chrome/chrome_renderer.gypi b/chrome/chrome_renderer.gypi
index 9d54cc6..95e61dc 100644
--- a/chrome/chrome_renderer.gypi
+++ b/chrome/chrome_renderer.gypi
@@ -270,8 +270,6 @@
'renderer/translate_helper.h',
'renderer/visitedlink_slave.cc',
'renderer/visitedlink_slave.h',
- 'renderer/webview_animating_overlay.cc',
- 'renderer/webview_animating_overlay.h',
'renderer/webview_color_overlay.cc',
'renderer/webview_color_overlay.h',
],
diff --git a/chrome/chrome_tests.gypi b/chrome/chrome_tests.gypi
index 9b3eb81..41adc11 100644
--- a/chrome/chrome_tests.gypi
+++ b/chrome/chrome_tests.gypi
@@ -3025,7 +3025,6 @@
'renderer/safe_browsing/phishing_dom_feature_extractor_browsertest.cc',
'renderer/safe_browsing/phishing_thumbnailer_browsertest.cc',
'renderer/translate_helper_browsertest.cc',
- 'renderer/webview_animating_overlay_browsertest.cc',
'test/base/empty_browser_test.cc',
'test/base/in_process_browser_test_browsertest.cc',
'test/base/chrome_render_view_test.cc',
diff --git a/chrome/renderer/chrome_render_view_observer.cc b/chrome/renderer/chrome_render_view_observer.cc
index 8277af9..f94d42a 100644
--- a/chrome/renderer/chrome_render_view_observer.cc
+++ b/chrome/renderer/chrome_render_view_observer.cc
@@ -27,7 +27,6 @@
#include "chrome/renderer/prerender/prerender_helper.h"
#include "chrome/renderer/safe_browsing/phishing_classifier_delegate.h"
#include "chrome/renderer/translate_helper.h"
-#include "chrome/renderer/webview_animating_overlay.h"
#include "chrome/renderer/webview_color_overlay.h"
#include "content/public/common/bindings_policy.h"
#include "content/public/renderer/render_view.h"
@@ -382,29 +381,17 @@ void ChromeRenderViewObserver::OnSetClientSidePhishingDetection(
}
void ChromeRenderViewObserver::OnSetVisuallyDeemphasized(bool deemphasized) {
- if (CommandLine::ForCurrentProcess()->HasSwitch(
- switches::kEnableFramelessConstrainedDialogs)) {
- if (!dimmed_animating_overlay_.get()) {
- dimmed_animating_overlay_.reset(
- new WebViewAnimatingOverlay(render_view()));
- }
- if (deemphasized)
- dimmed_animating_overlay_->Show();
- else
- dimmed_animating_overlay_->Hide();
+ bool already_deemphasized = !!dimmed_color_overlay_.get();
+ if (already_deemphasized == deemphasized)
+ return;
+
+ if (deemphasized) {
+ // 70% opaque grey.
+ SkColor greyish = SkColorSetARGB(178, 0, 0, 0);
+ dimmed_color_overlay_.reset(
+ new WebViewColorOverlay(render_view(), greyish));
} else {
- bool already_deemphasized = !!dimmed_color_overlay_.get();
- if (already_deemphasized == deemphasized)
- return;
-
- if (deemphasized) {
- // 70% opaque grey.
- SkColor greyish = SkColorSetARGB(178, 0, 0, 0);
- dimmed_color_overlay_.reset(
- new WebViewColorOverlay(render_view(), greyish));
- } else {
- dimmed_color_overlay_.reset();
- }
+ dimmed_color_overlay_.reset();
}
}
diff --git a/chrome/renderer/chrome_render_view_observer.h b/chrome/renderer/chrome_render_view_observer.h
index 46c1586..483d223 100644
--- a/chrome/renderer/chrome_render_view_observer.h
+++ b/chrome/renderer/chrome_render_view_observer.h
@@ -24,7 +24,6 @@ class SkBitmap;
class TranslateHelper;
struct ThumbnailScore;
class WebViewColorOverlay;
-class WebViewAnimatingOverlay;
namespace extensions {
class Dispatcher;
@@ -234,9 +233,6 @@ class ChromeRenderViewObserver : public content::RenderViewObserver,
// A color page overlay when visually de-emaphasized.
scoped_ptr<WebViewColorOverlay> dimmed_color_overlay_;
- // A animating page overlay when visually de-emaphasized.
- scoped_ptr<WebViewAnimatingOverlay> dimmed_animating_overlay_;
-
// Used to delay calling CapturePageInfo.
base::Timer capture_timer_;
diff --git a/chrome/renderer/webview_animating_overlay.cc b/chrome/renderer/webview_animating_overlay.cc
deleted file mode 100644
index 0f7d054..0000000
--- a/chrome/renderer/webview_animating_overlay.cc
+++ /dev/null
@@ -1,112 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "chrome/renderer/webview_animating_overlay.h"
-
-#include "base/logging.h"
-#include "content/public/renderer/render_view.h"
-#include "third_party/skia/include/core/SkCanvas.h"
-#include "third_party/skia/include/core/SkPaint.h"
-#include "third_party/skia/include/core/SkRect.h"
-#include "third_party/skia/include/effects/SkGradientShader.h"
-#include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h"
-#include "ui/gfx/size.h"
-#include "ui/gfx/skia_util.h"
-
-const int kAnimationDurationMiliseconds = 500;
-const int kAnimationFrameRate = 60;
-const int kTargetAlpha = 191;
-
-WebViewAnimatingOverlay::WebViewAnimatingOverlay(
- content::RenderView* render_view)
- : render_view_(render_view),
- state_(HIDDEN),
- animation_(kAnimationDurationMiliseconds, kAnimationFrameRate, this) {
-}
-
-WebViewAnimatingOverlay::~WebViewAnimatingOverlay() {
- if (render_view_->GetWebView())
- render_view_->GetWebView()->removePageOverlay(this);
-}
-
-void WebViewAnimatingOverlay::Show() {
- if (state_ == ANIMATING_IN || state_ == VISIBLE)
- return;
-
- if (state_ == ANIMATING_OUT) {
- animation_.SetCurrentValue(1.0 - animation_.GetCurrentValue());
- } else {
- DCHECK_EQ(HIDDEN, state_);
- if (render_view_->GetWebView())
- render_view_->GetWebView()->addPageOverlay(this, 0);
- }
-
- state_ = ANIMATING_IN;
- animation_.Start();
-}
-
-void WebViewAnimatingOverlay::Hide() {
- if (state_ == ANIMATING_OUT || state_ == HIDDEN)
- return;
-
- if (state_ == ANIMATING_IN)
- animation_.SetCurrentValue(1.0 - animation_.GetCurrentValue());
-
- state_ = ANIMATING_OUT;
- animation_.Start();
-}
-
-void WebViewAnimatingOverlay::paintPageOverlay(WebKit::WebCanvas* canvas) {
- SkRect rect = gfx::RectToSkRect(gfx::Rect(render_view_->GetSize()));
-
- // The center of the radial gradient should be near the top middle.
- SkPoint center_point;
- center_point.iset(rect.width() * 0.5, rect.height() * 0.05);
-
- // Animate in or out using the alpha.
- int alpha = GetCurrentAlpha();
- SkColor colors[] = {
- SkColorSetARGB(alpha, 255, 255, 255),
- SkColorSetARGB(alpha, 127, 127, 127)
- };
-
- SkAutoTUnref<SkShader> shader(SkGradientShader::CreateRadial(center_point,
- SkIntToScalar(rect.width()), colors, NULL, arraysize(colors),
- SkShader::kClamp_TileMode));
- SkPaint paint;
- paint.setShader(shader);
- paint.setDither(true);
-
- canvas->drawRect(rect, paint);
-}
-
-void WebViewAnimatingOverlay::AnimationEnded(const ui::Animation* animation) {
- if (state_ == ANIMATING_IN) {
- state_ = VISIBLE;
- } else {
- DCHECK_EQ(ANIMATING_OUT, state_);
- state_ = HIDDEN;
- if (render_view_->GetWebView())
- render_view_->GetWebView()->removePageOverlay(this);
- }
-}
-
-void WebViewAnimatingOverlay::AnimationProgressed(
- const ui::Animation* animation) {
- render_view_->Repaint(render_view_->GetSize());
-}
-
-int WebViewAnimatingOverlay::GetCurrentAlpha() {
- switch (state_) {
- case ANIMATING_IN:
- return animation_.CurrentValueBetween(0, kTargetAlpha);
- case ANIMATING_OUT:
- return animation_.CurrentValueBetween(kTargetAlpha, 0);
- case VISIBLE:
- case HIDDEN:
- return kTargetAlpha;
- }
- NOTREACHED();
- return 1.0;
-}
diff --git a/chrome/renderer/webview_animating_overlay.h b/chrome/renderer/webview_animating_overlay.h
deleted file mode 100644
index b105564..0000000
--- a/chrome/renderer/webview_animating_overlay.h
+++ /dev/null
@@ -1,53 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// 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/compiler_specific.h"
-#include "third_party/WebKit/Source/WebKit/chromium/public/WebPageOverlay.h"
-#include "ui/base/animation/animation_delegate.h"
-#include "ui/base/animation/linear_animation.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 ui::AnimationDelegate {
- 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;
-
- // ui::AnimationDelegate implementation:
- virtual void AnimationEnded(const ui::Animation* animation) OVERRIDE;
- virtual void AnimationProgressed(const ui::Animation* animation) OVERRIDE;
-
- private:
- int GetCurrentAlpha();
-
- content::RenderView* render_view_;
- State state_;
- ui::LinearAnimation animation_;
-
- DISALLOW_COPY_AND_ASSIGN(WebViewAnimatingOverlay);
-};
-
-#endif // CHROME_RENDERER_WEBVIEW_ANIMATING_OVERLAY_H_
diff --git a/chrome/renderer/webview_animating_overlay_browsertest.cc b/chrome/renderer/webview_animating_overlay_browsertest.cc
deleted file mode 100644
index 19ebb44..0000000
--- a/chrome/renderer/webview_animating_overlay_browsertest.cc
+++ /dev/null
@@ -1,32 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "chrome/renderer/webview_animating_overlay.h"
-
-#include "chrome/test/base/chrome_render_view_test.h"
-#include "skia/ext/platform_canvas.h"
-#include "webkit/glue/webkit_glue.h"
-
-typedef ChromeRenderViewTest WebViewAnimatingOverlayTest;
-
-TEST_F(WebViewAnimatingOverlayTest, ShowHide) {
- WebViewAnimatingOverlay overlay(view_);
- EXPECT_EQ(overlay.state(), WebViewAnimatingOverlay::HIDDEN);
- overlay.Show();
- EXPECT_EQ(overlay.state(), WebViewAnimatingOverlay::ANIMATING_IN);
- overlay.Hide();
- EXPECT_EQ(overlay.state(), WebViewAnimatingOverlay::ANIMATING_OUT);
-}
-
-TEST_F(WebViewAnimatingOverlayTest, Paint) {
- gfx::Size view_size(100, 100);
- Resize(view_size, gfx::Rect(), false);
-
- WebViewAnimatingOverlay overlay(view_);
- overlay.Show();
-
- skia::PlatformCanvas canvas;
- ASSERT_TRUE(canvas.initialize(view_size.width(), view_size.height(), true));
- overlay.paintPageOverlay(webkit_glue::ToWebCanvas(&canvas));
-}
diff --git a/content/public/renderer/render_view.h b/content/public/renderer/render_view.h
index 164acee..a57ba9a 100644
--- a/content/public/renderer/render_view.h
+++ b/content/public/renderer/render_view.h
@@ -127,10 +127,6 @@ class CONTENT_EXPORT RenderView : public IPC::Sender {
const WebKit::WebURLRequest& request,
WebKit::WebNavigationPolicy policy) = 0;
- // Notifies the renderer that a paint is to be generated for the size
- // passed in.
- virtual void Repaint(const gfx::Size& size) = 0;
-
protected:
virtual ~RenderView() {}
};
diff --git a/content/public/test/render_view_test.cc b/content/public/test/render_view_test.cc
index 16ae1a6..b76d637 100644
--- a/content/public/test/render_view_test.cc
+++ b/content/public/test/render_view_test.cc
@@ -309,14 +309,6 @@ uint32 RenderViewTest::GetNavigationIPCType() {
return ViewHostMsg_FrameNavigate::ID;
}
-void RenderViewTest::Resize(gfx::Size new_size,
- gfx::Rect resizer_rect,
- bool is_fullscreen) {
- scoped_ptr<IPC::Message> resize_message(new ViewMsg_Resize(
- 0, new_size, resizer_rect, is_fullscreen));
- OnMessageReceived(*resize_message);
-}
-
bool RenderViewTest::OnMessageReceived(const IPC::Message& msg) {
RenderViewImpl* impl = static_cast<RenderViewImpl*>(view_);
return impl->OnMessageReceived(msg);
diff --git a/content/public/test/render_view_test.h b/content/public/test/render_view_test.h
index 3b2539e..95e1b34 100644
--- a/content/public/test/render_view_test.h
+++ b/content/public/test/render_view_test.h
@@ -110,11 +110,6 @@ class RenderViewTest : public testing::Test {
// Returns the IPC message ID of the navigation message.
uint32 GetNavigationIPCType();
- // Resize the view.
- void Resize(gfx::Size new_size,
- gfx::Rect resizer_rect,
- bool is_fullscreen);
-
// These are all methods from RenderViewImpl that we expose to testing code.
bool OnMessageReceived(const IPC::Message& msg);
void DidNavigateWithinPage(WebKit::WebFrame* frame, bool is_new_navigation);
diff --git a/content/renderer/render_view_impl.cc b/content/renderer/render_view_impl.cc
index 3133b35..b2e0d61 100644
--- a/content/renderer/render_view_impl.cc
+++ b/content/renderer/render_view_impl.cc
@@ -2474,10 +2474,6 @@ void RenderViewImpl::loadURLExternally(
loadURLExternally(frame, request, policy, WebString());
}
-void RenderViewImpl::Repaint(const gfx::Size& size) {
- OnMsgRepaint(size);
-}
-
void RenderViewImpl::loadURLExternally(
WebFrame* frame, const WebURLRequest& request,
WebNavigationPolicy policy,
diff --git a/content/renderer/render_view_impl.h b/content/renderer/render_view_impl.h
index 04490b9..5ed9ef6 100644
--- a/content/renderer/render_view_impl.h
+++ b/content/renderer/render_view_impl.h
@@ -711,7 +711,6 @@ class RenderViewImpl : public RenderWidget,
WebKit::WebFrame* frame,
const WebKit::WebURLRequest& request,
WebKit::WebNavigationPolicy policy) OVERRIDE;
- virtual void Repaint(const gfx::Size& size) OVERRIDE;
// webkit_glue::WebPluginPageDelegate implementation -------------------------
diff --git a/ui/base/animation/animation_unittest.cc b/ui/base/animation/animation_unittest.cc
index 3961aae..7d87600 100644
--- a/ui/base/animation/animation_unittest.cc
+++ b/ui/base/animation/animation_unittest.cc
@@ -143,16 +143,4 @@ TEST_F(AnimationTest, ShouldRenderRichAnimation) {
#endif
}
-// Test that current value is always 0 after Start() is called.
-TEST_F(AnimationTest, StartState) {
- LinearAnimation animation(100, 60, NULL);
- EXPECT_EQ(0.0, animation.GetCurrentValue());
- animation.Start();
- EXPECT_EQ(0.0, animation.GetCurrentValue());
- animation.End();
- EXPECT_EQ(1.0, animation.GetCurrentValue());
- animation.Start();
- EXPECT_EQ(0.0, animation.GetCurrentValue());
-}
-
} // namespace ui
diff --git a/ui/base/animation/linear_animation.cc b/ui/base/animation/linear_animation.cc
index 33bd1d1..60054d9 100644
--- a/ui/base/animation/linear_animation.cc
+++ b/ui/base/animation/linear_animation.cc
@@ -45,14 +45,6 @@ double LinearAnimation::GetCurrentValue() const {
return state_;
}
-void LinearAnimation::SetCurrentValue(double new_value) {
- new_value = std::max(0.0, std::min(1.0, new_value));
- base::TimeDelta time_delta = base::TimeDelta::FromMicroseconds(
- duration_.InMicroseconds() * (new_value - state_));
- SetStartTime(start_time() - time_delta);
- state_ = new_value;
-}
-
void LinearAnimation::End() {
if (!is_animating())
return;
@@ -87,10 +79,6 @@ void LinearAnimation::Step(base::TimeTicks time_now) {
Stop();
}
-void LinearAnimation::AnimationStarted() {
- state_ = 0.0;
-}
-
void LinearAnimation::AnimationStopped() {
if (!in_end_)
return;
diff --git a/ui/base/animation/linear_animation.h b/ui/base/animation/linear_animation.h
index 33f9785..9f385d6 100644
--- a/ui/base/animation/linear_animation.h
+++ b/ui/base/animation/linear_animation.h
@@ -32,9 +32,6 @@ class UI_EXPORT LinearAnimation : public Animation {
// can override this to provide others.
virtual double GetCurrentValue() const OVERRIDE;
- // Change the current state of the animation to |new_value|.
- void SetCurrentValue(double new_value);
-
// Skip to the end of the current animation.
void End();
@@ -45,16 +42,13 @@ class UI_EXPORT LinearAnimation : public Animation {
protected:
// Called when the animation progresses. Subclasses override this to
// efficiently update their state.
- virtual void AnimateToState(double state) {}
+ virtual void AnimateToState(double state) = 0;
// Invoked by the AnimationContainer when the animation is running to advance
// the animation. Use |time_now| rather than Time::Now to avoid multiple
// animations running at the same time diverging.
virtual void Step(base::TimeTicks time_now) OVERRIDE;
- // Overriden to initialize state.
- virtual void AnimationStarted() OVERRIDE;
-
// Overriden to advance to the end (if End was invoked).
virtual void AnimationStopped() OVERRIDE;