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

Side by Side Diff: ui/views/window/custom_frame_view.cc

Issue 2628043002: Gtk3: Render a GtkHeaderBar as the background of the tab strip (Closed)
Patch Set: Handle incognito 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 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 "ui/views/window/custom_frame_view.h" 5 #include "ui/views/window/custom_frame_view.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 SchedulePaint(); 214 SchedulePaint();
215 } 215 }
216 216
217 /////////////////////////////////////////////////////////////////////////////// 217 ///////////////////////////////////////////////////////////////////////////////
218 // CustomFrameView, View overrides: 218 // CustomFrameView, View overrides:
219 219
220 void CustomFrameView::OnPaint(gfx::Canvas* canvas) { 220 void CustomFrameView::OnPaint(gfx::Canvas* canvas) {
221 if (!ShouldShowTitleBarAndBorder()) 221 if (!ShouldShowTitleBarAndBorder())
222 return; 222 return;
223 223
224 frame_background_->set_frame_color(GetFrameColor());
225 frame_background_->set_is_active(ShouldPaintAsActive());
226 frame_background_->set_incognito(false);
227 const gfx::ImageSkia frame_image = GetFrameImage();
228 frame_background_->set_theme_image(frame_image);
229 frame_background_->set_top_area_height(frame_image.height());
230
224 if (frame_->IsMaximized()) 231 if (frame_->IsMaximized())
225 PaintMaximizedFrameBorder(canvas); 232 PaintMaximizedFrameBorder(canvas);
226 else 233 else
227 PaintRestoredFrameBorder(canvas); 234 PaintRestoredFrameBorder(canvas);
228 PaintTitleBar(canvas); 235 PaintTitleBar(canvas);
229 if (ShouldShowClientEdge()) 236 if (ShouldShowClientEdge())
230 PaintRestoredClientEdge(canvas); 237 PaintRestoredClientEdge(canvas);
231 } 238 }
232 239
233 void CustomFrameView::Layout() { 240 void CustomFrameView::Layout() {
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
352 } 359 }
353 360
354 return true; 361 return true;
355 } 362 }
356 363
357 bool CustomFrameView::ShouldShowClientEdge() const { 364 bool CustomFrameView::ShouldShowClientEdge() const {
358 return !frame_->IsMaximized() && ShouldShowTitleBarAndBorder(); 365 return !frame_->IsMaximized() && ShouldShowTitleBarAndBorder();
359 } 366 }
360 367
361 void CustomFrameView::PaintRestoredFrameBorder(gfx::Canvas* canvas) { 368 void CustomFrameView::PaintRestoredFrameBorder(gfx::Canvas* canvas) {
362 frame_background_->set_frame_color(GetFrameColor());
363 const gfx::ImageSkia frame_image = GetFrameImage();
364 frame_background_->set_theme_image(frame_image);
365 frame_background_->set_top_area_height(frame_image.height());
366
367 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); 369 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
368 370
369 frame_background_->SetCornerImages( 371 frame_background_->SetCornerImages(
370 rb.GetImageNamed(IDR_WINDOW_TOP_LEFT_CORNER).ToImageSkia(), 372 rb.GetImageNamed(IDR_WINDOW_TOP_LEFT_CORNER).ToImageSkia(),
371 rb.GetImageNamed(IDR_WINDOW_TOP_RIGHT_CORNER).ToImageSkia(), 373 rb.GetImageNamed(IDR_WINDOW_TOP_RIGHT_CORNER).ToImageSkia(),
372 rb.GetImageNamed(IDR_WINDOW_BOTTOM_LEFT_CORNER).ToImageSkia(), 374 rb.GetImageNamed(IDR_WINDOW_BOTTOM_LEFT_CORNER).ToImageSkia(),
373 rb.GetImageNamed(IDR_WINDOW_BOTTOM_RIGHT_CORNER).ToImageSkia()); 375 rb.GetImageNamed(IDR_WINDOW_BOTTOM_RIGHT_CORNER).ToImageSkia());
374 frame_background_->SetSideImages( 376 frame_background_->SetSideImages(
375 rb.GetImageNamed(IDR_WINDOW_LEFT_SIDE).ToImageSkia(), 377 rb.GetImageNamed(IDR_WINDOW_LEFT_SIDE).ToImageSkia(),
376 rb.GetImageNamed(IDR_WINDOW_TOP_CENTER).ToImageSkia(), 378 rb.GetImageNamed(IDR_WINDOW_TOP_CENTER).ToImageSkia(),
377 rb.GetImageNamed(IDR_WINDOW_RIGHT_SIDE).ToImageSkia(), 379 rb.GetImageNamed(IDR_WINDOW_RIGHT_SIDE).ToImageSkia(),
378 rb.GetImageNamed(IDR_WINDOW_BOTTOM_CENTER).ToImageSkia()); 380 rb.GetImageNamed(IDR_WINDOW_BOTTOM_CENTER).ToImageSkia());
379 381
380 frame_background_->PaintRestored(canvas, this); 382 frame_background_->PaintRestored(canvas, this);
381 } 383 }
382 384
383 void CustomFrameView::PaintMaximizedFrameBorder(gfx::Canvas* canvas) { 385 void CustomFrameView::PaintMaximizedFrameBorder(gfx::Canvas* canvas) {
384 const gfx::ImageSkia frame_image = GetFrameImage();
385 frame_background_->set_theme_image(frame_image);
386 frame_background_->set_top_area_height(frame_image.height());
387 frame_background_->PaintMaximized(canvas, this); 386 frame_background_->PaintMaximized(canvas, this);
388 387
389 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); 388 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
390 389
391 // TODO(jamescook): Migrate this into FrameBackground. 390 // TODO(jamescook): Migrate this into FrameBackground.
392 // The bottom of the titlebar actually comes from the top of the Client Edge 391 // The bottom of the titlebar actually comes from the top of the Client Edge
393 // graphic, with the actual client edge clipped off the bottom. 392 // graphic, with the actual client edge clipped off the bottom.
394 const gfx::ImageSkia* titlebar_bottom = rb.GetImageNamed( 393 const gfx::ImageSkia* titlebar_bottom = rb.GetImageNamed(
395 IDR_APP_TOP_CENTER).ToImageSkia(); 394 IDR_APP_TOP_CENTER).ToImageSkia();
396 int edge_height = titlebar_bottom->height() - 395 int edge_height = titlebar_bottom->height() -
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after
638 } 637 }
639 case views::FRAME_BUTTON_CLOSE: { 638 case views::FRAME_BUTTON_CLOSE: {
640 button = close_button_; 639 button = close_button_;
641 break; 640 break;
642 } 641 }
643 } 642 }
644 return button; 643 return button;
645 } 644 }
646 645
647 } // namespace views 646 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698