| 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/extensions/extension_action_icon_factory.h" | 5 #include "chrome/browser/extensions/extension_action_icon_factory.h" |
| 6 | 6 |
| 7 #include "chrome/browser/extensions/extension_action.h" | 7 #include "chrome/browser/extensions/extension_action.h" |
| 8 #include "chrome/browser/profiles/profile.h" | 8 #include "chrome/browser/profiles/profile.h" |
| 9 #include "ui/gfx/image/image.h" | 9 #include "ui/gfx/image/image.h" |
| 10 #include "ui/gfx/image/image_skia.h" | 10 #include "ui/gfx/image/image_skia.h" |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 if (observer_) | 34 if (observer_) |
| 35 observer_->OnIconUpdated(); | 35 observer_->OnIconUpdated(); |
| 36 } | 36 } |
| 37 | 37 |
| 38 void ExtensionActionIconFactory::OnExtensionIconImageDestroyed( | 38 void ExtensionActionIconFactory::OnExtensionIconImageDestroyed( |
| 39 IconImage* image) { | 39 IconImage* image) { |
| 40 icon_image_observer_.RemoveAll(); | 40 icon_image_observer_.RemoveAll(); |
| 41 } | 41 } |
| 42 | 42 |
| 43 gfx::Image ExtensionActionIconFactory::GetIcon(int tab_id) { | 43 gfx::Image ExtensionActionIconFactory::GetIcon(int tab_id) { |
| 44 return gfx::Image(GetBaseIconFromAction(tab_id)); | 44 gfx::Image icon = action_->GetExplicitlySetIcon(tab_id); |
| 45 } | 45 if (!icon.IsEmpty()) |
| 46 | |
| 47 gfx::ImageSkia ExtensionActionIconFactory::GetBaseIconFromAction(int tab_id) { | |
| 48 gfx::ImageSkia icon = action_->GetExplicitlySetIcon(tab_id); | |
| 49 if (!icon.isNull()) | |
| 50 return icon; | 46 return icon; |
| 51 | 47 |
| 52 icon = action_->GetDeclarativeIcon(tab_id); | 48 icon = action_->GetDeclarativeIcon(tab_id); |
| 53 if (!icon.isNull()) | 49 if (!icon.IsEmpty()) |
| 54 return icon; | 50 return icon; |
| 55 | 51 |
| 56 return action_->GetDefaultIconImage(); | 52 return action_->GetDefaultIconImage(); |
| 57 } | 53 } |
| OLD | NEW |