Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(258)

Unified Diff: ui/views/window/frame_background.cc

Issue 2628043002: Gtk3: Render a GtkHeaderBar as the background of the tab strip (Closed)
Patch Set: Move set_* into OnPaint Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« ui/views/window/frame_background.h ('K') | « ui/views/window/frame_background.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/window/frame_background.cc
diff --git a/ui/views/window/frame_background.cc b/ui/views/window/frame_background.cc
index 3e0e4ff5c06d71233c2a379e9973a6df3ab6e051..3fe45c260d95eee3814062d572ee63b15c8df052 100644
--- a/ui/views/window/frame_background.cc
+++ b/ui/views/window/frame_background.cc
@@ -8,12 +8,14 @@
#include "third_party/skia/include/core/SkColor.h"
#include "ui/base/theme_provider.h"
#include "ui/gfx/canvas.h"
+#include "ui/native_theme/native_theme.h"
#include "ui/views/view.h"
namespace views {
FrameBackground::FrameBackground()
: frame_color_(0),
+ is_active_(true),
top_area_height_(0),
left_edge_(nullptr),
top_edge_(nullptr),
@@ -125,10 +127,8 @@ void FrameBackground::PaintMaximized(gfx::Canvas* canvas,
// beneath the image.
int theme_frame_bottom = -maximized_top_inset_ +
(theme_image_.isNull() ? 0 : theme_image_.height());
- if (top_area_height_ > theme_frame_bottom) {
- canvas->FillRect(gfx::Rect(0, 0, view->width(), top_area_height_),
- frame_color_);
- }
+ if (top_area_height_ > theme_frame_bottom)
+ PaintFrameTopArea(canvas, view);
// Draw the theme frame.
if (!theme_image_.isNull()) {
@@ -142,9 +142,7 @@ void FrameBackground::PaintMaximized(gfx::Canvas* canvas,
void FrameBackground::PaintFrameColor(gfx::Canvas* canvas,
const View* view) const {
- // Fill the top area.
- canvas->FillRect(gfx::Rect(0, 0, view->width(), top_area_height_),
- frame_color_);
+ PaintFrameTopArea(canvas, view);
// If the window is very short, we're done.
int remaining_height = view->height() - top_area_height_;
@@ -171,4 +169,15 @@ void FrameBackground::PaintFrameColor(gfx::Canvas* canvas,
frame_color_);
}
+void FrameBackground::PaintFrameTopArea(gfx::Canvas* canvas,
+ const View* view) const {
+ auto* native_theme = view->GetNativeTheme();
+ ui::NativeTheme::ExtraParams params;
+ params.frame_top_area.is_active = is_active_;
+ params.frame_top_area.default_background_color = frame_color_;
+ native_theme->Paint(canvas->sk_canvas(), ui::NativeTheme::kFrameTopArea,
+ ui::NativeTheme::kNormal,
+ gfx::Rect(0, 0, view->width(), top_area_height_), params);
+}
+
} // namespace views
« ui/views/window/frame_background.h ('K') | « ui/views/window/frame_background.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698