| OLD | NEW | 
|    1 // Copyright 2014 The Chromium Authors. All rights reserved. |    1 // Copyright 2014 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/extension_toolbar_menu_view.h" |    5 #include "chrome/browser/ui/views/toolbar/extension_toolbar_menu_view.h" | 
|    6  |    6  | 
|    7 #include "base/bind.h" |    7 #include "base/bind.h" | 
|    8 #include "base/location.h" |    8 #include "base/location.h" | 
|    9 #include "base/single_thread_task_runner.h" |    9 #include "base/single_thread_task_runner.h" | 
|   10 #include "base/threading/thread_task_runner_handle.h" |   10 #include "base/threading/thread_task_runner_handle.h" | 
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|   54 } |   54 } | 
|   55  |   55  | 
|   56 ExtensionToolbarMenuView::~ExtensionToolbarMenuView() { |   56 ExtensionToolbarMenuView::~ExtensionToolbarMenuView() { | 
|   57 } |   57 } | 
|   58  |   58  | 
|   59 gfx::Size ExtensionToolbarMenuView::GetPreferredSize() const { |   59 gfx::Size ExtensionToolbarMenuView::GetPreferredSize() const { | 
|   60   gfx::Size s = views::ScrollView::GetPreferredSize(); |   60   gfx::Size s = views::ScrollView::GetPreferredSize(); | 
|   61   // views::ScrollView::GetPreferredSize() includes the contents' size, but |   61   // views::ScrollView::GetPreferredSize() includes the contents' size, but | 
|   62   // not the scrollbar width. Add it in if necessary. |   62   // not the scrollbar width. Add it in if necessary. | 
|   63   if (container_->GetPreferredSize().height() > max_height_) |   63   if (container_->GetPreferredSize().height() > max_height_) | 
|   64     s.Enlarge(GetScrollBarWidth(), 0); |   64     s.Enlarge(GetScrollBarLayoutWidth(), 0); | 
|   65   return s; |   65   return s; | 
|   66 } |   66 } | 
|   67  |   67  | 
|   68 int ExtensionToolbarMenuView::GetHeightForWidth(int width) const { |   68 int ExtensionToolbarMenuView::GetHeightForWidth(int width) const { | 
|   69   // The width passed in here includes the full width of the menu, so we need |   69   // The width passed in here includes the full width of the menu, so we need | 
|   70   // to omit the necessary padding. |   70   // to omit the necessary padding. | 
|   71   const views::MenuConfig& menu_config = views::MenuConfig::instance(); |   71   const views::MenuConfig& menu_config = views::MenuConfig::instance(); | 
|   72   int end_padding = menu_config.arrow_to_edge_padding - |   72   int end_padding = menu_config.arrow_to_edge_padding - | 
|   73       container_->toolbar_actions_bar()->platform_settings().item_spacing; |   73       container_->toolbar_actions_bar()->platform_settings().item_spacing; | 
|   74   width -= start_padding() + end_padding; |   74   width -= start_padding() + end_padding; | 
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  127 } |  127 } | 
|  128  |  128  | 
|  129 int ExtensionToolbarMenuView::start_padding() const { |  129 int ExtensionToolbarMenuView::start_padding() const { | 
|  130   // We pad enough on the left so that the first icon starts at the same point |  130   // We pad enough on the left so that the first icon starts at the same point | 
|  131   // as the labels. We subtract kItemSpacing because there needs to be padding |  131   // as the labels. We subtract kItemSpacing because there needs to be padding | 
|  132   // so we can see the drop indicator. |  132   // so we can see the drop indicator. | 
|  133   return views::MenuItemView::label_start() - |  133   return views::MenuItemView::label_start() - | 
|  134       container_->toolbar_actions_bar()->platform_settings().item_spacing; |  134       container_->toolbar_actions_bar()->platform_settings().item_spacing; | 
|  135 } |  135 } | 
|  136  |  136  | 
| OLD | NEW |