| 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 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 209 } | 209 } |
| 210 | 210 |
| 211 menu_runner_.reset(); | 211 menu_runner_.reset(); |
| 212 SetButtonNotPushed(); | 212 SetButtonNotPushed(); |
| 213 context_menu_ = NULL; | 213 context_menu_ = NULL; |
| 214 } | 214 } |
| 215 | 215 |
| 216 void BrowserActionButton::OnImageLoaded(const gfx::Image& image, | 216 void BrowserActionButton::OnImageLoaded(const gfx::Image& image, |
| 217 const std::string& extension_id, | 217 const std::string& extension_id, |
| 218 int index) { | 218 int index) { |
| 219 browser_action_->CacheIcon(browser_action_->default_icon_path(), image); | 219 browser_action_->CacheIcon(image); |
| 220 | 220 |
| 221 // Call back to UpdateState() because a more specific icon might have been set | 221 // Call back to UpdateState() because a more specific icon might have been set |
| 222 // while the load was outstanding. | 222 // while the load was outstanding. |
| 223 UpdateState(); | 223 UpdateState(); |
| 224 } | 224 } |
| 225 | 225 |
| 226 void BrowserActionButton::UpdateState() { | 226 void BrowserActionButton::UpdateState() { |
| 227 int tab_id = delegate_->GetCurrentTabId(); | 227 int tab_id = delegate_->GetCurrentTabId(); |
| 228 if (tab_id < 0) | 228 if (tab_id < 0) |
| 229 return; | 229 return; |
| (...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 410 | 410 |
| 411 extensions::Command browser_action_command; | 411 extensions::Command browser_action_command; |
| 412 if (!only_if_active || !command_service->GetBrowserActionCommand( | 412 if (!only_if_active || !command_service->GetBrowserActionCommand( |
| 413 extension_->id(), | 413 extension_->id(), |
| 414 extensions::CommandService::ACTIVE_ONLY, | 414 extensions::CommandService::ACTIVE_ONLY, |
| 415 &browser_action_command, | 415 &browser_action_command, |
| 416 NULL)) { | 416 NULL)) { |
| 417 GetFocusManager()->UnregisterAccelerator(*keybinding_.get(), this); | 417 GetFocusManager()->UnregisterAccelerator(*keybinding_.get(), this); |
| 418 } | 418 } |
| 419 } | 419 } |
| OLD | NEW |