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

Side by Side Diff: chrome/browser/ui/views/toolbar/browser_actions_container.cc

Issue 399173004: Adjust BrowserActionsContainer drag and drop to work for overflow (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 5 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 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/prefs/pref_service.h" 8 #include "base/prefs/pref_service.h"
9 #include "base/stl_util.h" 9 #include "base/stl_util.h"
10 #include "chrome/browser/extensions/extension_service.h" 10 #include "chrome/browser/extensions/extension_service.h"
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 border->set_insets(gfx::Insets()); 92 border->set_insets(gfx::Insets());
93 return border.Pass(); 93 return border.Pass();
94 } 94 }
95 95
96 private: 96 private:
97 DISALLOW_COPY_AND_ASSIGN(ChevronMenuButton); 97 DISALLOW_COPY_AND_ASSIGN(ChevronMenuButton);
98 }; 98 };
99 99
100 } // namespace 100 } // namespace
101 101
102 ////////////////////////////////////////////////////////////////////////////////
103 // BrowserActionsContainer::DropPosition
104
105 struct BrowserActionsContainer::DropPosition {
106 DropPosition(size_t row, size_t icon_in_row);
107
108 // The (0-indexed) row into which the action will be dropped.
109 size_t row;
110
111 // The (0-indexed) icon in the row before the action will be dropped.
112 size_t icon_in_row;
113 };
114
115 BrowserActionsContainer::DropPosition::DropPosition(
116 size_t row, size_t icon_in_row)
117 : row(row), icon_in_row(icon_in_row) {
118 }
119
120 ////////////////////////////////////////////////////////////////////////////////
121 // BrowserActionsContainer
122
102 // static 123 // static
103 bool BrowserActionsContainer::disable_animations_during_testing_ = false; 124 bool BrowserActionsContainer::disable_animations_during_testing_ = false;
104 125
105 ////////////////////////////////////////////////////////////////////////////////
106 // BrowserActionsContainer
107
108 BrowserActionsContainer::BrowserActionsContainer( 126 BrowserActionsContainer::BrowserActionsContainer(
109 Browser* browser, 127 Browser* browser,
110 View* owner_view, 128 View* owner_view,
111 BrowserActionsContainer* main_container) 129 BrowserActionsContainer* main_container)
112 : profile_(browser->profile()), 130 : profile_(browser->profile()),
113 browser_(browser), 131 browser_(browser),
114 owner_view_(owner_view), 132 owner_view_(owner_view),
115 main_container_(main_container), 133 main_container_(main_container),
116 popup_(NULL), 134 popup_(NULL),
117 popup_button_(NULL), 135 popup_button_(NULL),
118 model_(NULL), 136 model_(NULL),
119 container_width_(0), 137 container_width_(0),
120 resize_area_(NULL), 138 resize_area_(NULL),
121 chevron_(NULL), 139 chevron_(NULL),
122 overflow_menu_(NULL), 140 overflow_menu_(NULL),
123 suppress_chevron_(false), 141 suppress_chevron_(false),
124 resize_amount_(0), 142 resize_amount_(0),
125 animation_target_size_(0), 143 animation_target_size_(0),
126 drop_indicator_position_(-1),
127 task_factory_(this), 144 task_factory_(this),
128 show_menu_task_factory_(this) { 145 show_menu_task_factory_(this) {
129 set_id(VIEW_ID_BROWSER_ACTION_TOOLBAR); 146 set_id(VIEW_ID_BROWSER_ACTION_TOOLBAR);
130 147
131 model_ = extensions::ExtensionToolbarModel::Get(browser->profile()); 148 model_ = extensions::ExtensionToolbarModel::Get(browser->profile());
132 if (model_) 149 if (model_)
133 model_->AddObserver(this); 150 model_->AddObserver(this);
134 151
135 bool overflow_experiment = 152 bool overflow_experiment =
136 extensions::FeatureSwitch::extension_action_redesign()->IsEnabled(); 153 extensions::FeatureSwitch::extension_action_redesign()->IsEnabled();
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
352 // Ensure that any browser actions shown in the main view are hidden in 369 // Ensure that any browser actions shown in the main view are hidden in
353 // the overflow view. 370 // the overflow view.
354 browser_action_views_[i]->SetVisible(false); 371 browser_action_views_[i]->SetVisible(false);
355 } 372 }
356 373
357 for (size_t i = main_container_->VisibleBrowserActionsAfterAnimation(); 374 for (size_t i = main_container_->VisibleBrowserActionsAfterAnimation();
358 i < browser_action_views_.size(); ++i) { 375 i < browser_action_views_.size(); ++i) {
359 BrowserActionView* view = browser_action_views_[i]; 376 BrowserActionView* view = browser_action_views_[i];
360 size_t index = i - main_container_->VisibleBrowserActionsAfterAnimation(); 377 size_t index = i - main_container_->VisibleBrowserActionsAfterAnimation();
361 int row_index = static_cast<int>(index) / kIconsPerMenuRow; 378 int row_index = static_cast<int>(index) / kIconsPerMenuRow;
362 int x = (index * IconWidth(true)) - 379 int x = kItemSpacing + (index * IconWidth(true)) -
363 (row_index * IconWidth(true) * kIconsPerMenuRow); 380 (row_index * IconWidth(true) * kIconsPerMenuRow);
364 gfx::Rect rect_bounds( 381 gfx::Rect rect_bounds(
365 x, IconHeight() * row_index, icon_width, IconHeight()); 382 x, IconHeight() * row_index, icon_width, IconHeight());
366 view->SetBoundsRect(rect_bounds); 383 view->SetBoundsRect(rect_bounds);
367 view->SetVisible(true); 384 view->SetVisible(true);
368 } 385 }
369 } else { 386 } else {
370 for (BrowserActionViews::const_iterator it = browser_action_views_.begin(); 387 for (BrowserActionViews::const_iterator it = browser_action_views_.begin();
371 it < browser_action_views_.end(); ++it) { 388 it < browser_action_views_.end(); ++it) {
372 BrowserActionView* view = *it; 389 BrowserActionView* view = *it;
(...skipping 27 matching lines...) Expand all
400 int BrowserActionsContainer::OnDragUpdated( 417 int BrowserActionsContainer::OnDragUpdated(
401 const ui::DropTargetEvent& event) { 418 const ui::DropTargetEvent& event) {
402 // First check if we are above the chevron (overflow) menu. 419 // First check if we are above the chevron (overflow) menu.
403 if (GetEventHandlerForPoint(event.location()) == chevron_) { 420 if (GetEventHandlerForPoint(event.location()) == chevron_) {
404 if (!show_menu_task_factory_.HasWeakPtrs() && !overflow_menu_) 421 if (!show_menu_task_factory_.HasWeakPtrs() && !overflow_menu_)
405 StartShowFolderDropMenuTimer(); 422 StartShowFolderDropMenuTimer();
406 return ui::DragDropTypes::DRAG_MOVE; 423 return ui::DragDropTypes::DRAG_MOVE;
407 } 424 }
408 StopShowFolderDropMenuTimer(); 425 StopShowFolderDropMenuTimer();
409 426
410 // TODO(devlin): This calculation needs to take 'overflow' mode into account
411 // once the wrench menu becomes a drag target for browser action icons.
412
413 // Figure out where to display the indicator. This is a complex calculation: 427 // Figure out where to display the indicator. This is a complex calculation:
414 428
415 // First, we figure out how much space is to the left of the icon area, so we 429 // First, we figure out how much space is to the left of the icon area, so we
416 // can calculate the true offset into the icon area. 430 // can calculate the true offset into the icon area. The easiest way to do
417 int width_before_icons = ToolbarView::kStandardSpacing; 431 // this is to just find where the first icon starts.
418 if (chevron_ && base::i18n::IsRTL()) { 432 int width_before_icons =
419 width_before_icons += 433 browser_action_views_[GetFirstVisibleIconIndex()]->x();
420 chevron_->GetPreferredSize().width() + kChevronSpacing; 434
421 } 435 // If we're right-to-left, we flip the mirror the event.x() so that our
422 int offset_into_icon_area = event.x() - width_before_icons; 436 // calculations are consistent with left-to-right.
437 int offset_into_icon_area =
438 GetMirroredXInView(event.x()) - width_before_icons;
439
440 // Next, figure out what row we're on. This only matters for overflow mode,
441 // but the calculation is the same for both.
442 size_t row_index = event.y() / IconHeight();
443
444 // Sanity check - we should never be on a different row in the main container.
445 DCHECK(in_overflow_mode() || row_index == 0);
423 446
424 // Next, we determine which icon to place the indicator in front of. We want 447 // Next, we determine which icon to place the indicator in front of. We want
425 // to place the indicator in front of icon n when the cursor is between the 448 // to place the indicator in front of icon n when the cursor is between the
426 // midpoints of icons (n - 1) and n. To do this we take the offset into the 449 // midpoints of icons (n - 1) and n. To do this we take the offset into the
427 // icon area and transform it as follows: 450 // icon area and transform it as follows:
428 // 451 //
429 // Real icon area: 452 // Real icon area:
430 // 0 a * b c 453 // 0 a * b c
431 // | | | | 454 // | | | |
432 // |[IC|ON] [IC|ON] [IC|ON] 455 // |[IC|ON] [IC|ON] [IC|ON]
433 // We want to be before icon 0 for 0 < x <= a, icon 1 for a < x <= b, etc. 456 // We want to be before icon 0 for 0 < x <= a, icon 1 for a < x <= b, etc.
434 // Here the "*" represents the offset into the icon area, and since it's 457 // Here the "*" represents the offset into the icon area, and since it's
435 // between a and b, we want to return "1". 458 // between a and b, we want to return "1".
436 // 459 //
437 // Transformed "icon area": 460 // Transformed "icon area":
438 // 0 a * b c 461 // 0 a * b c
439 // | | | | 462 // | | | |
440 // |[ICON] |[ICON] |[ICON] | 463 // |[ICON] |[ICON] |[ICON] |
441 // If we shift both our offset and our divider points later by half an icon 464 // If we shift both our offset and our divider points later by half an icon
442 // plus one spacing unit, then it becomes very easy to calculate how many 465 // plus one spacing unit, then it becomes very easy to calculate how many
443 // divider points we've passed, because they're the multiples of "one icon 466 // divider points we've passed, because they're the multiples of "one icon
444 // plus padding". 467 // plus padding".
445 int before_icon_unclamped = (offset_into_icon_area + (IconWidth(false) / 2) + 468 int before_icon_unclamped = (offset_into_icon_area + (IconWidth(false) / 2) +
446 kItemSpacing) / IconWidth(true); 469 kItemSpacing) / IconWidth(true);
447 470
471 // We need to figure out how many icons are visible on the relevant row.
472 // In the main container, this will just be the visible actions.
473 int visible_icons_on_row = VisibleBrowserActionsAfterAnimation();
474 if (in_overflow_mode()) {
475 // If this is the final row of the overflow, then this is the remainder of
476 // visible icons. Otherwise, it's a full row (kIconsPerRow).
477 visible_icons_on_row =
478 row_index ==
479 static_cast<size_t>(visible_icons_on_row / kIconsPerMenuRow) ?
480 visible_icons_on_row % kIconsPerMenuRow :
481 kIconsPerMenuRow;
482 }
483
448 // Because the user can drag outside the container bounds, we need to clamp to 484 // Because the user can drag outside the container bounds, we need to clamp to
449 // the valid range. Note that the maximum allowable value is (num icons), not 485 // the valid range. Note that the maximum allowable value is (num icons), not
450 // (num icons - 1), because we represent the indicator being past the last 486 // (num icons - 1), because we represent the indicator being past the last
451 // icon as being "before the (last + 1) icon". 487 // icon as being "before the (last + 1) icon".
452 int before_icon = std::min(std::max(before_icon_unclamped, 0), 488 size_t before_icon_in_row =
453 static_cast<int>(VisibleBrowserActions())); 489 std::min(std::max(before_icon_unclamped, 0), visible_icons_on_row);
454 490
455 // Now we convert back to a pixel offset into the container. We want to place 491 if (!drop_position_.get() ||
456 // the center of the drop indicator at the midpoint of the space before our 492 !(drop_position_->row == row_index &&
457 // chosen icon. 493 drop_position_->icon_in_row == before_icon_in_row)) {
458 SetDropIndicator(width_before_icons + (before_icon * IconWidth(true)) - 494 drop_position_.reset(new DropPosition(row_index, before_icon_in_row));
459 (kItemSpacing / 2)); 495 SchedulePaint();
496 }
460 497
461 return ui::DragDropTypes::DRAG_MOVE; 498 return ui::DragDropTypes::DRAG_MOVE;
462 } 499 }
463 500
464 void BrowserActionsContainer::OnDragExited() { 501 void BrowserActionsContainer::OnDragExited() {
465 StopShowFolderDropMenuTimer(); 502 StopShowFolderDropMenuTimer();
466 drop_indicator_position_ = -1; 503 drop_position_.reset();
467 SchedulePaint(); 504 SchedulePaint();
468 } 505 }
469 506
470 int BrowserActionsContainer::OnPerformDrop( 507 int BrowserActionsContainer::OnPerformDrop(
471 const ui::DropTargetEvent& event) { 508 const ui::DropTargetEvent& event) {
472 BrowserActionDragData data; 509 BrowserActionDragData data;
473 if (!data.Read(event.data())) 510 if (!data.Read(event.data()))
474 return ui::DragDropTypes::DRAG_NONE; 511 return ui::DragDropTypes::DRAG_NONE;
475 512
476 // Make sure we have the same view as we started with. 513 // Make sure we have the same view as we started with.
477 DCHECK_EQ(browser_action_views_[data.index()]->button()->extension()->id(), 514 DCHECK_EQ(browser_action_views_[data.index()]->button()->extension()->id(),
478 data.id()); 515 data.id());
479 DCHECK(model_); 516 DCHECK(model_);
480 517
481 size_t i = 0; 518 size_t i =
482 for (; i < browser_action_views_.size(); ++i) { 519 drop_position_->row * kIconsPerMenuRow + drop_position_->icon_in_row;
483 int view_x = browser_action_views_[i]->GetMirroredBounds().x(); 520 if (in_overflow_mode())
484 if (!browser_action_views_[i]->visible() || 521 i += GetFirstVisibleIconIndex();
485 (base::i18n::IsRTL() ? (view_x < drop_indicator_position_) :
486 (view_x >= drop_indicator_position_))) {
487 // We have reached the end of the visible icons or found one that has a
488 // higher x position than the drop point.
489 break;
490 }
491 }
492
493 // |i| now points to the item to the right of the drop indicator*, which is 522 // |i| now points to the item to the right of the drop indicator*, which is
494 // correct when dragging an icon to the left. When dragging to the right, 523 // correct when dragging an icon to the left. When dragging to the right,
495 // however, we want the icon being dragged to get the index of the item to 524 // however, we want the icon being dragged to get the index of the item to
496 // the left of the drop indicator, so we subtract one. 525 // the left of the drop indicator, so we subtract one.
497 // * Well, it can also point to the end, but not when dragging to the left. :) 526 // * Well, it can also point to the end, but not when dragging to the left. :)
498 if (i > data.index()) 527 if (i > data.index())
499 --i; 528 --i;
500 529
501 if (profile_->IsOffTheRecord()) 530 if (profile_->IsOffTheRecord())
502 i = model_->IncognitoIndexToOriginal(i); 531 i = model_->IncognitoIndexToOriginal(i);
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
683 712
684 for (BrowserActionViews::iterator it = browser_action_views_.begin(); 713 for (BrowserActionViews::iterator it = browser_action_views_.begin();
685 it != browser_action_views_.end(); ++it) { 714 it != browser_action_views_.end(); ++it) {
686 BrowserActionButton* button = (*it)->button(); 715 BrowserActionButton* button = (*it)->button();
687 if (button && button->extension() == extension) 716 if (button && button->extension() == extension)
688 return ShowPopup(button, ExtensionPopup::SHOW, should_grant); 717 return ShowPopup(button, ExtensionPopup::SHOW, should_grant);
689 } 718 }
690 return false; 719 return false;
691 } 720 }
692 721
722 size_t BrowserActionsContainer::GetFirstVisibleIconIndex() const {
723 return in_overflow_mode() ? model_->GetVisibleIconCount() : 0;
724 }
725
693 void BrowserActionsContainer::HidePopup() { 726 void BrowserActionsContainer::HidePopup() {
694 // Remove this as an observer and clear |popup_| and |popup_button_| here, 727 // Remove this as an observer and clear |popup_| and |popup_button_| here,
695 // since we might change them before OnWidgetDestroying() gets called. 728 // since we might change them before OnWidgetDestroying() gets called.
696 if (popup_) { 729 if (popup_) {
697 popup_->GetWidget()->RemoveObserver(this); 730 popup_->GetWidget()->RemoveObserver(this);
698 popup_->GetWidget()->Close(); 731 popup_->GetWidget()->Close();
699 popup_ = NULL; 732 popup_ = NULL;
700 } 733 }
701 if (popup_button_) { 734 if (popup_button_) {
702 popup_button_->SetButtonNotPushed(); 735 popup_button_->SetButtonNotPushed();
(...skipping 17 matching lines...) Expand all
720 void BrowserActionsContainer::OnPaint(gfx::Canvas* canvas) { 753 void BrowserActionsContainer::OnPaint(gfx::Canvas* canvas) {
721 // If the views haven't been initialized yet, wait for the next call to 754 // If the views haven't been initialized yet, wait for the next call to
722 // paint (one will be triggered by entering highlight mode). 755 // paint (one will be triggered by entering highlight mode).
723 if (model_->is_highlighting() && !browser_action_views_.empty()) { 756 if (model_->is_highlighting() && !browser_action_views_.empty()) {
724 views::Painter::PaintPainterAt( 757 views::Painter::PaintPainterAt(
725 canvas, highlight_painter_.get(), GetLocalBounds()); 758 canvas, highlight_painter_.get(), GetLocalBounds());
726 } 759 }
727 760
728 // TODO(sky/glen): Instead of using a drop indicator, animate the icons while 761 // TODO(sky/glen): Instead of using a drop indicator, animate the icons while
729 // dragging (like we do for tab dragging). 762 // dragging (like we do for tab dragging).
730 if (drop_indicator_position_ > -1) { 763 if (drop_position_.get()) {
731 // The two-pixel width drop indicator. 764 // The two-pixel width drop indicator.
732 static const int kDropIndicatorWidth = 2; 765 static const int kDropIndicatorWidth = 2;
733 gfx::Rect indicator_bounds( 766
734 drop_indicator_position_ - (kDropIndicatorWidth / 2), 767 // Convert back to a pixel offset into the container. We want to place
735 0, 768 // the center of the drop indicator at the midpoint of the space before
736 kDropIndicatorWidth, 769 // the drop position's referenced icon.
737 height()); 770 // This is:
771 // The width before the first icon, plus
772 // The width of all icons before the target icon in the row, minus
773 // Half the spacing between the target icon and the previous icon,
774 // plus 1 because it kItemSpacing is odd and the indicator looks
Peter Kasting 2014/07/22 21:10:00 Nit: remove "it"
Devlin 2014/07/22 22:13:20 Moot.
775 // better closer to the icon than the address bar, minus
776 // The width of the drop indicator.
777 int drop_indicator_x =
778 browser_action_views_[GetFirstVisibleIconIndex()]->x() +
779 drop_position_->icon_in_row * IconWidth(true) -
780 kItemSpacing / 2 + 1 -
Peter Kasting 2014/07/22 21:10:00 It still doesn't look to me like this is doing wha
Devlin 2014/07/22 22:13:20 1. Wow, that's much more articulate. Let's use tha
781 kDropIndicatorWidth;
782
783 // Mirror the x if it's RTL. We also need to shift the drop indicator if in
784 // RTL because FillRect always fills LTR, and we need to compensate.
785 drop_indicator_x = GetMirroredXInView(drop_indicator_x);
786 if (base::i18n::IsRTL())
787 drop_indicator_x -= kDropIndicatorWidth;
788
789 // The y is simply the start of the row (which for the main container is
790 // always 0).
791 int drop_indicator_y = IconHeight() * drop_position_->row;
792
793 gfx::Rect indicator_bounds(drop_indicator_x,
794 drop_indicator_y,
795 kDropIndicatorWidth,
796 IconHeight());
738 797
739 // Color of the drop indicator. 798 // Color of the drop indicator.
740 static const SkColor kDropIndicatorColor = SK_ColorBLACK; 799 static const SkColor kDropIndicatorColor = SK_ColorBLACK;
741 canvas->FillRect(indicator_bounds, kDropIndicatorColor); 800 canvas->FillRect(indicator_bounds, kDropIndicatorColor);
742 } 801 }
743 } 802 }
744 803
745 void BrowserActionsContainer::OnThemeChanged() { 804 void BrowserActionsContainer::OnThemeChanged() {
746 LoadImages(); 805 LoadImages();
747 } 806 }
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
938 void BrowserActionsContainer::StartShowFolderDropMenuTimer() { 997 void BrowserActionsContainer::StartShowFolderDropMenuTimer() {
939 base::MessageLoop::current()->PostDelayedTask( 998 base::MessageLoop::current()->PostDelayedTask(
940 FROM_HERE, 999 FROM_HERE,
941 base::Bind(&BrowserActionsContainer::ShowDropFolder, 1000 base::Bind(&BrowserActionsContainer::ShowDropFolder,
942 show_menu_task_factory_.GetWeakPtr()), 1001 show_menu_task_factory_.GetWeakPtr()),
943 base::TimeDelta::FromMilliseconds(views::GetMenuShowDelay())); 1002 base::TimeDelta::FromMilliseconds(views::GetMenuShowDelay()));
944 } 1003 }
945 1004
946 void BrowserActionsContainer::ShowDropFolder() { 1005 void BrowserActionsContainer::ShowDropFolder() {
947 DCHECK(!overflow_menu_); 1006 DCHECK(!overflow_menu_);
948 SetDropIndicator(-1); 1007 drop_position_.reset();
949 overflow_menu_ = 1008 overflow_menu_ =
950 new BrowserActionOverflowMenuController(this, 1009 new BrowserActionOverflowMenuController(this,
951 browser_, 1010 browser_,
952 chevron_, 1011 chevron_,
953 browser_action_views_, 1012 browser_action_views_,
954 VisibleBrowserActions(), 1013 VisibleBrowserActions(),
955 true); 1014 true);
956 overflow_menu_->set_observer(this); 1015 overflow_menu_->set_observer(this);
957 overflow_menu_->RunMenu(GetWidget()); 1016 overflow_menu_->RunMenu(GetWidget());
958 } 1017 }
959 1018
960 void BrowserActionsContainer::SetDropIndicator(int x_pos) {
961 if (drop_indicator_position_ != x_pos) {
962 drop_indicator_position_ = x_pos;
963 SchedulePaint();
964 }
965 }
966
967 int BrowserActionsContainer::IconCountToWidth(int icons, 1019 int BrowserActionsContainer::IconCountToWidth(int icons,
968 bool display_chevron) const { 1020 bool display_chevron) const {
969 if (icons < 0) 1021 if (icons < 0)
970 icons = browser_action_views_.size(); 1022 icons = browser_action_views_.size();
971 if ((icons == 0) && !display_chevron) 1023 if ((icons == 0) && !display_chevron)
972 return ToolbarView::kStandardSpacing; 1024 return ToolbarView::kStandardSpacing;
973 int icons_size = 1025 int icons_size =
974 (icons == 0) ? 0 : ((icons * IconWidth(true)) - kItemSpacing); 1026 (icons == 0) ? 0 : ((icons * IconWidth(true)) - kItemSpacing);
975 int chevron_size = chevron_ && display_chevron ? 1027 int chevron_size = chevron_ && display_chevron ?
976 (kChevronSpacing + chevron_->GetPreferredSize().width()) : 0; 1028 (kChevronSpacing + chevron_->GetPreferredSize().width()) : 0;
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
1064 views::BubbleBorder::TOP_RIGHT, 1116 views::BubbleBorder::TOP_RIGHT,
1065 show_action); 1117 show_action);
1066 popup_->GetWidget()->AddObserver(this); 1118 popup_->GetWidget()->AddObserver(this);
1067 popup_button_ = button; 1119 popup_button_ = button;
1068 1120
1069 // Only set button as pushed if it was triggered by a user click. 1121 // Only set button as pushed if it was triggered by a user click.
1070 if (should_grant) 1122 if (should_grant)
1071 popup_button_->SetButtonPushed(); 1123 popup_button_->SetButtonPushed();
1072 return true; 1124 return true;
1073 } 1125 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698