| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/browser_action_view.h" | 5 #include "chrome/browser/ui/views/browser_action_view.h" |
| 6 | 6 |
| 7 #include "base/utf_string_conversions.h" | 7 #include "base/utf_string_conversions.h" |
| 8 #include "chrome/browser/extensions/api/commands/command_service.h" | 8 #include "chrome/browser/extensions/api/commands/command_service.h" |
| 9 #include "chrome/browser/extensions/api/commands/command_service_factory.h" | 9 #include "chrome/browser/extensions/api/commands/command_service_factory.h" |
| 10 #include "chrome/browser/extensions/extension_context_menu_model.h" | 10 #include "chrome/browser/extensions/extension_context_menu_model.h" |
| (...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 371 | 371 |
| 372 void BrowserActionButton::SetButtonNotPushed() { | 372 void BrowserActionButton::SetButtonNotPushed() { |
| 373 SetState(views::CustomButton::BS_NORMAL); | 373 SetState(views::CustomButton::BS_NORMAL); |
| 374 menu_visible_ = false; | 374 menu_visible_ = false; |
| 375 } | 375 } |
| 376 | 376 |
| 377 bool BrowserActionButton::IsEnabled(int tab_id) const { | 377 bool BrowserActionButton::IsEnabled(int tab_id) const { |
| 378 return browser_action_->GetIsVisible(tab_id); | 378 return browser_action_->GetIsVisible(tab_id); |
| 379 } | 379 } |
| 380 | 380 |
| 381 gfx::ImageSkia BrowserActionButton::GetIconForTest() { |
| 382 return icon(); |
| 383 } |
| 384 |
| 381 BrowserActionButton::~BrowserActionButton() { | 385 BrowserActionButton::~BrowserActionButton() { |
| 382 } | 386 } |
| 383 | 387 |
| 384 void BrowserActionButton::MaybeRegisterExtensionCommand() { | 388 void BrowserActionButton::MaybeRegisterExtensionCommand() { |
| 385 extensions::CommandService* command_service = | 389 extensions::CommandService* command_service = |
| 386 extensions::CommandServiceFactory::GetForProfile(browser_->profile()); | 390 extensions::CommandServiceFactory::GetForProfile(browser_->profile()); |
| 387 extensions::Command browser_action_command; | 391 extensions::Command browser_action_command; |
| 388 if (command_service->GetBrowserActionCommand( | 392 if (command_service->GetBrowserActionCommand( |
| 389 extension_->id(), | 393 extension_->id(), |
| 390 extensions::CommandService::ACTIVE_ONLY, | 394 extensions::CommandService::ACTIVE_ONLY, |
| (...skipping 15 matching lines...) Expand all Loading... |
| 406 | 410 |
| 407 extensions::Command browser_action_command; | 411 extensions::Command browser_action_command; |
| 408 if (!only_if_active || !command_service->GetBrowserActionCommand( | 412 if (!only_if_active || !command_service->GetBrowserActionCommand( |
| 409 extension_->id(), | 413 extension_->id(), |
| 410 extensions::CommandService::ACTIVE_ONLY, | 414 extensions::CommandService::ACTIVE_ONLY, |
| 411 &browser_action_command, | 415 &browser_action_command, |
| 412 NULL)) { | 416 NULL)) { |
| 413 GetFocusManager()->UnregisterAccelerator(*keybinding_.get(), this); | 417 GetFocusManager()->UnregisterAccelerator(*keybinding_.get(), this); |
| 414 } | 418 } |
| 415 } | 419 } |
| OLD | NEW |