| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/renderer_host/render_widget_host_view_win.h" | 5 #include "chrome/browser/renderer_host/render_widget_host_view_win.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "app/l10n_util.h" | 9 #include "app/l10n_util.h" |
| 10 #include "app/l10n_util_win.h" | 10 #include "app/l10n_util_win.h" |
| (...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 254 BitBlt(dc, | 254 BitBlt(dc, |
| 255 0, | 255 0, |
| 256 0, | 256 0, |
| 257 paint_rect.width(), | 257 paint_rect.width(), |
| 258 paint_rect.height(), | 258 paint_rect.height(), |
| 259 backing_store_dc, | 259 backing_store_dc, |
| 260 paint_rect.x(), | 260 paint_rect.x(), |
| 261 paint_rect.y(), | 261 paint_rect.y(), |
| 262 SRCCOPY); | 262 SRCCOPY); |
| 263 canvas.endPlatformPaint(); | 263 canvas.endPlatformPaint(); |
| 264 // 178 is 70% grey. | 264 canvas.FillRectInt(overlay_color_, 0, 0, |
| 265 canvas.FillRectInt(SkColorSetARGB(178, 0, 0, 0), 0, 0, | |
| 266 paint_rect.width(), paint_rect.height()); | 265 paint_rect.width(), paint_rect.height()); |
| 267 canvas.getTopPlatformDevice().drawToHDC(paint_dc, paint_rect.x(), | 266 canvas.getTopPlatformDevice().drawToHDC(paint_dc, paint_rect.x(), |
| 268 paint_rect.y(), NULL); | 267 paint_rect.y(), NULL); |
| 269 } | 268 } |
| 270 | 269 |
| 271 } // namespace | 270 } // namespace |
| 272 | 271 |
| 273 // RenderWidgetHostView -------------------------------------------------------- | 272 // RenderWidgetHostView -------------------------------------------------------- |
| 274 | 273 |
| 275 // static | 274 // static |
| (...skipping 13 matching lines...) Expand all Loading... |
| 289 capture_enter_key_(false), | 288 capture_enter_key_(false), |
| 290 is_hidden_(false), | 289 is_hidden_(false), |
| 291 about_to_validate_and_paint_(false), | 290 about_to_validate_and_paint_(false), |
| 292 close_on_deactivate_(false), | 291 close_on_deactivate_(false), |
| 293 being_destroyed_(false), | 292 being_destroyed_(false), |
| 294 tooltip_hwnd_(NULL), | 293 tooltip_hwnd_(NULL), |
| 295 tooltip_showing_(false), | 294 tooltip_showing_(false), |
| 296 shutdown_factory_(this), | 295 shutdown_factory_(this), |
| 297 parent_hwnd_(NULL), | 296 parent_hwnd_(NULL), |
| 298 is_loading_(false), | 297 is_loading_(false), |
| 299 visually_deemphasized_(false), | 298 overlay_color_(0), |
| 300 text_input_type_(WebKit::WebTextInputTypeNone) { | 299 text_input_type_(WebKit::WebTextInputTypeNone) { |
| 301 render_widget_host_->set_view(this); | 300 render_widget_host_->set_view(this); |
| 302 registrar_.Add(this, | 301 registrar_.Add(this, |
| 303 NotificationType::RENDERER_PROCESS_TERMINATED, | 302 NotificationType::RENDERER_PROCESS_TERMINATED, |
| 304 NotificationService::AllSources()); | 303 NotificationService::AllSources()); |
| 305 } | 304 } |
| 306 | 305 |
| 307 RenderWidgetHostViewWin::~RenderWidgetHostViewWin() { | 306 RenderWidgetHostViewWin::~RenderWidgetHostViewWin() { |
| 308 ResetTooltip(); | 307 ResetTooltip(); |
| 309 } | 308 } |
| (...skipping 491 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 801 HWND parent_window = ::GetParent(native_view); | 800 HWND parent_window = ::GetParent(native_view); |
| 802 while (parent_window) { | 801 while (parent_window) { |
| 803 if (parent_window == m_hWnd) | 802 if (parent_window == m_hWnd) |
| 804 return true; | 803 return true; |
| 805 parent_window = ::GetParent(parent_window); | 804 parent_window = ::GetParent(parent_window); |
| 806 } | 805 } |
| 807 | 806 |
| 808 return false; | 807 return false; |
| 809 } | 808 } |
| 810 | 809 |
| 811 void RenderWidgetHostViewWin::SetVisuallyDeemphasized(bool deemphasized) { | 810 void RenderWidgetHostViewWin::SetVisuallyDeemphasized(const SkColor* color, |
| 812 if (visually_deemphasized_ == deemphasized) | 811 bool animate) { |
| 812 // |animate| is not yet implemented, and currently isn't used. |
| 813 CHECK(!animate); |
| 814 |
| 815 overlay_color = color ? *color : 0; |
| 816 if (overlay_color_ == overlay_color) |
| 813 return; | 817 return; |
| 818 overlay_color_ = overlay_color; |
| 814 | 819 |
| 815 visually_deemphasized_ = deemphasized; | |
| 816 InvalidateRect(NULL, FALSE); | 820 InvalidateRect(NULL, FALSE); |
| 817 } | 821 } |
| 818 | 822 |
| 819 /////////////////////////////////////////////////////////////////////////////// | 823 /////////////////////////////////////////////////////////////////////////////// |
| 820 // RenderWidgetHostViewWin, private: | 824 // RenderWidgetHostViewWin, private: |
| 821 | 825 |
| 822 LRESULT RenderWidgetHostViewWin::OnCreate(CREATESTRUCT* create_struct) { | 826 LRESULT RenderWidgetHostViewWin::OnCreate(CREATESTRUCT* create_struct) { |
| 823 // Call the WM_INPUTLANGCHANGE message handler to initialize the input locale | 827 // Call the WM_INPUTLANGCHANGE message handler to initialize the input locale |
| 824 // of a browser process. | 828 // of a browser process. |
| 825 OnInputLangChange(0, 0); | 829 OnInputLangChange(0, 0); |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 915 // Blit only the damaged regions from the backing store. | 919 // Blit only the damaged regions from the backing store. |
| 916 DWORD data_size = GetRegionData(damage_region, 0, NULL); | 920 DWORD data_size = GetRegionData(damage_region, 0, NULL); |
| 917 scoped_array<char> region_data_buf(new char[data_size]); | 921 scoped_array<char> region_data_buf(new char[data_size]); |
| 918 RGNDATA* region_data = reinterpret_cast<RGNDATA*>(region_data_buf.get()); | 922 RGNDATA* region_data = reinterpret_cast<RGNDATA*>(region_data_buf.get()); |
| 919 GetRegionData(damage_region, data_size, region_data); | 923 GetRegionData(damage_region, data_size, region_data); |
| 920 | 924 |
| 921 RECT* region_rects = reinterpret_cast<RECT*>(region_data->Buffer); | 925 RECT* region_rects = reinterpret_cast<RECT*>(region_data->Buffer); |
| 922 for (DWORD i = 0; i < region_data->rdh.nCount; ++i) { | 926 for (DWORD i = 0; i < region_data->rdh.nCount; ++i) { |
| 923 gfx::Rect paint_rect = bitmap_rect.Intersect(gfx::Rect(region_rects[i])); | 927 gfx::Rect paint_rect = bitmap_rect.Intersect(gfx::Rect(region_rects[i])); |
| 924 if (!paint_rect.IsEmpty()) { | 928 if (!paint_rect.IsEmpty()) { |
| 925 if (visually_deemphasized_) { | 929 if (SkColorGetA(overlay_coolor_) > 0) { |
| 926 DrawDeemphasized(paint_rect, backing_store->hdc(), paint_dc.m_hDC); | 930 DrawDeemphasized(paint_rect, backing_store->hdc(), paint_dc.m_hDC); |
| 927 } else { | 931 } else { |
| 928 BitBlt(paint_dc.m_hDC, | 932 BitBlt(paint_dc.m_hDC, |
| 929 paint_rect.x(), | 933 paint_rect.x(), |
| 930 paint_rect.y(), | 934 paint_rect.y(), |
| 931 paint_rect.width(), | 935 paint_rect.width(), |
| 932 paint_rect.height(), | 936 paint_rect.height(), |
| 933 backing_store->hdc(), | 937 backing_store->hdc(), |
| 934 paint_rect.x(), | 938 paint_rect.x(), |
| 935 paint_rect.y(), | 939 paint_rect.y(), |
| (...skipping 861 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1797 } | 1801 } |
| 1798 | 1802 |
| 1799 // static | 1803 // static |
| 1800 RenderWidgetHostView* | 1804 RenderWidgetHostView* |
| 1801 RenderWidgetHostView::GetRenderWidgetHostViewFromNativeView( | 1805 RenderWidgetHostView::GetRenderWidgetHostViewFromNativeView( |
| 1802 gfx::NativeView native_view) { | 1806 gfx::NativeView native_view) { |
| 1803 return ::IsWindow(native_view) ? | 1807 return ::IsWindow(native_view) ? |
| 1804 reinterpret_cast<RenderWidgetHostView*>( | 1808 reinterpret_cast<RenderWidgetHostView*>( |
| 1805 ViewProp::GetValue(native_view, kRenderWidgetHostViewKey)) : NULL; | 1809 ViewProp::GetValue(native_view, kRenderWidgetHostViewKey)) : NULL; |
| 1806 } | 1810 } |
| OLD | NEW |