OLD | NEW |
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 "chrome/browser/ui/views/frame/glass_browser_frame_view.h" | 5 #include "chrome/browser/ui/views/frame/glass_browser_frame_view.h" |
6 | 6 |
7 #include <dwmapi.h> | 7 #include <dwmapi.h> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/win/windows_version.h" | 10 #include "base/win/windows_version.h" |
11 #include "chrome/app/chrome_command_ids.h" | 11 #include "chrome/app/chrome_command_ids.h" |
12 #include "chrome/app/chrome_dll_resource.h" | 12 #include "chrome/app/chrome_dll_resource.h" |
13 #include "chrome/browser/profiles/profile.h" | 13 #include "chrome/browser/profiles/profile.h" |
14 #include "chrome/browser/themes/theme_properties.h" | 14 #include "chrome/browser/themes/theme_properties.h" |
15 #include "chrome/browser/ui/layout_constants.h" | 15 #include "chrome/browser/ui/layout_constants.h" |
16 #include "chrome/browser/ui/views/frame/browser_view.h" | 16 #include "chrome/browser/ui/views/frame/browser_view.h" |
17 #include "chrome/browser/ui/views/profiles/profile_indicator_icon.h" | 17 #include "chrome/browser/ui/views/profiles/profile_indicator_icon.h" |
18 #include "chrome/browser/ui/views/tabs/tab.h" | 18 #include "chrome/browser/ui/views/tabs/tab.h" |
19 #include "chrome/browser/ui/views/tabs/tab_strip.h" | 19 #include "chrome/browser/ui/views/tabs/tab_strip.h" |
20 #include "chrome/browser/ui/views/toolbar/toolbar_view.h" | 20 #include "chrome/browser/ui/views/toolbar/toolbar_view.h" |
21 #include "chrome/grit/theme_resources.h" | 21 #include "chrome/grit/theme_resources.h" |
22 #include "skia/ext/image_operations.h" | 22 #include "skia/ext/image_operations.h" |
23 #include "ui/base/material_design/material_design_controller.h" | |
24 #include "ui/base/resource/resource_bundle_win.h" | 23 #include "ui/base/resource/resource_bundle_win.h" |
25 #include "ui/base/theme_provider.h" | 24 #include "ui/base/theme_provider.h" |
26 #include "ui/display/win/dpi.h" | 25 #include "ui/display/win/dpi.h" |
27 #include "ui/display/win/screen_win.h" | 26 #include "ui/display/win/screen_win.h" |
28 #include "ui/gfx/canvas.h" | 27 #include "ui/gfx/canvas.h" |
29 #include "ui/gfx/geometry/dip_util.h" | 28 #include "ui/gfx/geometry/dip_util.h" |
30 #include "ui/gfx/icon_util.h" | 29 #include "ui/gfx/icon_util.h" |
31 #include "ui/gfx/image/image.h" | 30 #include "ui/gfx/image/image.h" |
32 #include "ui/gfx/scoped_canvas.h" | 31 #include "ui/gfx/scoped_canvas.h" |
33 #include "ui/views/resources/grit/views_resources.h" | 32 #include "ui/views/resources/grit/views_resources.h" |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 } | 96 } |
98 | 97 |
99 GlassBrowserFrameView::~GlassBrowserFrameView() { | 98 GlassBrowserFrameView::~GlassBrowserFrameView() { |
100 } | 99 } |
101 | 100 |
102 /////////////////////////////////////////////////////////////////////////////// | 101 /////////////////////////////////////////////////////////////////////////////// |
103 // GlassBrowserFrameView, BrowserNonClientFrameView implementation: | 102 // GlassBrowserFrameView, BrowserNonClientFrameView implementation: |
104 | 103 |
105 gfx::Rect GlassBrowserFrameView::GetBoundsForTabStrip( | 104 gfx::Rect GlassBrowserFrameView::GetBoundsForTabStrip( |
106 views::View* tabstrip) const { | 105 views::View* tabstrip) const { |
107 // In maximized RTL windows, don't let the tabstrip overlap the caption area, | 106 const int x = |
108 // or the alpha-blending it does will make things like the profile switcher | 107 incognito_bounds_.right() + GetLayoutInsets(AVATAR_ICON).right(); |
109 // button look glitchy. | |
110 const int offset = (ui::MaterialDesignController::IsModeMaterial() || | |
111 !CaptionButtonsOnLeadingEdge() || !frame()->IsMaximized()) | |
112 ? GetLayoutInsets(AVATAR_ICON).right() | |
113 : 0; | |
114 const int x = incognito_bounds_.right() + offset; | |
115 int end_x = width() - ClientBorderThickness(false); | 108 int end_x = width() - ClientBorderThickness(false); |
116 if (!CaptionButtonsOnLeadingEdge()) { | 109 if (!CaptionButtonsOnLeadingEdge()) { |
117 end_x = std::min(frame()->GetMinimizeButtonOffset(), end_x) - | 110 end_x = std::min(frame()->GetMinimizeButtonOffset(), end_x) - |
118 (frame()->IsMaximized() ? | 111 (frame()->IsMaximized() ? |
119 kNewTabCaptionMaximizedSpacing : kNewTabCaptionRestoredSpacing); | 112 kNewTabCaptionMaximizedSpacing : kNewTabCaptionRestoredSpacing); |
120 | 113 |
121 // The profile switcher button is optionally displayed to the left of the | 114 // The profile switcher button is optionally displayed to the left of the |
122 // minimize button. | 115 // minimize button. |
123 if (profile_switcher_.view()) { | 116 if (profile_switcher_.view()) { |
124 const int old_end_x = end_x; | 117 const int old_end_x = end_x; |
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
372 } | 365 } |
373 | 366 |
374 int GlassBrowserFrameView::TopAreaHeight(bool restored) const { | 367 int GlassBrowserFrameView::TopAreaHeight(bool restored) const { |
375 if (frame()->IsFullscreen() && !restored) | 368 if (frame()->IsFullscreen() && !restored) |
376 return 0; | 369 return 0; |
377 | 370 |
378 const int top = FrameTopBorderThickness(restored); | 371 const int top = FrameTopBorderThickness(restored); |
379 // The tab top inset is equal to the height of any shadow region above the | 372 // The tab top inset is equal to the height of any shadow region above the |
380 // tabs, plus a 1 px top stroke. In maximized mode, we want to push the | 373 // tabs, plus a 1 px top stroke. In maximized mode, we want to push the |
381 // shadow region off the top of the screen but leave the top stroke. | 374 // shadow region off the top of the screen but leave the top stroke. |
382 // Annoyingly, the pre-MD layout uses different heights for the hit-test | 375 return (frame()->IsMaximized() && !restored) |
383 // exclusion region (which we want here, since we're trying to size the border | 376 ? (top - GetLayoutInsets(TAB).top() + 1) |
384 // so that the region above the tab's hit-test zone matches) versus the shadow | 377 : (top + kNonClientRestoredExtraThickness); |
385 // thickness. | |
386 const int exclusion = GetLayoutConstant(TAB_TOP_EXCLUSION_HEIGHT); | |
387 return (frame()->IsMaximized() && !restored) ? | |
388 (top - GetLayoutInsets(TAB).top() + 1) : | |
389 (top + kNonClientRestoredExtraThickness - exclusion); | |
390 } | 378 } |
391 | 379 |
392 int GlassBrowserFrameView::TitlebarHeight(bool restored) const { | 380 int GlassBrowserFrameView::TitlebarHeight(bool restored) const { |
393 if (frame()->IsFullscreen() && !restored) | 381 if (frame()->IsFullscreen() && !restored) |
394 return 0; | 382 return 0; |
395 return display::win::ScreenWin::GetSystemMetricsInDIP(SM_CYCAPTION) + | 383 return display::win::ScreenWin::GetSystemMetricsInDIP(SM_CYCAPTION) + |
396 display::win::ScreenWin::GetSystemMetricsInDIP(SM_CYSIZEFRAME); | 384 display::win::ScreenWin::GetSystemMetricsInDIP(SM_CYSIZEFRAME); |
397 } | 385 } |
398 | 386 |
399 int GlassBrowserFrameView::WindowTopY() const { | 387 int GlassBrowserFrameView::WindowTopY() const { |
(...skipping 17 matching lines...) Expand all Loading... |
417 gfx::Rect tabstrip_bounds = GetBoundsForTabStrip(browser_view()->tabstrip()); | 405 gfx::Rect tabstrip_bounds = GetBoundsForTabStrip(browser_view()->tabstrip()); |
418 const int y = WindowTopY(); | 406 const int y = WindowTopY(); |
419 canvas->FillRect(gfx::Rect(0, y, width(), tabstrip_bounds.bottom() - y), | 407 canvas->FillRect(gfx::Rect(0, y, width(), tabstrip_bounds.bottom() - y), |
420 frame_color); | 408 frame_color); |
421 // The 1 pixel line at the top is drawn by Windows when we leave that section | 409 // The 1 pixel line at the top is drawn by Windows when we leave that section |
422 // of the window blank because we have called DwmExtendFrameIntoClientArea() | 410 // of the window blank because we have called DwmExtendFrameIntoClientArea() |
423 // inside BrowserDesktopWindowTreeHostWin::UpdateDWMFrame(). | 411 // inside BrowserDesktopWindowTreeHostWin::UpdateDWMFrame(). |
424 } | 412 } |
425 | 413 |
426 void GlassBrowserFrameView::PaintToolbarBackground(gfx::Canvas* canvas) const { | 414 void GlassBrowserFrameView::PaintToolbarBackground(gfx::Canvas* canvas) const { |
| 415 // TODO(estade): can this be shared with OpaqueBrowserFrameView? |
427 gfx::Rect toolbar_bounds(browser_view()->GetToolbarBounds()); | 416 gfx::Rect toolbar_bounds(browser_view()->GetToolbarBounds()); |
428 if (toolbar_bounds.IsEmpty()) | 417 if (toolbar_bounds.IsEmpty()) |
429 return; | 418 return; |
430 gfx::Point toolbar_origin(toolbar_bounds.origin()); | 419 gfx::Point toolbar_origin(toolbar_bounds.origin()); |
431 ConvertPointToTarget(browser_view(), this, &toolbar_origin); | 420 ConvertPointToTarget(browser_view(), this, &toolbar_origin); |
432 toolbar_bounds.set_origin(toolbar_origin); | 421 toolbar_bounds.set_origin(toolbar_origin); |
433 | 422 |
434 const ui::ThemeProvider* tp = GetThemeProvider(); | 423 const ui::ThemeProvider* tp = GetThemeProvider(); |
435 const gfx::ImageSkia* const bg = tp->GetImageSkiaNamed(IDR_THEME_TOOLBAR); | 424 const int x = toolbar_bounds.x(); |
436 int x = toolbar_bounds.x(); | |
437 const int y = toolbar_bounds.y(); | 425 const int y = toolbar_bounds.y(); |
438 const int bg_y = GetTopInset(false) + Tab::GetYInsetForActiveTabBackground(); | 426 const int w = toolbar_bounds.width(); |
439 int w = toolbar_bounds.width(); | |
440 const int h = toolbar_bounds.height(); | |
441 const SkColor separator_color = | |
442 tp->GetColor(ThemeProperties::COLOR_TOOLBAR_BOTTOM_SEPARATOR); | |
443 if (ui::MaterialDesignController::IsModeMaterial()) { | |
444 // Background. The top stroke is drawn above the toolbar bounds, so unlike | |
445 // in the non-Material Design code below, we don't need to exclude any | |
446 // region from having the background image drawn over it. | |
447 if (tp->HasCustomImage(IDR_THEME_TOOLBAR)) { | |
448 canvas->TileImageInt(*bg, x + GetThemeBackgroundXInset(), y - bg_y, x, y, | |
449 w, h); | |
450 } else { | |
451 canvas->FillRect(toolbar_bounds, | |
452 tp->GetColor(ThemeProperties::COLOR_TOOLBAR)); | |
453 } | |
454 | 427 |
455 // Material Design has no corners to mask out. | 428 // Background. |
| 429 if (tp->HasCustomImage(IDR_THEME_TOOLBAR)) { |
| 430 canvas->TileImageInt(*tp->GetImageSkiaNamed(IDR_THEME_TOOLBAR), |
| 431 x + GetThemeBackgroundXInset(), |
| 432 y - GetTopInset(false) - GetLayoutInsets(TAB).top(), x, |
| 433 y, w, toolbar_bounds.height()); |
| 434 } else { |
| 435 canvas->FillRect(toolbar_bounds, |
| 436 tp->GetColor(ThemeProperties::COLOR_TOOLBAR)); |
| 437 } |
456 | 438 |
457 // Top stroke. For Material Design, the toolbar has no side strokes. | 439 // Top stroke. |
458 gfx::Rect separator_rect(x, y, w, 0); | 440 gfx::Rect separator_rect(x, y, w, 0); |
459 gfx::ScopedCanvas scoped_canvas(canvas); | 441 gfx::ScopedCanvas scoped_canvas(canvas); |
460 gfx::Rect tabstrip_bounds(GetBoundsForTabStrip(browser_view()->tabstrip())); | 442 gfx::Rect tabstrip_bounds(GetBoundsForTabStrip(browser_view()->tabstrip())); |
461 tabstrip_bounds.set_x(GetMirroredXForRect(tabstrip_bounds)); | 443 tabstrip_bounds.set_x(GetMirroredXForRect(tabstrip_bounds)); |
462 canvas->sk_canvas()->clipRect(gfx::RectToSkRect(tabstrip_bounds), | 444 canvas->sk_canvas()->clipRect(gfx::RectToSkRect(tabstrip_bounds), |
463 SkRegion::kDifference_Op); | 445 SkRegion::kDifference_Op); |
464 separator_rect.set_y(tabstrip_bounds.bottom()); | 446 separator_rect.set_y(tabstrip_bounds.bottom()); |
465 BrowserView::Paint1pxHorizontalLine(canvas, GetToolbarTopSeparatorColor(), | 447 BrowserView::Paint1pxHorizontalLine(canvas, GetToolbarTopSeparatorColor(), |
466 separator_rect, true); | 448 separator_rect, true); |
467 | 449 |
468 // Toolbar/content separator. | 450 // Toolbar/content separator. |
469 BrowserView::Paint1pxHorizontalLine(canvas, separator_color, toolbar_bounds, | 451 BrowserView::Paint1pxHorizontalLine( |
470 true); | 452 canvas, tp->GetColor(ThemeProperties::COLOR_TOOLBAR_BOTTOM_SEPARATOR), |
471 } else { | 453 toolbar_bounds, true); |
472 // Background. The top stroke is drawn using the IDR_CONTENT_TOP_XXX | |
473 // images, which overlay the toolbar. The top 2 px of these images is the | |
474 // actual top stroke + shadow, and is partly transparent, so the toolbar | |
475 // background shouldn't be drawn over it. | |
476 const int bg_dest_y = y + kContentEdgeShadowThickness; | |
477 canvas->TileImageInt(*bg, x + GetThemeBackgroundXInset(), bg_dest_y - bg_y, | |
478 x, bg_dest_y, w, h - kContentEdgeShadowThickness); | |
479 | |
480 // On Windows 10+ where we don't draw our own window border but rather go | |
481 // right to the system border, the toolbar has no corners or side strokes. | |
482 if (base::win::GetVersion() < base::win::VERSION_WIN10) { | |
483 // Mask out the corners. | |
484 const gfx::ImageSkia* const left = | |
485 tp->GetImageSkiaNamed(IDR_CONTENT_TOP_LEFT_CORNER); | |
486 const int img_w = left->width(); | |
487 x -= kContentEdgeShadowThickness; | |
488 SkPaint paint; | |
489 paint.setXfermodeMode(SkXfermode::kDstIn_Mode); | |
490 canvas->DrawImageInt( | |
491 *tp->GetImageSkiaNamed(IDR_CONTENT_TOP_LEFT_CORNER_MASK), 0, 0, img_w, | |
492 h, x, y, img_w, h, false, paint); | |
493 const int right_x = | |
494 toolbar_bounds.right() + kContentEdgeShadowThickness - img_w; | |
495 canvas->DrawImageInt( | |
496 *tp->GetImageSkiaNamed(IDR_CONTENT_TOP_RIGHT_CORNER_MASK), 0, 0, | |
497 img_w, h, right_x, y, img_w, h, false, paint); | |
498 | |
499 // Corner and side strokes. | |
500 canvas->DrawImageInt(*left, 0, 0, img_w, h, x, y, img_w, h, false); | |
501 canvas->DrawImageInt( | |
502 *tp->GetImageSkiaNamed(IDR_CONTENT_TOP_RIGHT_CORNER), 0, 0, img_w, h, | |
503 right_x, y, img_w, h, false); | |
504 | |
505 x += img_w; | |
506 w = right_x - x; | |
507 } | |
508 | |
509 // Top stroke. | |
510 canvas->TileImageInt(*tp->GetImageSkiaNamed(IDR_CONTENT_TOP_CENTER), x, y, | |
511 w, kContentEdgeShadowThickness); | |
512 | |
513 // Toolbar/content separator. | |
514 toolbar_bounds.Inset(kClientEdgeThickness, h - kClientEdgeThickness, | |
515 kClientEdgeThickness, 0); | |
516 canvas->FillRect(toolbar_bounds, separator_color); | |
517 } | |
518 } | 454 } |
519 | 455 |
520 void GlassBrowserFrameView::PaintClientEdge(gfx::Canvas* canvas) const { | 456 void GlassBrowserFrameView::PaintClientEdge(gfx::Canvas* canvas) const { |
521 // Pre-Material Design, the client edge images start below the toolbar. In MD | 457 // Draw the client edge images. |
522 // the client edge images start at the top of the toolbar. | |
523 gfx::Rect client_bounds = CalculateClientAreaBounds(); | 458 gfx::Rect client_bounds = CalculateClientAreaBounds(); |
524 const int x = client_bounds.x(); | 459 const int x = client_bounds.x(); |
525 const bool md = ui::MaterialDesignController::IsModeMaterial(); | 460 const int y = client_bounds.y() + browser_view()->GetToolbarBounds().y(); |
526 const gfx::Rect toolbar_bounds(browser_view()->GetToolbarBounds()); | |
527 const int y = | |
528 client_bounds.y() + (md ? toolbar_bounds.y() : toolbar_bounds.bottom()); | |
529 const int right = client_bounds.right(); | 461 const int right = client_bounds.right(); |
530 const int bottom = std::max(y, height() - ClientBorderThickness(false)); | 462 const int bottom = std::max(y, height() - ClientBorderThickness(false)); |
531 | 463 |
532 // Draw the client edge images. For non-MD, we fill the toolbar color | |
533 // underneath these images so they will lighten/darken it appropriately to | |
534 // create a "3D shaded" effect. For MD, where we want a flatter appearance, | |
535 // we do the filling afterwards so the user sees the unmodified toolbar color. | |
536 const ui::ThemeProvider* tp = GetThemeProvider(); | 464 const ui::ThemeProvider* tp = GetThemeProvider(); |
537 const SkColor toolbar_color = tp->GetColor(ThemeProperties::COLOR_TOOLBAR); | 465 if (base::win::GetVersion() < base::win::VERSION_WIN10) { |
538 if (!md) | |
539 FillClientEdgeRects(x, y, right, bottom, toolbar_color, canvas); | |
540 if (!md || (base::win::GetVersion() < base::win::VERSION_WIN10)) { | |
541 const gfx::ImageSkia* const right_image = | 466 const gfx::ImageSkia* const right_image = |
542 tp->GetImageSkiaNamed(IDR_CONTENT_RIGHT_SIDE); | 467 tp->GetImageSkiaNamed(IDR_CONTENT_RIGHT_SIDE); |
543 const int img_w = right_image->width(); | 468 const int img_w = right_image->width(); |
544 const int height = bottom - y; | 469 const int height = bottom - y; |
545 canvas->TileImageInt(*right_image, right, y, img_w, height); | 470 canvas->TileImageInt(*right_image, right, y, img_w, height); |
546 canvas->DrawImageInt( | 471 canvas->DrawImageInt( |
547 *tp->GetImageSkiaNamed(IDR_CONTENT_BOTTOM_RIGHT_CORNER), right, bottom); | 472 *tp->GetImageSkiaNamed(IDR_CONTENT_BOTTOM_RIGHT_CORNER), right, bottom); |
548 const gfx::ImageSkia* const bottom_image = | 473 const gfx::ImageSkia* const bottom_image = |
549 tp->GetImageSkiaNamed(IDR_CONTENT_BOTTOM_CENTER); | 474 tp->GetImageSkiaNamed(IDR_CONTENT_BOTTOM_CENTER); |
550 canvas->TileImageInt(*bottom_image, x, bottom, client_bounds.width(), | 475 canvas->TileImageInt(*bottom_image, x, bottom, client_bounds.width(), |
551 bottom_image->height()); | 476 bottom_image->height()); |
552 canvas->DrawImageInt(*tp->GetImageSkiaNamed(IDR_CONTENT_BOTTOM_LEFT_CORNER), | 477 canvas->DrawImageInt(*tp->GetImageSkiaNamed(IDR_CONTENT_BOTTOM_LEFT_CORNER), |
553 x - img_w, bottom); | 478 x - img_w, bottom); |
554 canvas->TileImageInt(*tp->GetImageSkiaNamed(IDR_CONTENT_LEFT_SIDE), | 479 canvas->TileImageInt(*tp->GetImageSkiaNamed(IDR_CONTENT_LEFT_SIDE), |
555 x - img_w, y, img_w, height); | 480 x - img_w, y, img_w, height); |
556 } | 481 } |
557 if (md) | 482 FillClientEdgeRects(x, y, right, bottom, |
558 FillClientEdgeRects(x, y, right, bottom, toolbar_color, canvas); | 483 tp->GetColor(ThemeProperties::COLOR_TOOLBAR), canvas); |
559 } | 484 } |
560 | 485 |
561 void GlassBrowserFrameView::FillClientEdgeRects(int x, | 486 void GlassBrowserFrameView::FillClientEdgeRects(int x, |
562 int y, | 487 int y, |
563 int right, | 488 int right, |
564 int bottom, | 489 int bottom, |
565 SkColor color, | 490 SkColor color, |
566 gfx::Canvas* canvas) const { | 491 gfx::Canvas* canvas) const { |
567 gfx::Rect side(x - kClientEdgeThickness, y, kClientEdgeThickness, | 492 gfx::Rect side(x - kClientEdgeThickness, y, kClientEdgeThickness, |
568 bottom + kClientEdgeThickness - y); | 493 bottom + kClientEdgeThickness - y); |
(...skipping 23 matching lines...) Expand all Loading... |
592 // their contents are aligned as if they were 20 pixels high and extended | 517 // their contents are aligned as if they were 20 pixels high and extended |
593 // 1 pixel off the top of the screen. We position the profile switcher | 518 // 1 pixel off the top of the screen. We position the profile switcher |
594 // button the same way to match. | 519 // button the same way to match. |
595 button_y -= 1; | 520 button_y -= 1; |
596 } | 521 } |
597 profile_switcher_.view()->SetBounds(button_x, button_y, label_size.width(), | 522 profile_switcher_.view()->SetBounds(button_x, button_y, label_size.width(), |
598 kProfileSwitcherButtonHeight); | 523 kProfileSwitcherButtonHeight); |
599 } | 524 } |
600 | 525 |
601 void GlassBrowserFrameView::LayoutIncognitoIcon() { | 526 void GlassBrowserFrameView::LayoutIncognitoIcon() { |
602 const bool md = ui::MaterialDesignController::IsModeMaterial(); | |
603 const gfx::Insets insets(GetLayoutInsets(AVATAR_ICON)); | 527 const gfx::Insets insets(GetLayoutInsets(AVATAR_ICON)); |
604 const gfx::Size size(GetIncognitoAvatarIcon().size()); | 528 const gfx::Size size(GetIncognitoAvatarIcon().size()); |
605 int x = ClientBorderThickness(false); | 529 int x = ClientBorderThickness(false); |
606 // In RTL, the icon needs to start after the caption buttons. | 530 // In RTL, the icon needs to start after the caption buttons. |
607 if (CaptionButtonsOnLeadingEdge()) { | 531 if (CaptionButtonsOnLeadingEdge()) { |
608 x = width() - frame()->GetMinimizeButtonOffset() + | 532 x = width() - frame()->GetMinimizeButtonOffset() + |
609 (profile_switcher_.view() ? (profile_switcher_.view()->width() + | 533 (profile_switcher_.view() ? (profile_switcher_.view()->width() + |
610 kProfileSwitcherButtonOffset) | 534 kProfileSwitcherButtonOffset) |
611 : 0); | 535 : 0); |
612 } else if (!md && !profile_indicator_icon() && IsToolbarVisible() && | |
613 (base::win::GetVersion() < base::win::VERSION_WIN10)) { | |
614 // In non-MD before Win 10, the toolbar has a rounded corner that we don't | |
615 // want the tabstrip to overlap. | |
616 x += browser_view()->GetToolbarBounds().x() - kContentEdgeShadowThickness + | |
617 GetThemeProvider()->GetImageSkiaNamed( | |
618 IDR_CONTENT_TOP_LEFT_CORNER)->width(); | |
619 } | 536 } |
620 const int bottom = GetTopInset(false) + browser_view()->GetTabStripHeight() - | 537 const int bottom = GetTopInset(false) + browser_view()->GetTabStripHeight() - |
621 insets.bottom(); | 538 insets.bottom(); |
622 const int y = (md || !frame()->IsMaximized()) | |
623 ? (bottom - size.height()) | |
624 : FrameTopBorderThickness(false); | |
625 incognito_bounds_.SetRect(x + (profile_indicator_icon() ? insets.left() : 0), | 539 incognito_bounds_.SetRect(x + (profile_indicator_icon() ? insets.left() : 0), |
626 y, profile_indicator_icon() ? size.width() : 0, | 540 bottom - size.height(), |
627 bottom - y); | 541 profile_indicator_icon() ? size.width() : 0, |
| 542 size.height()); |
628 if (profile_indicator_icon()) | 543 if (profile_indicator_icon()) |
629 profile_indicator_icon()->SetBoundsRect(incognito_bounds_); | 544 profile_indicator_icon()->SetBoundsRect(incognito_bounds_); |
630 } | 545 } |
631 | 546 |
632 void GlassBrowserFrameView::LayoutClientView() { | 547 void GlassBrowserFrameView::LayoutClientView() { |
633 client_view_bounds_ = CalculateClientAreaBounds(); | 548 client_view_bounds_ = CalculateClientAreaBounds(); |
634 } | 549 } |
635 | 550 |
636 gfx::Insets GlassBrowserFrameView::GetClientAreaInsets(bool restored) const { | 551 gfx::Insets GlassBrowserFrameView::GetClientAreaInsets(bool restored) const { |
637 if (!browser_view()->IsTabStripVisible()) { | 552 if (!browser_view()->IsTabStripVisible()) { |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
728 static bool initialized = false; | 643 static bool initialized = false; |
729 if (!initialized) { | 644 if (!initialized) { |
730 for (int i = 0; i < kThrobberIconCount; ++i) { | 645 for (int i = 0; i < kThrobberIconCount; ++i) { |
731 throbber_icons_[i] = | 646 throbber_icons_[i] = |
732 ui::LoadThemeIconFromResourcesDataDLL(IDI_THROBBER_01 + i); | 647 ui::LoadThemeIconFromResourcesDataDLL(IDI_THROBBER_01 + i); |
733 DCHECK(throbber_icons_[i]); | 648 DCHECK(throbber_icons_[i]); |
734 } | 649 } |
735 initialized = true; | 650 initialized = true; |
736 } | 651 } |
737 } | 652 } |
OLD | NEW |