diff options
4 files changed, 48 insertions, 19 deletions
diff --git a/chrome/browser/renderer_host/render_widget_host_view_win.cc b/chrome/browser/renderer_host/render_widget_host_view_win.cc index 28f1ad5..8e2ae47 100644 --- a/chrome/browser/renderer_host/render_widget_host_view_win.cc +++ b/chrome/browser/renderer_host/render_widget_host_view_win.cc @@ -227,6 +227,31 @@ BOOL CALLBACK DetachPluginWindowsCallback(HWND window, LPARAM param) { return TRUE; } +// Draw the contents of |backing_store_dc| onto |paint_rect| with a 70% grey +// filter. +void DrawDeemphasized(const gfx::Rect& paint_rect, + HDC backing_store_dc, + HDC paint_dc) { + gfx::Canvas canvas(paint_rect.width(), paint_rect.height(), false); + HDC dc = canvas.beginPlatformPaint(); + BitBlt(dc, + 0, + 0, + paint_rect.width(), + paint_rect.height(), + backing_store_dc, + paint_rect.x(), + paint_rect.y(), + SRCCOPY); + canvas.endPlatformPaint(); + // 178 is 70% grey. + canvas.FillRectInt(SkColorSetARGB(178, 0, 0, 0), 0, 0, + paint_rect.width(), paint_rect.height()); + canvas.getTopPlatformDevice().drawToHDC(paint_dc, paint_rect.x(), + paint_rect.y(), NULL); + +} + } // namespace // RenderWidgetHostView -------------------------------------------------------- @@ -253,7 +278,8 @@ RenderWidgetHostViewWin::RenderWidgetHostViewWin(RenderWidgetHost* widget) tooltip_showing_(false), shutdown_factory_(this), parent_hwnd_(NULL), - is_loading_(false) { + is_loading_(false), + visually_deemphasized_(false) { render_widget_host_->set_view(this); renderer_accessible_ = CommandLine::ForCurrentProcess()->HasSwitch( @@ -749,7 +775,7 @@ bool RenderWidgetHostViewWin::ContainsNativeView( } void RenderWidgetHostViewWin::SetVisuallyDeemphasized(bool deemphasized) { - NOTIMPLEMENTED() << "http://crbug.com/32399"; + visually_deemphasized_ = deemphasized; } /////////////////////////////////////////////////////////////////////////////// @@ -854,15 +880,19 @@ void RenderWidgetHostViewWin::OnPaint(HDC unused_dc) { gfx::Rect paint_rect = bitmap_rect.Intersect(gfx::Rect(region_rects[i])); if (!paint_rect.IsEmpty()) { DrawResizeCorner(paint_rect, backing_store->hdc()); - BitBlt(paint_dc.m_hDC, - paint_rect.x(), - paint_rect.y(), - paint_rect.width(), - paint_rect.height(), - backing_store->hdc(), - paint_rect.x(), - paint_rect.y(), - SRCCOPY); + if (visually_deemphasized_) { + DrawDeemphasized(paint_rect, backing_store->hdc(), paint_dc.m_hDC); + } else { + BitBlt(paint_dc.m_hDC, + paint_rect.x(), + paint_rect.y(), + paint_rect.width(), + paint_rect.height(), + backing_store->hdc(), + paint_rect.x(), + paint_rect.y(), + SRCCOPY); + } } } diff --git a/chrome/browser/renderer_host/render_widget_host_view_win.h b/chrome/browser/renderer_host/render_widget_host_view_win.h index 05af22a..881b425 100644 --- a/chrome/browser/renderer_host/render_widget_host_view_win.h +++ b/chrome/browser/renderer_host/render_widget_host_view_win.h @@ -306,6 +306,10 @@ class RenderWidgetHostViewWin // The time it took after this view was selected for it to be fully painted. base::TimeTicks tab_switch_paint_time_; + // True if we are showing a constrained window. We will grey out the view + // whenever we paint. + bool visually_deemphasized_; + DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewWin); }; diff --git a/chrome/browser/tab_contents/tab_contents.cc b/chrome/browser/tab_contents/tab_contents.cc index c3f70d6..98c41b18 100644 --- a/chrome/browser/tab_contents/tab_contents.cc +++ b/chrome/browser/tab_contents/tab_contents.cc @@ -842,6 +842,9 @@ ConstrainedWindow* TabContents::CreateConstrainedDialog( } void TabContents::BlockTabContent(bool blocked) { + RenderWidgetHostView* rwhv = GetRenderWidgetHostView(); + if (rwhv) + rwhv->SetVisuallyDeemphasized(blocked); render_view_host()->set_ignore_input_events(blocked); if (delegate_) delegate_->SetTabContentBlocked(this, blocked); diff --git a/chrome/browser/tab_contents/tab_contents_view_gtk.cc b/chrome/browser/tab_contents/tab_contents_view_gtk.cc index 959a321..bc0e6fc 100644 --- a/chrome/browser/tab_contents/tab_contents_view_gtk.cc +++ b/chrome/browser/tab_contents/tab_contents_view_gtk.cc @@ -139,10 +139,6 @@ void TabContentsViewGtk::AttachConstrainedWindow( constrained_window_ = constrained_window; gtk_floating_container_add_floating(GTK_FLOATING_CONTAINER(floating_.get()), constrained_window->widget()); - - RenderWidgetHostView* rwhv = tab_contents()->GetRenderWidgetHostView(); - if (rwhv) - rwhv->SetVisuallyDeemphasized(true); } void TabContentsViewGtk::RemoveConstrainedWindow( @@ -152,10 +148,6 @@ void TabContentsViewGtk::RemoveConstrainedWindow( constrained_window_ = NULL; gtk_container_remove(GTK_CONTAINER(floating_.get()), constrained_window->widget()); - - RenderWidgetHostView* rwhv = tab_contents()->GetRenderWidgetHostView(); - if (rwhv) - rwhv->SetVisuallyDeemphasized(false); } void TabContentsViewGtk::CreateView(const gfx::Size& initial_size) { |