| 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 21 matching lines...) Expand all Loading... |
| 32 app_menu_(app_menu), | 32 app_menu_(app_menu), |
| 33 menu_item_(menu_item), | 33 menu_item_(menu_item), |
| 34 container_(nullptr), | 34 container_(nullptr), |
| 35 max_height_(0), | 35 max_height_(0), |
| 36 toolbar_actions_bar_observer_(this), | 36 toolbar_actions_bar_observer_(this), |
| 37 weak_factory_(this) { | 37 weak_factory_(this) { |
| 38 BrowserActionsContainer* main = | 38 BrowserActionsContainer* main = |
| 39 BrowserView::GetBrowserViewForBrowser(browser_) | 39 BrowserView::GetBrowserViewForBrowser(browser_) |
| 40 ->toolbar()->browser_actions(); | 40 ->toolbar()->browser_actions(); |
| 41 container_ = new BrowserActionsContainer(browser_, main); | 41 container_ = new BrowserActionsContainer(browser_, main); |
| 42 container_->Init(); | |
| 43 SetContents(container_); | 42 SetContents(container_); |
| 44 | 43 |
| 45 // Listen for the drop to finish so we can close the app menu, if necessary. | 44 // Listen for the drop to finish so we can close the app menu, if necessary. |
| 46 toolbar_actions_bar_observer_.Add(main->toolbar_actions_bar()); | 45 toolbar_actions_bar_observer_.Add(main->toolbar_actions_bar()); |
| 47 | 46 |
| 48 // In *very* extreme cases, it's possible that there are so many overflowed | 47 // In *very* extreme cases, it's possible that there are so many overflowed |
| 49 // actions, we won't be able to show them all. Cap the height so that the | 48 // actions, we won't be able to show them all. Cap the height so that the |
| 50 // overflow won't be excessively tall (at 8 icons per row, this allows for | 49 // overflow won't be excessively tall (at 8 icons per row, this allows for |
| 51 // 104 total extensions). | 50 // 104 total extensions). |
| 52 const int kMaxOverflowRows = 13; | 51 const int kMaxOverflowRows = 13; |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 } | 127 } |
| 129 | 128 |
| 130 int ExtensionToolbarMenuView::start_padding() const { | 129 int ExtensionToolbarMenuView::start_padding() const { |
| 131 // 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 |
| 132 // 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 |
| 133 // so we can see the drop indicator. | 132 // so we can see the drop indicator. |
| 134 return views::MenuItemView::label_start() - | 133 return views::MenuItemView::label_start() - |
| 135 container_->toolbar_actions_bar()->platform_settings().item_spacing; | 134 container_->toolbar_actions_bar()->platform_settings().item_spacing; |
| 136 } | 135 } |
| 137 | 136 |
| OLD | NEW |