summaryrefslogtreecommitdiffstats
path: root/chrome/browser/renderer_host
diff options
context:
space:
mode:
authorestade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-02-25 05:19:55 +0000
committerestade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-02-25 05:19:55 +0000
commit8dccd7cbab5135e60aa8f32d4a2ec8bbdd8068f5 (patch)
treebc0dc43a26d76dc81742662a88114830c0aa3000 /chrome/browser/renderer_host
parent115128140716fe566c804b93eee44d9662154d98 (diff)
downloadchromium_src-8dccd7cbab5135e60aa8f32d4a2ec8bbdd8068f5.zip
chromium_src-8dccd7cbab5135e60aa8f32d4a2ec8bbdd8068f5.tar.gz
chromium_src-8dccd7cbab5135e60aa8f32d4a2ec8bbdd8068f5.tar.bz2
Windows: deemphasize render view when tab contents is blocked due to constrained window.
Since this pushes the SetVisuallyDeemphasized call into TabContents, it should also cover linux/views. BUG=32399 TEST=see bug (http auth) Review URL: http://codereview.chromium.org/650184 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@39987 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/renderer_host')
-rw-r--r--chrome/browser/renderer_host/render_widget_host_view_win.cc52
-rw-r--r--chrome/browser/renderer_host/render_widget_host_view_win.h4
2 files changed, 45 insertions, 11 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);
};