| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/toolbar/toolbar_view.h" | 5 #include "chrome/browser/ui/views/toolbar/toolbar_view.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/i18n/number_formatting.h" | 10 #include "base/i18n/number_formatting.h" |
| 11 #include "base/prefs/pref_service.h" | 11 #include "base/prefs/pref_service.h" |
| 12 #include "base/strings/utf_string_conversions.h" | 12 #include "base/strings/utf_string_conversions.h" |
| 13 #include "base/trace_event/trace_event.h" | 13 #include "base/trace_event/trace_event.h" |
| 14 #include "chrome/app/chrome_command_ids.h" | 14 #include "chrome/app/chrome_command_ids.h" |
| 15 #include "chrome/browser/chrome_notification_types.h" | 15 #include "chrome/browser/chrome_notification_types.h" |
| 16 #include "chrome/browser/command_updater.h" | 16 #include "chrome/browser/command_updater.h" |
| 17 #include "chrome/browser/extensions/extension_commands_global_registry.h" | 17 #include "chrome/browser/extensions/extension_commands_global_registry.h" |
| 18 #include "chrome/browser/extensions/extension_util.h" | 18 #include "chrome/browser/extensions/extension_util.h" |
| 19 #include "chrome/browser/profiles/profile.h" | 19 #include "chrome/browser/profiles/profile.h" |
| 20 #include "chrome/browser/themes/theme_properties.h" | |
| 21 #include "chrome/browser/themes/theme_service.h" | |
| 22 #include "chrome/browser/ui/browser.h" | 20 #include "chrome/browser/ui/browser.h" |
| 23 #include "chrome/browser/ui/browser_command_controller.h" | 21 #include "chrome/browser/ui/browser_command_controller.h" |
| 24 #include "chrome/browser/ui/browser_commands.h" | 22 #include "chrome/browser/ui/browser_commands.h" |
| 25 #include "chrome/browser/ui/browser_content_setting_bubble_model_delegate.h" | 23 #include "chrome/browser/ui/browser_content_setting_bubble_model_delegate.h" |
| 26 #include "chrome/browser/ui/browser_tabstrip.h" | 24 #include "chrome/browser/ui/browser_tabstrip.h" |
| 27 #include "chrome/browser/ui/browser_window.h" | 25 #include "chrome/browser/ui/browser_window.h" |
| 28 #include "chrome/browser/ui/global_error/global_error_service.h" | 26 #include "chrome/browser/ui/global_error/global_error_service.h" |
| 29 #include "chrome/browser/ui/global_error/global_error_service_factory.h" | 27 #include "chrome/browser/ui/global_error/global_error_service_factory.h" |
| 30 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 28 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| 31 #include "chrome/browser/ui/toolbar/wrench_menu_model.h" | 29 #include "chrome/browser/ui/toolbar/wrench_menu_model.h" |
| 32 #include "chrome/browser/ui/view_ids.h" | 30 #include "chrome/browser/ui/view_ids.h" |
| 33 #include "chrome/browser/ui/views/extensions/extension_popup.h" | 31 #include "chrome/browser/ui/views/extensions/extension_popup.h" |
| 34 #include "chrome/browser/ui/views/frame/browser_view.h" | 32 #include "chrome/browser/ui/views/frame/browser_view.h" |
| 33 #include "chrome/browser/ui/views/layout_constants.h" |
| 35 #include "chrome/browser/ui/views/location_bar/page_action_image_view.h" | 34 #include "chrome/browser/ui/views/location_bar/page_action_image_view.h" |
| 36 #include "chrome/browser/ui/views/location_bar/page_action_with_badge_view.h" | 35 #include "chrome/browser/ui/views/location_bar/page_action_with_badge_view.h" |
| 37 #include "chrome/browser/ui/views/location_bar/star_view.h" | 36 #include "chrome/browser/ui/views/location_bar/star_view.h" |
| 38 #include "chrome/browser/ui/views/location_bar/translate_icon_view.h" | 37 #include "chrome/browser/ui/views/location_bar/translate_icon_view.h" |
| 39 #include "chrome/browser/ui/views/outdated_upgrade_bubble_view.h" | 38 #include "chrome/browser/ui/views/outdated_upgrade_bubble_view.h" |
| 40 #include "chrome/browser/ui/views/toolbar/back_button.h" | 39 #include "chrome/browser/ui/views/toolbar/back_button.h" |
| 41 #include "chrome/browser/ui/views/toolbar/browser_actions_container.h" | 40 #include "chrome/browser/ui/views/toolbar/browser_actions_container.h" |
| 42 #include "chrome/browser/ui/views/toolbar/home_button.h" | 41 #include "chrome/browser/ui/views/toolbar/home_button.h" |
| 43 #include "chrome/browser/ui/views/toolbar/reload_button.h" | 42 #include "chrome/browser/ui/views/toolbar/reload_button.h" |
| 44 #include "chrome/browser/ui/views/toolbar/toolbar_button.h" | 43 #include "chrome/browser/ui/views/toolbar/toolbar_button.h" |
| (...skipping 438 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 483 bool ToolbarView::GetAcceleratorForCommandId(int command_id, | 482 bool ToolbarView::GetAcceleratorForCommandId(int command_id, |
| 484 ui::Accelerator* accelerator) { | 483 ui::Accelerator* accelerator) { |
| 485 return GetWidget()->GetAccelerator(command_id, accelerator); | 484 return GetWidget()->GetAccelerator(command_id, accelerator); |
| 486 } | 485 } |
| 487 | 486 |
| 488 //////////////////////////////////////////////////////////////////////////////// | 487 //////////////////////////////////////////////////////////////////////////////// |
| 489 // ToolbarView, views::View overrides: | 488 // ToolbarView, views::View overrides: |
| 490 | 489 |
| 491 gfx::Size ToolbarView::GetPreferredSize() const { | 490 gfx::Size ToolbarView::GetPreferredSize() const { |
| 492 gfx::Size size(location_bar_->GetPreferredSize()); | 491 gfx::Size size(location_bar_->GetPreferredSize()); |
| 493 ui::ThemeProvider* theme_provider = GetThemeProvider(); | |
| 494 if (is_display_mode_normal()) { | 492 if (is_display_mode_normal()) { |
| 495 const int element_padding = theme_provider->GetDisplayProperty( | 493 const int element_padding = GetLayoutConstant(TOOLBAR_VIEW_ELEMENT_PADDING); |
| 496 ThemeProperties::PROPERTY_TOOLBAR_VIEW_ELEMENT_PADDING); | |
| 497 const int browser_actions_width = | 494 const int browser_actions_width = |
| 498 browser_actions_->GetPreferredSize().width(); | 495 browser_actions_->GetPreferredSize().width(); |
| 499 const int content_width = | 496 const int content_width = |
| 500 theme_provider->GetDisplayProperty( | 497 GetLayoutInsets(TOOLBAR_VIEW).width() + |
| 501 ThemeProperties::PROPERTY_TOOLBAR_VIEW_LEFT_EDGE_SPACING) + | |
| 502 back_->GetPreferredSize().width() + element_padding + | 498 back_->GetPreferredSize().width() + element_padding + |
| 503 forward_->GetPreferredSize().width() + element_padding + | 499 forward_->GetPreferredSize().width() + element_padding + |
| 504 reload_->GetPreferredSize().width() + | 500 reload_->GetPreferredSize().width() + |
| 505 (show_home_button_.GetValue() | 501 (show_home_button_.GetValue() |
| 506 ? element_padding + home_->GetPreferredSize().width() | 502 ? element_padding + home_->GetPreferredSize().width() |
| 507 : 0) + | 503 : 0) + |
| 508 theme_provider->GetDisplayProperty( | 504 GetLayoutConstant(TOOLBAR_VIEW_STANDARD_SPACING) + |
| 509 ThemeProperties::PROPERTY_TOOLBAR_VIEW_STANDARD_SPACING) + | 505 GetLayoutConstant(TOOLBAR_VIEW_LOCATION_BAR_RIGHT_PADDING) + |
| 510 theme_provider->GetDisplayProperty( | |
| 511 ThemeProperties::PROPERTY_TOOLBAR_VIEW_LOCATION_BAR_RIGHT_PADDING) + | |
| 512 browser_actions_width + | 506 browser_actions_width + |
| 513 (browser_actions_width > 0 ? element_padding : 0) + | 507 (browser_actions_width > 0 ? element_padding : 0) + |
| 514 app_menu_->GetPreferredSize().width() + | 508 app_menu_->GetPreferredSize().width(); |
| 515 theme_provider->GetDisplayProperty( | |
| 516 ThemeProperties::PROPERTY_TOOLBAR_VIEW_RIGHT_EDGE_SPACING); | |
| 517 size.Enlarge(content_width, 0); | 509 size.Enlarge(content_width, 0); |
| 518 } | 510 } |
| 519 return SizeForContentSize(size); | 511 return SizeForContentSize(size); |
| 520 } | 512 } |
| 521 | 513 |
| 522 gfx::Size ToolbarView::GetMinimumSize() const { | 514 gfx::Size ToolbarView::GetMinimumSize() const { |
| 523 gfx::Size size(location_bar_->GetMinimumSize()); | 515 gfx::Size size(location_bar_->GetMinimumSize()); |
| 524 ui::ThemeProvider* theme_provider = GetThemeProvider(); | |
| 525 if (is_display_mode_normal()) { | 516 if (is_display_mode_normal()) { |
| 526 const int element_padding = theme_provider->GetDisplayProperty( | 517 const int element_padding = GetLayoutConstant(TOOLBAR_VIEW_ELEMENT_PADDING); |
| 527 ThemeProperties::PROPERTY_TOOLBAR_VIEW_ELEMENT_PADDING); | |
| 528 const int browser_actions_width = | 518 const int browser_actions_width = |
| 529 browser_actions_->GetMinimumSize().width(); | 519 browser_actions_->GetMinimumSize().width(); |
| 530 const int content_width = | 520 const int content_width = |
| 531 theme_provider->GetDisplayProperty( | 521 GetLayoutInsets(TOOLBAR_VIEW).width() + |
| 532 ThemeProperties::PROPERTY_TOOLBAR_VIEW_LEFT_EDGE_SPACING) + | |
| 533 back_->GetMinimumSize().width() + element_padding + | 522 back_->GetMinimumSize().width() + element_padding + |
| 534 forward_->GetMinimumSize().width() + element_padding + | 523 forward_->GetMinimumSize().width() + element_padding + |
| 535 reload_->GetMinimumSize().width() + | 524 reload_->GetMinimumSize().width() + |
| 536 (show_home_button_.GetValue() | 525 (show_home_button_.GetValue() |
| 537 ? element_padding + home_->GetMinimumSize().width() | 526 ? element_padding + home_->GetMinimumSize().width() |
| 538 : 0) + | 527 : 0) + |
| 539 theme_provider->GetDisplayProperty( | 528 GetLayoutConstant(TOOLBAR_VIEW_STANDARD_SPACING) + |
| 540 ThemeProperties::PROPERTY_TOOLBAR_VIEW_STANDARD_SPACING) + | 529 GetLayoutConstant(TOOLBAR_VIEW_LOCATION_BAR_RIGHT_PADDING) + |
| 541 theme_provider->GetDisplayProperty( | |
| 542 ThemeProperties::PROPERTY_TOOLBAR_VIEW_LOCATION_BAR_RIGHT_PADDING) + | |
| 543 browser_actions_width + | 530 browser_actions_width + |
| 544 (browser_actions_width > 0 ? element_padding : 0) + | 531 (browser_actions_width > 0 ? element_padding : 0) + |
| 545 app_menu_->GetMinimumSize().width() + | 532 app_menu_->GetMinimumSize().width(); |
| 546 theme_provider->GetDisplayProperty( | |
| 547 ThemeProperties::PROPERTY_TOOLBAR_VIEW_RIGHT_EDGE_SPACING); | |
| 548 size.Enlarge(content_width, 0); | 533 size.Enlarge(content_width, 0); |
| 549 } | 534 } |
| 550 return SizeForContentSize(size); | 535 return SizeForContentSize(size); |
| 551 } | 536 } |
| 552 | 537 |
| 553 void ToolbarView::Layout() { | 538 void ToolbarView::Layout() { |
| 554 // If we have not been initialized yet just do nothing. | 539 // If we have not been initialized yet just do nothing. |
| 555 if (back_ == NULL) | 540 if (back_ == NULL) |
| 556 return; | 541 return; |
| 557 | 542 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 569 | 554 |
| 570 // If the window is maximized, we extend the back button to the left so that | 555 // If the window is maximized, we extend the back button to the left so that |
| 571 // clicking on the left-most pixel will activate the back button. | 556 // clicking on the left-most pixel will activate the back button. |
| 572 // TODO(abarth): If the window becomes maximized but is not resized, | 557 // TODO(abarth): If the window becomes maximized but is not resized, |
| 573 // then Layout() might not be called and the back button | 558 // then Layout() might not be called and the back button |
| 574 // will be slightly the wrong size. We should force a | 559 // will be slightly the wrong size. We should force a |
| 575 // Layout() in this case. | 560 // Layout() in this case. |
| 576 // http://crbug.com/5540 | 561 // http://crbug.com/5540 |
| 577 bool maximized = browser_->window() && browser_->window()->IsMaximized(); | 562 bool maximized = browser_->window() && browser_->window()->IsMaximized(); |
| 578 int back_width = back_->GetPreferredSize().width(); | 563 int back_width = back_->GetPreferredSize().width(); |
| 579 ui::ThemeProvider* theme_provider = GetThemeProvider(); | 564 const gfx::Insets insets(GetLayoutInsets(TOOLBAR_VIEW)); |
| 580 const int left_edge_spacing = theme_provider->GetDisplayProperty( | |
| 581 ThemeProperties::PROPERTY_TOOLBAR_VIEW_LEFT_EDGE_SPACING); | |
| 582 if (maximized) { | 565 if (maximized) { |
| 583 back_->SetBounds(0, child_y, back_width + left_edge_spacing, child_height); | 566 back_->SetBounds(0, child_y, back_width + insets.left(), child_height); |
| 584 back_->SetLeadingMargin(left_edge_spacing); | 567 back_->SetLeadingMargin(insets.left()); |
| 585 } else { | 568 } else { |
| 586 back_->SetBounds(left_edge_spacing, child_y, back_width, child_height); | 569 back_->SetBounds(insets.left(), child_y, back_width, child_height); |
| 587 back_->SetLeadingMargin(0); | 570 back_->SetLeadingMargin(0); |
| 588 } | 571 } |
| 589 const int element_padding = theme_provider->GetDisplayProperty( | 572 const int element_padding = GetLayoutConstant(TOOLBAR_VIEW_ELEMENT_PADDING); |
| 590 ThemeProperties::PROPERTY_TOOLBAR_VIEW_ELEMENT_PADDING); | |
| 591 int next_element_x = back_->bounds().right() + element_padding; | 573 int next_element_x = back_->bounds().right() + element_padding; |
| 592 | 574 |
| 593 forward_->SetBounds(next_element_x, child_y, | 575 forward_->SetBounds(next_element_x, child_y, |
| 594 forward_->GetPreferredSize().width(), child_height); | 576 forward_->GetPreferredSize().width(), child_height); |
| 595 next_element_x = forward_->bounds().right() + element_padding; | 577 next_element_x = forward_->bounds().right() + element_padding; |
| 596 | 578 |
| 597 reload_->SetBounds(next_element_x, child_y, | 579 reload_->SetBounds(next_element_x, child_y, |
| 598 reload_->GetPreferredSize().width(), child_height); | 580 reload_->GetPreferredSize().width(), child_height); |
| 599 next_element_x = reload_->bounds().right(); | 581 next_element_x = reload_->bounds().right(); |
| 600 | 582 |
| 601 if (show_home_button_.GetValue() || | 583 if (show_home_button_.GetValue() || |
| 602 (browser_->is_app() && extensions::util::IsNewBookmarkAppsEnabled())) { | 584 (browser_->is_app() && extensions::util::IsNewBookmarkAppsEnabled())) { |
| 603 next_element_x += element_padding; | 585 next_element_x += element_padding; |
| 604 home_->SetVisible(true); | 586 home_->SetVisible(true); |
| 605 home_->SetBounds(next_element_x, child_y, | 587 home_->SetBounds(next_element_x, child_y, |
| 606 home_->GetPreferredSize().width(), child_height); | 588 home_->GetPreferredSize().width(), child_height); |
| 607 } else { | 589 } else { |
| 608 home_->SetVisible(false); | 590 home_->SetVisible(false); |
| 609 home_->SetBounds(next_element_x, child_y, 0, child_height); | 591 home_->SetBounds(next_element_x, child_y, 0, child_height); |
| 610 } | 592 } |
| 611 next_element_x = home_->bounds().right() + | 593 next_element_x = home_->bounds().right() + |
| 612 theme_provider->GetDisplayProperty( | 594 GetLayoutConstant(TOOLBAR_VIEW_STANDARD_SPACING); |
| 613 ThemeProperties::PROPERTY_TOOLBAR_VIEW_STANDARD_SPACING); | |
| 614 | 595 |
| 615 int browser_actions_width = browser_actions_->GetPreferredSize().width(); | 596 int browser_actions_width = browser_actions_->GetPreferredSize().width(); |
| 616 int app_menu_width = app_menu_->GetPreferredSize().width(); | 597 int app_menu_width = app_menu_->GetPreferredSize().width(); |
| 617 const int right_edge_spacing = theme_provider->GetDisplayProperty( | 598 const int location_bar_right_padding = |
| 618 ThemeProperties::PROPERTY_TOOLBAR_VIEW_RIGHT_EDGE_SPACING); | 599 GetLayoutConstant(TOOLBAR_VIEW_LOCATION_BAR_RIGHT_PADDING); |
| 619 const int location_bar_right_padding = theme_provider->GetDisplayProperty( | |
| 620 ThemeProperties::PROPERTY_TOOLBAR_VIEW_LOCATION_BAR_RIGHT_PADDING); | |
| 621 int available_width = std::max( | 600 int available_width = std::max( |
| 622 0, width() - right_edge_spacing - app_menu_width - browser_actions_width - | 601 0, width() - insets.right() - app_menu_width - browser_actions_width - |
| 623 (browser_actions_width > 0 ? element_padding : 0) - | 602 (browser_actions_width > 0 ? element_padding : 0) - |
| 624 location_bar_right_padding - next_element_x); | 603 location_bar_right_padding - next_element_x); |
| 625 | 604 |
| 626 int location_height = location_bar_->GetPreferredSize().height(); | 605 int location_height = location_bar_->GetPreferredSize().height(); |
| 627 int location_y = CenteredChildY(height(), location_height); | 606 int location_y = CenteredChildY(height(), location_height); |
| 628 | 607 |
| 629 location_bar_->SetBounds(next_element_x, location_y, | 608 location_bar_->SetBounds(next_element_x, location_y, |
| 630 std::max(available_width, 0), location_height); | 609 std::max(available_width, 0), location_height); |
| 631 next_element_x = location_bar_->bounds().right() + location_bar_right_padding; | 610 next_element_x = location_bar_->bounds().right() + location_bar_right_padding; |
| 632 | 611 |
| 633 browser_actions_->SetBounds( | 612 browser_actions_->SetBounds( |
| 634 next_element_x, child_y, browser_actions_width, child_height); | 613 next_element_x, child_y, browser_actions_width, child_height); |
| 635 next_element_x = browser_actions_->bounds().right(); | 614 next_element_x = browser_actions_->bounds().right(); |
| 636 if (browser_actions_width > 0) | 615 if (browser_actions_width > 0) |
| 637 next_element_x += element_padding; | 616 next_element_x += element_padding; |
| 638 | 617 |
| 639 // The browser actions need to do a layout explicitly, because when an | 618 // The browser actions need to do a layout explicitly, because when an |
| 640 // extension is loaded/unloaded/changed, BrowserActionContainer removes and | 619 // extension is loaded/unloaded/changed, BrowserActionContainer removes and |
| 641 // re-adds everything, regardless of whether it has a page action. For a | 620 // re-adds everything, regardless of whether it has a page action. For a |
| 642 // page action, browser action bounds do not change, as a result of which | 621 // page action, browser action bounds do not change, as a result of which |
| 643 // SetBounds does not do a layout at all. | 622 // SetBounds does not do a layout at all. |
| 644 // TODO(sidchat): Rework the above behavior so that explicit layout is not | 623 // TODO(sidchat): Rework the above behavior so that explicit layout is not |
| 645 // required. | 624 // required. |
| 646 browser_actions_->Layout(); | 625 browser_actions_->Layout(); |
| 647 | 626 |
| 648 // Extend the app menu to the screen's right edge in maximized mode just like | 627 // Extend the app menu to the screen's right edge in maximized mode just like |
| 649 // we extend the back button to the left edge. | 628 // we extend the back button to the left edge. |
| 650 if (maximized) | 629 if (maximized) |
| 651 app_menu_width += right_edge_spacing; | 630 app_menu_width += insets.right(); |
| 652 app_menu_->SetBounds(next_element_x, child_y, app_menu_width, child_height); | 631 app_menu_->SetBounds(next_element_x, child_y, app_menu_width, child_height); |
| 653 } | 632 } |
| 654 | 633 |
| 655 void ToolbarView::OnPaint(gfx::Canvas* canvas) { | 634 void ToolbarView::OnPaint(gfx::Canvas* canvas) { |
| 656 View::OnPaint(canvas); | 635 View::OnPaint(canvas); |
| 657 | 636 |
| 658 if (is_display_mode_normal()) | 637 if (is_display_mode_normal()) |
| 659 return; | 638 return; |
| 660 | 639 |
| 661 // For glass, we need to draw a black line below the location bar to separate | 640 // For glass, we need to draw a black line below the location bar to separate |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 771 } | 750 } |
| 772 | 751 |
| 773 gfx::Size ToolbarView::SizeForContentSize(gfx::Size size) const { | 752 gfx::Size ToolbarView::SizeForContentSize(gfx::Size size) const { |
| 774 if (is_display_mode_normal()) { | 753 if (is_display_mode_normal()) { |
| 775 // For Material Design the size of the toolbar is computed using the size | 754 // For Material Design the size of the toolbar is computed using the size |
| 776 // of the location bar and constant padding values. For non-material the | 755 // of the location bar and constant padding values. For non-material the |
| 777 // size is based on the provided assets. | 756 // size is based on the provided assets. |
| 778 if (ui::MaterialDesignController::IsModeMaterial()) { | 757 if (ui::MaterialDesignController::IsModeMaterial()) { |
| 779 int content_height = std::max(back_->GetPreferredSize().height(), | 758 int content_height = std::max(back_->GetPreferredSize().height(), |
| 780 location_bar_->GetPreferredSize().height()); | 759 location_bar_->GetPreferredSize().height()); |
| 781 int top_padding = GetThemeProvider()->GetDisplayProperty( | 760 int padding = GetLayoutInsets(TOOLBAR_VIEW).height(); |
| 782 ThemeProperties::PROPERTY_TOOLBAR_VIEW_TOP_VERTICAL_PADDING); | 761 size.SetToMax(gfx::Size(0, content_height + padding)); |
| 783 int bottom_padding = GetThemeProvider()->GetDisplayProperty( | |
| 784 ThemeProperties::PROPERTY_TOOLBAR_VIEW_BOTTOM_VERTICAL_PADDING); | |
| 785 size.SetToMax( | |
| 786 gfx::Size(0, content_height + top_padding + bottom_padding)); | |
| 787 } else { | 762 } else { |
| 788 gfx::ImageSkia* normal_background = | 763 gfx::ImageSkia* normal_background = |
| 789 GetThemeProvider()->GetImageSkiaNamed(IDR_CONTENT_TOP_CENTER); | 764 GetThemeProvider()->GetImageSkiaNamed(IDR_CONTENT_TOP_CENTER); |
| 790 size.SetToMax( | 765 size.SetToMax( |
| 791 gfx::Size(0, normal_background->height() - content_shadow_height())); | 766 gfx::Size(0, normal_background->height() - content_shadow_height())); |
| 792 } | 767 } |
| 793 } else if (size.height() == 0) { | 768 } else if (size.height() == 0) { |
| 794 // Location mode with a 0 height location bar. If on ash, expand by one | 769 // Location mode with a 0 height location bar. If on ash, expand by one |
| 795 // pixel to show a border in the title bar, otherwise leave the size as zero | 770 // pixel to show a border in the title bar, otherwise leave the size as zero |
| 796 // height. | 771 // height. |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 846 app_menu_, browser_, auto_update_enabled); | 821 app_menu_, browser_, auto_update_enabled); |
| 847 } | 822 } |
| 848 } | 823 } |
| 849 | 824 |
| 850 void ToolbarView::OnShowHomeButtonChanged() { | 825 void ToolbarView::OnShowHomeButtonChanged() { |
| 851 Layout(); | 826 Layout(); |
| 852 SchedulePaint(); | 827 SchedulePaint(); |
| 853 } | 828 } |
| 854 | 829 |
| 855 int ToolbarView::content_shadow_height() const { | 830 int ToolbarView::content_shadow_height() const { |
| 856 ui::ThemeProvider* theme_provider = GetThemeProvider(); | 831 return GetLayoutConstant( |
| 857 return theme_provider->GetDisplayProperty( | 832 (browser_->host_desktop_type() == chrome::HOST_DESKTOP_TYPE_ASH) |
| 858 browser_->host_desktop_type() == chrome::HOST_DESKTOP_TYPE_ASH | 833 ? TOOLBAR_VIEW_CONTENT_SHADOW_HEIGHT_ASH |
| 859 ? ThemeProperties::PROPERTY_TOOLBAR_VIEW_CONTENT_SHADOW_HEIGHT_ASH | 834 : TOOLBAR_VIEW_CONTENT_SHADOW_HEIGHT); |
| 860 : ThemeProperties::PROPERTY_TOOLBAR_VIEW_CONTENT_SHADOW_HEIGHT); | |
| 861 } | 835 } |
| OLD | NEW |