| 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 <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
| 10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
| (...skipping 612 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 623 // Now place the drop indicator halfway between this and the end of the | 623 // Now place the drop indicator halfway between this and the end of the |
| 624 // previous icon. If there is an odd amount of available space between the | 624 // previous icon. If there is an odd amount of available space between the |
| 625 // two icons (or the icon and the address bar) after subtracting the drop | 625 // two icons (or the icon and the address bar) after subtracting the drop |
| 626 // indicator width, this calculation puts the extra pixel on the left side | 626 // indicator width, this calculation puts the extra pixel on the left side |
| 627 // of the indicator, since when the indicator is between the address bar and | 627 // of the indicator, since when the indicator is between the address bar and |
| 628 // the first icon, it looks better closer to the icon. | 628 // the first icon, it looks better closer to the icon. |
| 629 const int drop_indicator_x = drop_icon_x - | 629 const int drop_indicator_x = drop_icon_x - |
| 630 ((space_before_drop_icon + kDropIndicatorWidth) / 2); | 630 ((space_before_drop_icon + kDropIndicatorWidth) / 2); |
| 631 const int row_height = ToolbarActionsBar::IconHeight(); | 631 const int row_height = ToolbarActionsBar::IconHeight(); |
| 632 const int drop_indicator_y = row_height * drop_position_->row; | 632 const int drop_indicator_y = row_height * drop_position_->row; |
| 633 gfx::Rect indicator_bounds(drop_indicator_x, | 633 gfx::Rect indicator_bounds = GetMirroredRect(gfx::Rect( |
| 634 drop_indicator_y, | 634 drop_indicator_x, drop_indicator_y, kDropIndicatorWidth, row_height)); |
| 635 kDropIndicatorWidth, | |
| 636 row_height); | |
| 637 indicator_bounds.set_x(GetMirroredXForRect(indicator_bounds)); | |
| 638 | 635 |
| 639 // Color of the drop indicator. | 636 // Color of the drop indicator. |
| 640 static const SkColor kDropIndicatorColor = SK_ColorBLACK; | 637 static const SkColor kDropIndicatorColor = SK_ColorBLACK; |
| 641 canvas->FillRect(indicator_bounds, kDropIndicatorColor); | 638 canvas->FillRect(indicator_bounds, kDropIndicatorColor); |
| 642 } | 639 } |
| 643 } | 640 } |
| 644 | 641 |
| 645 void BrowserActionsContainer::ViewHierarchyChanged( | 642 void BrowserActionsContainer::ViewHierarchyChanged( |
| 646 const ViewHierarchyChangedDetails& details) { | 643 const ViewHierarchyChangedDetails& details) { |
| 647 if (!toolbar_actions_bar_->enabled()) | 644 if (!toolbar_actions_bar_->enabled()) |
| (...skipping 10 matching lines...) Expand all Loading... |
| 658 } | 655 } |
| 659 } | 656 } |
| 660 | 657 |
| 661 void BrowserActionsContainer::ClearActiveBubble(views::Widget* widget) { | 658 void BrowserActionsContainer::ClearActiveBubble(views::Widget* widget) { |
| 662 DCHECK(active_bubble_); | 659 DCHECK(active_bubble_); |
| 663 DCHECK_EQ(active_bubble_->GetWidget(), widget); | 660 DCHECK_EQ(active_bubble_->GetWidget(), widget); |
| 664 widget->RemoveObserver(this); | 661 widget->RemoveObserver(this); |
| 665 active_bubble_ = nullptr; | 662 active_bubble_ = nullptr; |
| 666 toolbar_actions_bar_->OnBubbleClosed(); | 663 toolbar_actions_bar_->OnBubbleClosed(); |
| 667 } | 664 } |
| OLD | NEW |