| 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/browser_action_view.h" | 5 #include "chrome/browser/ui/views/toolbar/browser_action_view.h" |
| 6 | 6 |
| 7 #include "base/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
| 8 #include "chrome/browser/chrome_notification_types.h" | 8 #include "chrome/browser/chrome_notification_types.h" |
| 9 #include "chrome/browser/extensions/api/commands/command_service.h" | 9 #include "chrome/browser/extensions/api/commands/command_service.h" |
| 10 #include "chrome/browser/extensions/extension_action.h" | 10 #include "chrome/browser/extensions/extension_action.h" |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 const ViewHierarchyChangedDetails& details) { | 151 const ViewHierarchyChangedDetails& details) { |
| 152 if (details.is_add && !called_registered_extension_command_ && | 152 if (details.is_add && !called_registered_extension_command_ && |
| 153 GetFocusManager()) { | 153 GetFocusManager()) { |
| 154 MaybeRegisterExtensionCommand(); | 154 MaybeRegisterExtensionCommand(); |
| 155 called_registered_extension_command_ = true; | 155 called_registered_extension_command_ = true; |
| 156 } | 156 } |
| 157 | 157 |
| 158 MenuButton::ViewHierarchyChanged(details); | 158 MenuButton::ViewHierarchyChanged(details); |
| 159 } | 159 } |
| 160 | 160 |
| 161 void BrowserActionButton::OnDragDone() { | |
| 162 delegate_->OnBrowserActionViewDragDone(); | |
| 163 } | |
| 164 | |
| 165 bool BrowserActionButton::CanHandleAccelerators() const { | 161 bool BrowserActionButton::CanHandleAccelerators() const { |
| 166 // View::CanHandleAccelerators() checks to see if the view is visible before | 162 // View::CanHandleAccelerators() checks to see if the view is visible before |
| 167 // allowing it to process accelerators. This is not appropriate for browser | 163 // allowing it to process accelerators. This is not appropriate for browser |
| 168 // actions buttons, which can be hidden inside the overflow area. | 164 // actions buttons, which can be hidden inside the overflow area. |
| 169 return true; | 165 return true; |
| 170 } | 166 } |
| 171 | 167 |
| 172 void BrowserActionButton::GetAccessibleState(ui::AXViewState* state) { | 168 void BrowserActionButton::GetAccessibleState(ui::AXViewState* state) { |
| 173 views::MenuButton::GetAccessibleState(state); | 169 views::MenuButton::GetAccessibleState(state); |
| 174 state->role = ui::AX_ROLE_BUTTON; | 170 state->role = ui::AX_ROLE_BUTTON; |
| (...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 449 extensions::Command browser_action_command; | 445 extensions::Command browser_action_command; |
| 450 if (!only_if_active || !command_service->GetBrowserActionCommand( | 446 if (!only_if_active || !command_service->GetBrowserActionCommand( |
| 451 extension_->id(), | 447 extension_->id(), |
| 452 extensions::CommandService::ACTIVE_ONLY, | 448 extensions::CommandService::ACTIVE_ONLY, |
| 453 &browser_action_command, | 449 &browser_action_command, |
| 454 NULL)) { | 450 NULL)) { |
| 455 GetFocusManager()->UnregisterAccelerator(*keybinding_.get(), this); | 451 GetFocusManager()->UnregisterAccelerator(*keybinding_.get(), this); |
| 456 keybinding_.reset(NULL); | 452 keybinding_.reset(NULL); |
| 457 } | 453 } |
| 458 } | 454 } |
| OLD | NEW |