| 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/chevron_menu_button.h" | 5 #include "chrome/browser/ui/views/toolbar/chevron_menu_button.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "base/location.h" | 9 #include "base/location.h" |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 354 | 354 |
| 355 size_t ChevronMenuButton::MenuController::IndexForId(int id) const { | 355 size_t ChevronMenuButton::MenuController::IndexForId(int id) const { |
| 356 // The index of the view being dragged (GetCommand gives a 1-based index into | 356 // The index of the view being dragged (GetCommand gives a 1-based index into |
| 357 // the overflow menu). | 357 // the overflow menu). |
| 358 DCHECK_GT(browser_actions_container_->VisibleBrowserActions() + id, 0u); | 358 DCHECK_GT(browser_actions_container_->VisibleBrowserActions() + id, 0u); |
| 359 return browser_actions_container_->VisibleBrowserActions() + id - 1; | 359 return browser_actions_container_->VisibleBrowserActions() + id - 1; |
| 360 } | 360 } |
| 361 | 361 |
| 362 ChevronMenuButton::ChevronMenuButton( | 362 ChevronMenuButton::ChevronMenuButton( |
| 363 BrowserActionsContainer* browser_actions_container) | 363 BrowserActionsContainer* browser_actions_container) |
| 364 : views::MenuButton(NULL, base::string16(), this, false), | 364 : views::MenuButton(base::string16(), this, false), |
| 365 browser_actions_container_(browser_actions_container), | 365 browser_actions_container_(browser_actions_container), |
| 366 weak_factory_(this) { | 366 weak_factory_(this) { |
| 367 // Set the border explicitly, because otherwise the native theme manager takes | 367 // Set the border explicitly, because otherwise the native theme manager takes |
| 368 // over and reassigns the insets we set in CreateDefaultBorder(). | 368 // over and reassigns the insets we set in CreateDefaultBorder(). |
| 369 SetBorder(CreateDefaultBorder()); | 369 SetBorder(CreateDefaultBorder()); |
| 370 } | 370 } |
| 371 | 371 |
| 372 ChevronMenuButton::~ChevronMenuButton() { | 372 ChevronMenuButton::~ChevronMenuButton() { |
| 373 } | 373 } |
| 374 | 374 |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 440 // We should never try to show an overflow menu when one is already visible. | 440 // We should never try to show an overflow menu when one is already visible. |
| 441 DCHECK(!menu_controller_); | 441 DCHECK(!menu_controller_); |
| 442 menu_controller_.reset(new MenuController( | 442 menu_controller_.reset(new MenuController( |
| 443 this, browser_actions_container_, for_drop)); | 443 this, browser_actions_container_, for_drop)); |
| 444 menu_controller_->RunMenu(GetWidget()); | 444 menu_controller_->RunMenu(GetWidget()); |
| 445 } | 445 } |
| 446 | 446 |
| 447 void ChevronMenuButton::MenuDone() { | 447 void ChevronMenuButton::MenuDone() { |
| 448 menu_controller_.reset(); | 448 menu_controller_.reset(); |
| 449 } | 449 } |
| OLD | NEW |