| 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/browser_actions_container.h" | 5 #include "chrome/browser/ui/views/toolbar/browser_actions_container.h" |
| 6 | 6 |
| 7 #include "base/compiler_specific.h" | 7 #include "base/compiler_specific.h" |
| 8 #include "base/stl_util.h" | 8 #include "base/stl_util.h" |
| 9 #include "chrome/browser/extensions/extension_message_bubble_controller.h" | 9 #include "chrome/browser/extensions/extension_message_bubble_controller.h" |
| 10 #include "chrome/browser/extensions/tab_helper.h" | 10 #include "chrome/browser/extensions/tab_helper.h" |
| (...skipping 695 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 706 } | 706 } |
| 707 | 707 |
| 708 // TODO(sky/glen): Instead of using a drop indicator, animate the icons while | 708 // TODO(sky/glen): Instead of using a drop indicator, animate the icons while |
| 709 // dragging (like we do for tab dragging). | 709 // dragging (like we do for tab dragging). |
| 710 if (drop_position_.get()) { | 710 if (drop_position_.get()) { |
| 711 // The two-pixel width drop indicator. | 711 // The two-pixel width drop indicator. |
| 712 static const int kDropIndicatorWidth = 2; | 712 static const int kDropIndicatorWidth = 2; |
| 713 | 713 |
| 714 // Convert back to a pixel offset into the container. First find the X | 714 // Convert back to a pixel offset into the container. First find the X |
| 715 // coordinate of the drop icon. | 715 // coordinate of the drop icon. |
| 716 const int drop_icon_x = GetLayoutConstant(TOOLBAR_STANDARD_SPACING) + | 716 int drop_icon_x = GetLayoutConstant(TOOLBAR_STANDARD_SPACING) + |
| 717 (drop_position_->icon_in_row * ToolbarActionsBar::IconWidth(true)); | 717 (drop_position_->icon_in_row * ToolbarActionsBar::IconWidth(true)); |
| 718 // Next, find the space before the drop icon. | 718 // Next, find the space before the drop icon. |
| 719 const int space_before_drop_icon = platform_settings().item_spacing; | 719 int space_before_drop_icon = platform_settings().item_spacing; |
| 720 // Now place the drop indicator halfway between this and the end of the | 720 // Now place the drop indicator halfway between this and the end of the |
| 721 // previous icon. If there is an odd amount of available space between the | 721 // previous icon. If there is an odd amount of available space between the |
| 722 // two icons (or the icon and the address bar) after subtracting the drop | 722 // two icons (or the icon and the address bar) after subtracting the drop |
| 723 // indicator width, this calculation puts the extra pixel on the left side | 723 // indicator width, this calculation puts the extra pixel on the left side |
| 724 // of the indicator, since when the indicator is between the address bar and | 724 // of the indicator, since when the indicator is between the address bar and |
| 725 // the first icon, it looks better closer to the icon. | 725 // the first icon, it looks better closer to the icon. |
| 726 const int drop_indicator_x = drop_icon_x - | 726 int drop_indicator_x = drop_icon_x - |
| 727 ((space_before_drop_icon + kDropIndicatorWidth) / 2); | 727 ((space_before_drop_icon + kDropIndicatorWidth) / 2); |
| 728 const int row_height = ToolbarActionsBar::IconHeight(); | 728 int row_height = ToolbarActionsBar::IconHeight(); |
| 729 const int drop_indicator_y = row_height * drop_position_->row; | 729 int drop_indicator_y = row_height * drop_position_->row; |
| 730 gfx::Rect indicator_bounds(drop_indicator_x, | 730 gfx::Rect indicator_bounds(drop_indicator_x, |
| 731 drop_indicator_y, | 731 drop_indicator_y, |
| 732 kDropIndicatorWidth, | 732 kDropIndicatorWidth, |
| 733 row_height); | 733 row_height); |
| 734 indicator_bounds.set_x(GetMirroredXForRect(indicator_bounds)); | 734 indicator_bounds.set_x(GetMirroredXForRect(indicator_bounds)); |
| 735 | 735 |
| 736 // Color of the drop indicator. | 736 // Color of the drop indicator. |
| 737 static const SkColor kDropIndicatorColor = SK_ColorBLACK; | 737 static const SkColor kDropIndicatorColor = SK_ColorBLACK; |
| 738 canvas->FillRect(indicator_bounds, kDropIndicatorColor); | 738 canvas->FillRect(indicator_bounds, kDropIndicatorColor); |
| 739 } | 739 } |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 785 warning_highlight_painter_.reset( | 785 warning_highlight_painter_.reset( |
| 786 views::Painter::CreateImageGridPainter(kWarningImages)); | 786 views::Painter::CreateImageGridPainter(kWarningImages)); |
| 787 } | 787 } |
| 788 | 788 |
| 789 void BrowserActionsContainer::ClearActiveBubble(views::Widget* widget) { | 789 void BrowserActionsContainer::ClearActiveBubble(views::Widget* widget) { |
| 790 DCHECK(active_bubble_); | 790 DCHECK(active_bubble_); |
| 791 DCHECK_EQ(active_bubble_->GetWidget(), widget); | 791 DCHECK_EQ(active_bubble_->GetWidget(), widget); |
| 792 widget->RemoveObserver(this); | 792 widget->RemoveObserver(this); |
| 793 active_bubble_ = nullptr; | 793 active_bubble_ = nullptr; |
| 794 } | 794 } |
| OLD | NEW |