| 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/toolbar_action_view.h" | 5 #include "chrome/browser/ui/views/toolbar/toolbar_action_view.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/auto_reset.h" | 9 #include "base/auto_reset.h" |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 SetHorizontalAlignment(gfx::ALIGN_CENTER); | 70 SetHorizontalAlignment(gfx::ALIGN_CENTER); |
| 71 set_drag_controller(delegate_); | 71 set_drag_controller(delegate_); |
| 72 | 72 |
| 73 set_context_menu_controller(this); | 73 set_context_menu_controller(this); |
| 74 | 74 |
| 75 // If the button is within a menu, we need to make it focusable in order to | 75 // If the button is within a menu, we need to make it focusable in order to |
| 76 // have it accessible via keyboard navigation, but it shouldn't request focus | 76 // have it accessible via keyboard navigation, but it shouldn't request focus |
| 77 // (because that would close the menu). | 77 // (because that would close the menu). |
| 78 if (delegate_->ShownInsideMenu()) { | 78 if (delegate_->ShownInsideMenu()) { |
| 79 set_request_focus_on_press(false); | 79 set_request_focus_on_press(false); |
| 80 SetFocusable(true); | 80 SetFocusBehavior(views::View::FocusBehavior::ALWAYS); |
| 81 } | 81 } |
| 82 | 82 |
| 83 UpdateState(); | 83 UpdateState(); |
| 84 } | 84 } |
| 85 | 85 |
| 86 ToolbarActionView::~ToolbarActionView() { | 86 ToolbarActionView::~ToolbarActionView() { |
| 87 // Avoid access to a destroyed InkDropDelegate when the |pressed_lock_| is | 87 // Avoid access to a destroyed InkDropDelegate when the |pressed_lock_| is |
| 88 // destroyed. | 88 // destroyed. |
| 89 set_ink_drop_delegate(nullptr); | 89 set_ink_drop_delegate(nullptr); |
| 90 view_controller_->SetDelegate(nullptr); | 90 view_controller_->SetDelegate(nullptr); |
| (...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 326 if (menu_controller->in_nested_run()) { | 326 if (menu_controller->in_nested_run()) { |
| 327 // There is another menu showing. Close the outermost menu (since we are | 327 // There is another menu showing. Close the outermost menu (since we are |
| 328 // shown in the same menu, we don't want to close the whole thing). | 328 // shown in the same menu, we don't want to close the whole thing). |
| 329 menu_controller->Cancel(views::MenuController::EXIT_OUTERMOST); | 329 menu_controller->Cancel(views::MenuController::EXIT_OUTERMOST); |
| 330 return true; | 330 return true; |
| 331 } | 331 } |
| 332 } | 332 } |
| 333 | 333 |
| 334 return false; | 334 return false; |
| 335 } | 335 } |
| OLD | NEW |