Commit 1138ccee authored by xiyuan@chromium.org's avatar xiyuan@chromium.org

Implement SetVisuallyDeemphasized in ChromeRenderViewObserver.

Implement SetVisuallyDeemphasized in ChromeRenderViewObserver
- Add a ChromeViewMsg_SetVisuallyDeemphasized and use it to toggle background dimming on web contents via ChromeRenderViewObserver;
- Derive WebViewColorOverlay from WebKit::WebPageOverlay and add to web view when need to dimming the background;
- Remove RWHV SetVisuallyDeemphasized since it's no longer used;

BUG=103386
TEST=Verify fix for 103386, dimming should show up even when accelerated compositing is on.


Review URL: http://codereview.chromium.org/8730001

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@112787 0039d316-1c4b-4281-b951-d872f2087c98
parent 70f48c0a
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
#include "chrome/browser/ui/constrained_window_tab_helper_delegate.h" #include "chrome/browser/ui/constrained_window_tab_helper_delegate.h"
#include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
#include "chrome/browser/ui/tab_contents/tab_contents_wrapper_delegate.h" #include "chrome/browser/ui/tab_contents/tab_contents_wrapper_delegate.h"
#include "chrome/common/render_messages.h"
#include "content/browser/renderer_host/render_view_host.h" #include "content/browser/renderer_host/render_view_host.h"
#include "content/browser/renderer_host/render_widget_host_view.h" #include "content/browser/renderer_host/render_widget_host_view.h"
#include "content/browser/tab_contents/navigation_details.h" #include "content/browser/tab_contents/navigation_details.h"
...@@ -73,14 +74,13 @@ void ConstrainedWindowTabHelper::BlockTabContent(bool blocked) { ...@@ -73,14 +74,13 @@ void ConstrainedWindowTabHelper::BlockTabContent(bool blocked) {
return; return;
} }
RenderWidgetHostView* rwhv = contents->GetRenderWidgetHostView();
// 70% opaque grey.
SkColor greyish = SkColorSetARGB(178, 0, 0, 0);
if (rwhv)
rwhv->SetVisuallyDeemphasized(blocked ? &greyish : NULL, false);
// RenderViewHost may be NULL during shutdown. // RenderViewHost may be NULL during shutdown.
if (contents->render_view_host()) RenderViewHost* host = contents->render_view_host();
contents->render_view_host()->set_ignore_input_events(blocked); if (host) {
host->set_ignore_input_events(blocked);
host->Send(
new ChromeViewMsg_SetVisuallyDeemphasized(host->routing_id(), blocked));
}
if (delegate_) if (delegate_)
delegate_->SetTabContentBlocked(wrapper_, blocked); delegate_->SetTabContentBlocked(wrapper_, blocked);
} }
......
...@@ -194,6 +194,8 @@ ...@@ -194,6 +194,8 @@
'renderer/visitedlink_slave.h', 'renderer/visitedlink_slave.h',
'renderer/weak_v8_function_map.cc', 'renderer/weak_v8_function_map.cc',
'renderer/weak_v8_function_map.h', 'renderer/weak_v8_function_map.h',
'renderer/webview_color_overlay.cc',
'renderer/webview_color_overlay.h',
], ],
'conditions': [ 'conditions': [
['disable_nacl!=1', { ['disable_nacl!=1', {
......
...@@ -285,6 +285,11 @@ IPC_MESSAGE_ROUTED4(ChromeViewMsg_DetermineIfPageSupportsInstant, ...@@ -285,6 +285,11 @@ IPC_MESSAGE_ROUTED4(ChromeViewMsg_DetermineIfPageSupportsInstant,
int /* selection_start */, int /* selection_start */,
int /* selection_end */) int /* selection_end */)
// Toggles visual muting of the render view area. This is on when a constrained
// window is showing.
IPC_MESSAGE_ROUTED1(ChromeViewMsg_SetVisuallyDeemphasized,
bool /* deemphazied */)
// Tells the renderer to translate the page contents from one language to // Tells the renderer to translate the page contents from one language to
// another. // another.
IPC_MESSAGE_ROUTED4(ChromeViewMsg_TranslatePage, IPC_MESSAGE_ROUTED4(ChromeViewMsg_TranslatePage,
......
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
#include "chrome/renderer/prerender/prerender_helper.h" #include "chrome/renderer/prerender/prerender_helper.h"
#include "chrome/renderer/safe_browsing/phishing_classifier_delegate.h" #include "chrome/renderer/safe_browsing/phishing_classifier_delegate.h"
#include "chrome/renderer/translate_helper.h" #include "chrome/renderer/translate_helper.h"
#include "chrome/renderer/webview_color_overlay.h"
#include "content/public/common/bindings_policy.h" #include "content/public/common/bindings_policy.h"
#include "content/public/renderer/render_view.h" #include "content/public/renderer/render_view.h"
#include "content/public/renderer/content_renderer_client.h" #include "content/public/renderer/content_renderer_client.h"
...@@ -47,6 +48,7 @@ ...@@ -47,6 +48,7 @@
#include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h"
#include "ui/gfx/color_utils.h" #include "ui/gfx/color_utils.h"
#include "ui/gfx/favicon_size.h" #include "ui/gfx/favicon_size.h"
#include "ui/gfx/size.h"
#include "ui/gfx/skbitmap_operations.h" #include "ui/gfx/skbitmap_operations.h"
#include "webkit/glue/image_decoder.h" #include "webkit/glue/image_decoder.h"
#include "webkit/glue/image_resource_fetcher.h" #include "webkit/glue/image_resource_fetcher.h"
...@@ -259,6 +261,8 @@ bool ChromeRenderViewObserver::OnMessageReceived(const IPC::Message& message) { ...@@ -259,6 +261,8 @@ bool ChromeRenderViewObserver::OnMessageReceived(const IPC::Message& message) {
OnSetAllowRunningInsecureContent) OnSetAllowRunningInsecureContent)
IPC_MESSAGE_HANDLER(ChromeViewMsg_SetClientSidePhishingDetection, IPC_MESSAGE_HANDLER(ChromeViewMsg_SetClientSidePhishingDetection,
OnSetClientSidePhishingDetection) OnSetClientSidePhishingDetection)
IPC_MESSAGE_HANDLER(ChromeViewMsg_SetVisuallyDeemphasized,
OnSetVisuallyDeemphasized)
#if defined(OS_CHROMEOS) #if defined(OS_CHROMEOS)
IPC_MESSAGE_HANDLER(ChromeViewMsg_StartFrameSniffer, OnStartFrameSniffer) IPC_MESSAGE_HANDLER(ChromeViewMsg_StartFrameSniffer, OnStartFrameSniffer)
#endif #endif
...@@ -380,6 +384,21 @@ void ChromeRenderViewObserver::OnSetClientSidePhishingDetection( ...@@ -380,6 +384,21 @@ void ChromeRenderViewObserver::OnSetClientSidePhishingDetection(
#endif #endif
} }
void ChromeRenderViewObserver::OnSetVisuallyDeemphasized(bool deemphasized) {
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();
}
}
void ChromeRenderViewObserver::OnStartFrameSniffer(const string16& frame_name) { void ChromeRenderViewObserver::OnStartFrameSniffer(const string16& frame_name) {
new FrameSniffer(render_view(), frame_name); new FrameSniffer(render_view(), frame_name);
} }
......
...@@ -25,10 +25,12 @@ class ExternalHostBindings; ...@@ -25,10 +25,12 @@ class ExternalHostBindings;
class SkBitmap; class SkBitmap;
class TranslateHelper; class TranslateHelper;
struct ThumbnailScore; struct ThumbnailScore;
class WebViewColorOverlay;
namespace WebKit { namespace WebKit {
class WebView; class WebView;
} }
namespace safe_browsing { namespace safe_browsing {
class PhishingClassifierDelegate; class PhishingClassifierDelegate;
} }
...@@ -127,6 +129,7 @@ class ChromeRenderViewObserver : public content::RenderViewObserver, ...@@ -127,6 +129,7 @@ class ChromeRenderViewObserver : public content::RenderViewObserver,
void OnSetAllowDisplayingInsecureContent(bool allow); void OnSetAllowDisplayingInsecureContent(bool allow);
void OnSetAllowRunningInsecureContent(bool allow); void OnSetAllowRunningInsecureContent(bool allow);
void OnSetClientSidePhishingDetection(bool enable_phishing_detection); void OnSetClientSidePhishingDetection(bool enable_phishing_detection);
void OnSetVisuallyDeemphasized(bool deemphasized);
void OnStartFrameSniffer(const string16& frame_name); void OnStartFrameSniffer(const string16& frame_name);
void OnGetFPS(); void OnGetFPS();
void OnAddStrictSecurityHost(const std::string& host); void OnAddStrictSecurityHost(const std::string& host);
...@@ -220,6 +223,9 @@ class ChromeRenderViewObserver : public content::RenderViewObserver, ...@@ -220,6 +223,9 @@ class ChromeRenderViewObserver : public content::RenderViewObserver,
// ImageResourceFetchers schedule via DownloadImage. // ImageResourceFetchers schedule via DownloadImage.
ImageResourceFetcherList image_fetchers_; ImageResourceFetcherList image_fetchers_;
// A color page overlay when visually de-emaphasized.
scoped_ptr<WebViewColorOverlay> dimmed_color_overlay_;
DISALLOW_COPY_AND_ASSIGN(ChromeRenderViewObserver); DISALLOW_COPY_AND_ASSIGN(ChromeRenderViewObserver);
}; };
......
// Copyright (c) 2011 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_color_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/WebKit/Source/WebKit/chromium/public/WebView.h"
#include "ui/gfx/size.h"
#include "ui/gfx/skia_util.h"
#if WEBKIT_USING_CG
#include "skia/ext/skia_utils_mac.h"
#endif
WebViewColorOverlay::WebViewColorOverlay(content::RenderView* render_view,
SkColor color)
: render_view_(render_view),
color_(color) {
render_view_->GetWebView()->addPageOverlay(this, 0);
}
WebViewColorOverlay::~WebViewColorOverlay() {
render_view_->GetWebView()->removePageOverlay(this);
}
void WebViewColorOverlay::paintPageOverlay(WebKit::WebCanvas* canvas) {
SkRect rect = gfx::RectToSkRect(gfx::Rect(render_view_->GetSize()));
#if WEBKIT_USING_SKIA
SkPaint paint;
paint.setColor(color_);
paint.setStyle(SkPaint::kFill_Style);
canvas->drawRect(rect, paint);
#elif WEBKIT_USING_CG
CGContextSaveGState(canvas);
CGColorRef color = gfx::SkColorToCGColorRef(color_);
CGContextSetFillColorWithColor(canvas, color);
CGColorRelease(color);
CGContextFillRect(canvas, gfx::SkRectToCGRect(rect));
CGContextRestoreGState(canvas);
#else
NOTIMPLEMENTED();
#endif
}
// Copyright (c) 2011 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_COLOR_OVERLAY_H_
#define CHROME_RENDERER_WEBVIEW_COLOR_OVERLAY_H_
#pragma once
#include "base/basictypes.h"
#include "base/compiler_specific.h"
#include "third_party/skia/include/core/SkColor.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebPageOverlay.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebRect.h"
namespace content {
class RenderView;
}
// This class draws the given color on a PageOverlay of a WebView.
class WebViewColorOverlay : public WebKit::WebPageOverlay {
public:
WebViewColorOverlay(content::RenderView* render_view, SkColor color);
virtual ~WebViewColorOverlay();
private:
// WebKit::WebPageOverlay implementation:
virtual void paintPageOverlay(WebKit::WebCanvas* canvas);
content::RenderView* render_view_;
SkColor color_;
DISALLOW_COPY_AND_ASSIGN(WebViewColorOverlay);
};
#endif // CHROME_RENDERER_WEBVIEW_COLOR_OVERLAY_H_
...@@ -288,14 +288,6 @@ class RenderWidgetHostView { ...@@ -288,14 +288,6 @@ class RenderWidgetHostView {
virtual gfx::PluginWindowHandle GetCompositingSurface() = 0; virtual gfx::PluginWindowHandle GetCompositingSurface() = 0;
// Toggles visual muting of the render view area. This is on when a
// constrained window is showing, for example. |color| is the shade of
// the overlay that covers the render view. If |animate| is true, the overlay
// gradually fades in; otherwise it takes effect immediately. To remove the
// fade effect, pass a NULL value for |color|. In this case, |animate| is
// ignored.
virtual void SetVisuallyDeemphasized(const SkColor* color, bool animate) = 0;
virtual void UnhandledWheelEvent(const WebKit::WebMouseWheelEvent& event) = 0; virtual void UnhandledWheelEvent(const WebKit::WebMouseWheelEvent& event) = 0;
virtual void SetHasHorizontalScrollbar(bool has_horizontal_scrollbar) = 0; virtual void SetHasHorizontalScrollbar(bool has_horizontal_scrollbar) = 0;
......
...@@ -409,12 +409,6 @@ gfx::Rect RenderWidgetHostViewAura::GetRootWindowBounds() { ...@@ -409,12 +409,6 @@ gfx::Rect RenderWidgetHostViewAura::GetRootWindowBounds() {
return window_->GetScreenBounds(); return window_->GetScreenBounds();
} }
void RenderWidgetHostViewAura::SetVisuallyDeemphasized(const SkColor* color,
bool animate) {
// http://crbug.com/102568
NOTIMPLEMENTED();
}
void RenderWidgetHostViewAura::UnhandledWheelEvent( void RenderWidgetHostViewAura::UnhandledWheelEvent(
const WebKit::WebMouseWheelEvent& event) { const WebKit::WebMouseWheelEvent& event) {
// Not needed. Mac-only. // Not needed. Mac-only.
......
...@@ -93,8 +93,6 @@ class CONTENT_EXPORT RenderWidgetHostViewAura ...@@ -93,8 +93,6 @@ class CONTENT_EXPORT RenderWidgetHostViewAura
virtual void SetBackground(const SkBitmap& background) OVERRIDE; virtual void SetBackground(const SkBitmap& background) OVERRIDE;
virtual void GetScreenInfo(WebKit::WebScreenInfo* results) OVERRIDE; virtual void GetScreenInfo(WebKit::WebScreenInfo* results) OVERRIDE;
virtual gfx::Rect GetRootWindowBounds() OVERRIDE; virtual gfx::Rect GetRootWindowBounds() OVERRIDE;
virtual void SetVisuallyDeemphasized(const SkColor* color,
bool animate) OVERRIDE;
virtual void UnhandledWheelEvent( virtual void UnhandledWheelEvent(
const WebKit::WebMouseWheelEvent& event) OVERRIDE; const WebKit::WebMouseWheelEvent& event) OVERRIDE;
virtual void SetHasHorizontalScrollbar( virtual void SetHasHorizontalScrollbar(
......
...@@ -57,9 +57,6 @@ namespace { ...@@ -57,9 +57,6 @@ namespace {
const int kMaxWindowWidth = 4000; const int kMaxWindowWidth = 4000;
const int kMaxWindowHeight = 4000; const int kMaxWindowHeight = 4000;
// The duration of the fade-out animation. See |overlay_animation_|.
const int kFadeEffectDuration = 300;
#if defined(OS_CHROMEOS) #if defined(OS_CHROMEOS)
// TODO(davemoore) Under Chromeos we are increasing the rate that the trackpad // TODO(davemoore) Under Chromeos we are increasing the rate that the trackpad
// generates events to get better precisions. Eventually we will coordinate the // generates events to get better precisions. Eventually we will coordinate the
...@@ -567,8 +564,6 @@ RenderWidgetHostViewGtk::RenderWidgetHostViewGtk(RenderWidgetHost* widget_host) ...@@ -567,8 +564,6 @@ RenderWidgetHostViewGtk::RenderWidgetHostViewGtk(RenderWidgetHost* widget_host)
is_hidden_(false), is_hidden_(false),
is_loading_(false), is_loading_(false),
is_showing_context_menu_(false), is_showing_context_menu_(false),
overlay_color_(0),
overlay_animation_(this),
parent_(NULL), parent_(NULL),
is_popup_first_mouse_release_(true), is_popup_first_mouse_release_(true),
was_imcontext_focused_before_grab_(false), was_imcontext_focused_before_grab_(false),
...@@ -590,8 +585,6 @@ RenderWidgetHostViewGtk::~RenderWidgetHostViewGtk() { ...@@ -590,8 +585,6 @@ RenderWidgetHostViewGtk::~RenderWidgetHostViewGtk() {
void RenderWidgetHostViewGtk::InitAsChild() { void RenderWidgetHostViewGtk::InitAsChild() {
DoSharedInit(); DoSharedInit();
overlay_animation_.SetDuration(kFadeEffectDuration);
overlay_animation_.SetSlideDuration(kFadeEffectDuration);
gtk_widget_show(view_.get()); gtk_widget_show(view_.get());
} }
...@@ -1110,45 +1103,8 @@ void RenderWidgetHostViewGtk::Paint(const gfx::Rect& damage_rect) { ...@@ -1110,45 +1103,8 @@ void RenderWidgetHostViewGtk::Paint(const gfx::Rect& damage_rect) {
// period where this object isn't attached to a window but hasn't been // period where this object isn't attached to a window but hasn't been
// Destroy()ed yet and it receives paint messages... // Destroy()ed yet and it receives paint messages...
if (window) { if (window) {
if (SkColorGetA(overlay_color_) == 0) { backing_store->XShowRect(gfx::Point(0, 0),
// In the common case, use XCopyArea. We don't draw more than once, so paint_rect, ui::GetX11WindowFromGtkWidget(view_.get()));
// we don't need to double buffer.
backing_store->XShowRect(gfx::Point(0, 0),
paint_rect, ui::GetX11WindowFromGtkWidget(view_.get()));
} else {
// If the grey blend is showing, we make two drawing calls. Use double
// buffering to prevent flicker. Use CairoShowRect because XShowRect
// shortcuts GDK's double buffering. We won't be able to draw outside
// of |damage_rect|, so invalidate the difference between |paint_rect|
// and |damage_rect|.
if (paint_rect != damage_rect) {
GdkRectangle extra_gdk_rect =
paint_rect.Subtract(damage_rect).ToGdkRectangle();
gdk_window_invalidate_rect(window, &extra_gdk_rect, false);
}
GdkRectangle rect = { damage_rect.x(), damage_rect.y(),
damage_rect.width(), damage_rect.height() };
gdk_window_begin_paint_rect(window, &rect);
backing_store->CairoShowRect(damage_rect, GDK_DRAWABLE(window));
cairo_t* cr = gdk_cairo_create(window);
gdk_cairo_rectangle(cr, &rect);
SkColor overlay = SkColorSetA(
overlay_color_,
SkColorGetA(overlay_color_) *
overlay_animation_.GetCurrentValue());
float r = SkColorGetR(overlay) / 255.;
float g = SkColorGetG(overlay) / 255.;
float b = SkColorGetB(overlay) / 255.;
float a = SkColorGetA(overlay) / 255.;
cairo_set_source_rgba(cr, r, g, b, a);
cairo_fill(cr);
cairo_destroy(cr);
gdk_window_end_paint(window);
}
} }
if (!whiteout_start_time_.is_null()) { if (!whiteout_start_time_.is_null()) {
base::TimeDelta whiteout_duration = base::TimeTicks::Now() - base::TimeDelta whiteout_duration = base::TimeTicks::Now() -
...@@ -1206,24 +1162,6 @@ void RenderWidgetHostViewGtk::DestroyPluginContainer( ...@@ -1206,24 +1162,6 @@ void RenderWidgetHostViewGtk::DestroyPluginContainer(
plugin_container_manager_.DestroyPluginContainer(id); plugin_container_manager_.DestroyPluginContainer(id);
} }
void RenderWidgetHostViewGtk::SetVisuallyDeemphasized(
const SkColor* color, bool animate) {
// Do nothing unless |color| has changed, meaning |animate| is only
// respected for the first call.
if (color && (*color == overlay_color_))
return;
overlay_color_ = color ? *color : 0;
if (animate) {
overlay_animation_.Reset();
overlay_animation_.Show();
} else {
overlay_animation_.Reset(1.0);
gtk_widget_queue_draw(view_.get());
}
}
void RenderWidgetHostViewGtk::UnhandledWheelEvent( void RenderWidgetHostViewGtk::UnhandledWheelEvent(
const WebKit::WebMouseWheelEvent& event) { const WebKit::WebMouseWheelEvent& event) {
} }
...@@ -1363,20 +1301,6 @@ void RenderWidgetHostViewGtk::ForwardKeyboardEvent( ...@@ -1363,20 +1301,6 @@ void RenderWidgetHostViewGtk::ForwardKeyboardEvent(
host_->ForwardKeyboardEvent(event); host_->ForwardKeyboardEvent(event);
} }
void RenderWidgetHostViewGtk::AnimationEnded(const ui::Animation* animation) {
gtk_widget_queue_draw(view_.get());
}
void RenderWidgetHostViewGtk::AnimationProgressed(
const ui::Animation* animation) {
gtk_widget_queue_draw(view_.get());
}
void RenderWidgetHostViewGtk::AnimationCanceled(
const ui::Animation* animation) {
gtk_widget_queue_draw(view_.get());
}
void RenderWidgetHostViewGtk::set_last_mouse_down(GdkEventButton* event) { void RenderWidgetHostViewGtk::set_last_mouse_down(GdkEventButton* event) {
GdkEventButton* temp = NULL; GdkEventButton* temp = NULL;
if (event) { if (event) {
......
...@@ -44,8 +44,7 @@ typedef struct _GtkSelectionData GtkSelectionData; ...@@ -44,8 +44,7 @@ typedef struct _GtkSelectionData GtkSelectionData;
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// See comments in render_widget_host_view.h about this class and its members. // See comments in render_widget_host_view.h about this class and its members.
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
class CONTENT_EXPORT RenderWidgetHostViewGtk : public RenderWidgetHostView, class CONTENT_EXPORT RenderWidgetHostViewGtk : public RenderWidgetHostView {
public ui::AnimationDelegate {
public: public:
explicit RenderWidgetHostViewGtk(RenderWidgetHost* widget); explicit RenderWidgetHostViewGtk(RenderWidgetHost* widget);
virtual ~RenderWidgetHostViewGtk(); virtual ~RenderWidgetHostViewGtk();
...@@ -104,8 +103,6 @@ class CONTENT_EXPORT RenderWidgetHostViewGtk : public RenderWidgetHostView, ...@@ -104,8 +103,6 @@ class CONTENT_EXPORT RenderWidgetHostViewGtk : public RenderWidgetHostView,
virtual void SetBackground(const SkBitmap& background) OVERRIDE; virtual void SetBackground(const SkBitmap& background) OVERRIDE;
virtual void CreatePluginContainer(gfx::PluginWindowHandle id) OVERRIDE; virtual void CreatePluginContainer(gfx::PluginWindowHandle id) OVERRIDE;
virtual void DestroyPluginContainer(gfx::PluginWindowHandle id) OVERRIDE; virtual void DestroyPluginContainer(gfx::PluginWindowHandle id) OVERRIDE;
virtual void SetVisuallyDeemphasized(const SkColor* color,
bool animate) OVERRIDE;
virtual void UnhandledWheelEvent( virtual void UnhandledWheelEvent(
const WebKit::WebMouseWheelEvent& event) OVERRIDE; const WebKit::WebMouseWheelEvent& event) OVERRIDE;
virtual void SetHasHorizontalScrollbar( virtual void SetHasHorizontalScrollbar(
...@@ -118,11 +115,6 @@ class CONTENT_EXPORT RenderWidgetHostViewGtk : public RenderWidgetHostView, ...@@ -118,11 +115,6 @@ class CONTENT_EXPORT RenderWidgetHostViewGtk : public RenderWidgetHostView,
virtual bool LockMouse() OVERRIDE; virtual bool LockMouse() OVERRIDE;
virtual void UnlockMouse() OVERRIDE; virtual void UnlockMouse() OVERRIDE;
// ui::AnimationDelegate implementation.
virtual void AnimationEnded(const ui::Animation* animation) OVERRIDE;
virtual void AnimationProgressed(const ui::Animation* animation) OVERRIDE;
virtual void AnimationCanceled(const ui::Animation* animation) OVERRIDE;
gfx::NativeView native_view() const { return view_.get(); } gfx::NativeView native_view() const { return view_.get(); }
// If the widget is aligned with an edge of the monitor its on and the user // If the widget is aligned with an edge of the monitor its on and the user
...@@ -223,14 +215,6 @@ class CONTENT_EXPORT RenderWidgetHostViewGtk : public RenderWidgetHostView, ...@@ -223,14 +215,6 @@ class CONTENT_EXPORT RenderWidgetHostViewGtk : public RenderWidgetHostView,
// The time it took after this view was selected for it to be fully painted. // The time it took after this view was selected for it to be fully painted.
base::TimeTicks tab_switch_paint_time_; base::TimeTicks tab_switch_paint_time_;
// A color we use to shade the entire render view. If 100% transparent, we do
// not shade the render view.
SkColor overlay_color_;
// The animation used for the abovementioned shade effect. The animation's
// value affects the alpha we use for |overlay_color_|.
ui::SlideAnimation overlay_animation_;
// The native view of our parent widget. Used only for popups. // The native view of our parent widget. Used only for popups.
GtkWidget* parent_; GtkWidget* parent_;
......
...@@ -278,9 +278,6 @@ class RenderWidgetHostViewMac : public RenderWidgetHostView { ...@@ -278,9 +278,6 @@ class RenderWidgetHostViewMac : public RenderWidgetHostView {
// to be reloaded. // to be reloaded.
void ForceTextureReload(); void ForceTextureReload();
virtual void SetVisuallyDeemphasized(const SkColor* color,
bool animate) OVERRIDE;
virtual void UnhandledWheelEvent( virtual void UnhandledWheelEvent(
const WebKit::WebMouseWheelEvent& event) OVERRIDE; const WebKit::WebMouseWheelEvent& event) OVERRIDE;
virtual void SetHasHorizontalScrollbar( virtual void SetHasHorizontalScrollbar(
......
...@@ -987,11 +987,6 @@ void RenderWidgetHostViewMac::ForceTextureReload() { ...@@ -987,11 +987,6 @@ void RenderWidgetHostViewMac::ForceTextureReload() {
plugin_container_manager_.ForceTextureReload(); plugin_container_manager_.ForceTextureReload();
} }
void RenderWidgetHostViewMac::SetVisuallyDeemphasized(const SkColor* color,
bool animate) {
// This is not used on mac.
}
void RenderWidgetHostViewMac::UnhandledWheelEvent( void RenderWidgetHostViewMac::UnhandledWheelEvent(
const WebKit::WebMouseWheelEvent& event) { const WebKit::WebMouseWheelEvent& event) {
[cocoa_view_ gotUnhandledWheelEvent]; [cocoa_view_ gotUnhandledWheelEvent];
......
...@@ -153,31 +153,6 @@ BOOL CALLBACK DetachPluginWindowsCallback(HWND window, LPARAM param) { ...@@ -153,31 +153,6 @@ BOOL CALLBACK DetachPluginWindowsCallback(HWND window, LPARAM param) {
return TRUE; return TRUE;
} }
// Draw the contents of |backing_store_dc| onto |paint_rect| with a 70% grey
// filter.
void DrawDeemphasized(const SkColor& color,
const gfx::Rect& paint_rect,
HDC backing_store_dc,
HDC paint_dc) {
gfx::CanvasSkia canvas(paint_rect.width(), paint_rect.height(), true);
{
skia::ScopedPlatformPaint scoped_platform_paint(canvas.sk_canvas());
HDC dc = scoped_platform_paint.GetPlatformSurface();
BitBlt(dc,
0,
0,
paint_rect.width(),
paint_rect.height(),
backing_store_dc,
paint_rect.x(),
paint_rect.y(),
SRCCOPY);
}
canvas.FillRect(color, gfx::Rect(gfx::Point(), paint_rect.size()));
skia::DrawToNativeContext(canvas.sk_canvas(), paint_dc, paint_rect.x(),
paint_rect.y(), NULL);
}
// The plugin wrapper window which lives in the browser process has this proc // The plugin wrapper window which lives in the browser process has this proc
// as its window procedure. We only handle the WM_PARENTNOTIFY message sent by // as its window procedure. We only handle the WM_PARENTNOTIFY message sent by
// windowed plugins for mouse input. This is forwarded off to the wrappers // windowed plugins for mouse input. This is forwarded off to the wrappers
...@@ -331,7 +306,6 @@ RenderWidgetHostViewWin::RenderWidgetHostViewWin(RenderWidgetHost* widget) ...@@ -331,7 +306,6 @@ RenderWidgetHostViewWin::RenderWidgetHostViewWin(RenderWidgetHost* widget)
weak_factory_(this), weak_factory_(this),
parent_hwnd_(NULL), parent_hwnd_(NULL),
is_loading_(false), is_loading_(false),
overlay_color_(0),
text_input_type_(ui::TEXT_INPUT_TYPE_NONE), text_input_type_(ui::TEXT_INPUT_TYPE_NONE),
is_fullscreen_(false), is_fullscreen_(false),
ignore_mouse_movement_(true), ignore_mouse_movement_(true),
...@@ -870,19 +844,6 @@ void RenderWidgetHostViewWin::SetBackground(const SkBitmap& background) { ...@@ -870,19 +844,6 @@ void RenderWidgetHostViewWin::SetBackground(const SkBitmap& background) {
render_widget_host_->SetBackground(background); render_widget_host_->SetBackground(background);
} }
void RenderWidgetHostViewWin::SetVisuallyDeemphasized(const SkColor* color,
bool animate) {
// |animate| is not yet implemented, and currently isn't used.
CHECK(!animate);
SkColor overlay_color = color ? *color : 0;
if (overlay_color_ == overlay_color)
return;
overlay_color_ = overlay_color;
InvalidateRect(NULL, FALSE);
}
void RenderWidgetHostViewWin::UnhandledWheelEvent( void RenderWidgetHostViewWin::UnhandledWheelEvent(
const WebKit::WebMouseWheelEvent& event) { const WebKit::WebMouseWheelEvent& event) {
} }
...@@ -1037,22 +998,15 @@ void RenderWidgetHostViewWin::OnPaint(HDC unused_dc) { ...@@ -1037,22 +998,15 @@ void RenderWidgetHostViewWin::OnPaint(HDC unused_dc) {
for (DWORD i = 0; i < region_data->rdh.nCount; ++i) { for (DWORD i = 0; i < region_data->rdh.nCount; ++i) {
gfx::Rect paint_rect = bitmap_rect.Intersect(gfx::Rect(region_rects[i])); gfx::Rect paint_rect = bitmap_rect.Intersect(gfx::Rect(region_rects[i]));
if (!paint_rect.IsEmpty()) { if (!paint_rect.IsEmpty()) {
if (SkColorGetA(overlay_color_) > 0) { BitBlt(paint_dc.m_hDC,
DrawDeemphasized(overlay_color_, paint_rect.x(),
paint_rect, paint_rect.y(),
backing_store->hdc(), paint_rect.width(),
paint_dc.m_hDC); paint_rect.height(),
} else { backing_store->hdc(),
BitBlt(paint_dc.m_hDC, paint_rect.x(),
paint_rect.x(), paint_rect.y(),
paint_rect.y(), SRCCOPY);
paint_rect.width(),
paint_rect.height(),
backing_store->hdc(),
paint_rect.x(),
paint_rect.y(),
SRCCOPY);
}
} }
} }
......
...@@ -193,8 +193,6 @@ class RenderWidgetHostViewWin ...@@ -193,8 +193,6 @@ class RenderWidgetHostViewWin
virtual BackingStore* AllocBackingStore(const gfx::Size& size) OVERRIDE; virtual BackingStore* AllocBackingStore(const gfx::Size& size) OVERRIDE;
virtual void OnAcceleratedCompositingStateChange() OVERRIDE; virtual void OnAcceleratedCompositingStateChange() OVERRIDE;
virtual void SetBackground(const SkBitmap& background) OVERRIDE; virtual void SetBackground(const SkBitmap& background) OVERRIDE;
virtual void SetVisuallyDeemphasized(const SkColor* color,
bool animate) OVERRIDE;
virtual void UnhandledWheelEvent( virtual void UnhandledWheelEvent(
const WebKit::WebMouseWheelEvent& event) OVERRIDE; const WebKit::WebMouseWheelEvent& event) OVERRIDE;
virtual void SetHasHorizontalScrollbar( virtual void SetHasHorizontalScrollbar(
...@@ -462,10 +460,6 @@ class RenderWidgetHostViewWin ...@@ -462,10 +460,6 @@ class RenderWidgetHostViewWin
// The time it took after this view was selected for it to be fully painted. // The time it took after this view was selected for it to be fully painted.
base::TimeTicks tab_switch_paint_time_; base::TimeTicks tab_switch_paint_time_;
// A color we use to shade the entire render view. If 100% transparent, we do
// not shade the render view.
SkColor overlay_color_;
// Registrar so we can listen to RENDERER_PROCESS_TERMINATED events. // Registrar so we can listen to RENDERER_PROCESS_TERMINATED events.
content::NotificationRegistrar registrar_; content::NotificationRegistrar registrar_;
......
...@@ -126,8 +126,6 @@ class TestRenderWidgetHostView : public RenderWidgetHostView { ...@@ -126,8 +126,6 @@ class TestRenderWidgetHostView : public RenderWidgetHostView {
virtual void GetScreenInfo(WebKit::WebScreenInfo* results) OVERRIDE {} virtual void GetScreenInfo(WebKit::WebScreenInfo* results) OVERRIDE {}
virtual gfx::Rect GetRootWindowBounds() OVERRIDE; virtual gfx::Rect GetRootWindowBounds() OVERRIDE;
#endif #endif
virtual void SetVisuallyDeemphasized(const SkColor* color,
bool animate) OVERRIDE { }
virtual void UnhandledWheelEvent( virtual void UnhandledWheelEvent(
const WebKit::WebMouseWheelEvent& event) OVERRIDE { } const WebKit::WebMouseWheelEvent& event) OVERRIDE { }
virtual void SetHasHorizontalScrollbar( virtual void SetHasHorizontalScrollbar(
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment