Remove unused libpeerconnection code.
[chromium-blink-merge.git] / chrome / renderer / webview_color_overlay.cc
blobca26181c6fe88edad773eda97ae576145ab89ab3
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "chrome/renderer/webview_color_overlay.h"
7 #include "content/public/renderer/render_view.h"
8 #include "third_party/WebKit/public/web/WebGraphicsContext.h"
9 #include "third_party/WebKit/public/web/WebView.h"
10 #include "third_party/skia/include/core/SkCanvas.h"
11 #include "third_party/skia/include/core/SkPaint.h"
12 #include "third_party/skia/include/core/SkRect.h"
13 #include "ui/gfx/geometry/size.h"
14 #include "ui/gfx/skia_util.h"
16 WebViewColorOverlay::WebViewColorOverlay(content::RenderView* render_view,
17 SkColor color)
18 : render_view_(render_view),
19 color_(color) {
20 render_view_->GetWebView()->addPageOverlay(this, 0);
23 WebViewColorOverlay::~WebViewColorOverlay() {
24 if (render_view_->GetWebView())
25 render_view_->GetWebView()->removePageOverlay(this);
28 void WebViewColorOverlay::paintPageOverlay(blink::WebGraphicsContext* context,
29 const blink::WebSize& webViewSize) {
30 gfx::Rect rect(webViewSize);
31 SkCanvas* canvas = context->beginDrawing(gfx::RectF(rect));
32 SkPaint paint;
33 paint.setColor(color_);
34 paint.setStyle(SkPaint::kFill_Style);
35 canvas->drawRect(gfx::RectToSkRect(rect), paint);
36 context->endDrawing();