| 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 |
| 161 bool BrowserActionButton::CanHandleAccelerators() const { | 165 bool BrowserActionButton::CanHandleAccelerators() const { |
| 162 // View::CanHandleAccelerators() checks to see if the view is visible before | 166 // View::CanHandleAccelerators() checks to see if the view is visible before |
| 163 // allowing it to process accelerators. This is not appropriate for browser | 167 // allowing it to process accelerators. This is not appropriate for browser |
| 164 // actions buttons, which can be hidden inside the overflow area. | 168 // actions buttons, which can be hidden inside the overflow area. |
| 165 return true; | 169 return true; |
| 166 } | 170 } |
| 167 | 171 |
| 168 void BrowserActionButton::GetAccessibleState(ui::AXViewState* state) { | 172 void BrowserActionButton::GetAccessibleState(ui::AXViewState* state) { |
| 169 views::MenuButton::GetAccessibleState(state); | 173 views::MenuButton::GetAccessibleState(state); |
| 170 state->role = ui::AX_ROLE_BUTTON; | 174 state->role = ui::AX_ROLE_BUTTON; |
| (...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 445 extensions::Command browser_action_command; | 449 extensions::Command browser_action_command; |
| 446 if (!only_if_active || !command_service->GetBrowserActionCommand( | 450 if (!only_if_active || !command_service->GetBrowserActionCommand( |
| 447 extension_->id(), | 451 extension_->id(), |
| 448 extensions::CommandService::ACTIVE_ONLY, | 452 extensions::CommandService::ACTIVE_ONLY, |
| 449 &browser_action_command, | 453 &browser_action_command, |
| 450 NULL)) { | 454 NULL)) { |
| 451 GetFocusManager()->UnregisterAccelerator(*keybinding_.get(), this); | 455 GetFocusManager()->UnregisterAccelerator(*keybinding_.get(), this); |
| 452 keybinding_.reset(NULL); | 456 keybinding_.reset(NULL); |
| 453 } | 457 } |
| 454 } | 458 } |
| OLD | NEW |