Move parts from enterprise.platformKeysInternal to platformKeysInternal for reuse.
[chromium-blink-merge.git] / chrome / renderer / webview_color_overlay.cc
blob32e8a66e6233f501140b42bd2dfaec943fc93358
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 "base/logging.h"
8 #include "content/public/renderer/render_view.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::WebCanvas* canvas) {
29 SkRect rect = gfx::RectToSkRect(gfx::Rect(render_view_->GetSize()));
30 SkPaint paint;
31 paint.setColor(color_);
32 paint.setStyle(SkPaint::kFill_Style);
33 canvas->drawRect(rect, paint);