| 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" |
| 11 | 11 |
| 12 using extensions::Extension; | 12 using extensions::Extension; |
| 13 using extensions::IconImage; | 13 using extensions::IconImage; |
| 14 | 14 |
| 15 ExtensionActionIconFactory::ExtensionActionIconFactory( | 15 ExtensionActionIconFactory::ExtensionActionIconFactory( |
| 16 Profile* profile, | 16 Profile* profile, |
| 17 const Extension* extension, | 17 const Extension* extension, |
| 18 ExtensionAction* action, | 18 ExtensionAction* action, |
| 19 Observer* observer) | 19 Observer* observer) |
| 20 : extension_(extension), | 20 : action_(action), observer_(observer), icon_image_observer_(this) { |
| 21 action_(action), | |
| 22 observer_(observer), | |
| 23 icon_image_observer_(this) { | |
| 24 extensions::IconImage* default_icon_image = | 21 extensions::IconImage* default_icon_image = |
| 25 action->LoadDefaultIconImage(*extension, profile); | 22 action->LoadDefaultIconImage(*extension, profile); |
| 26 if (default_icon_image) | 23 if (default_icon_image) |
| 27 icon_image_observer_.Add(default_icon_image); | 24 icon_image_observer_.Add(default_icon_image); |
| 28 } | 25 } |
| 29 | 26 |
| 30 ExtensionActionIconFactory::~ExtensionActionIconFactory() {} | 27 ExtensionActionIconFactory::~ExtensionActionIconFactory() {} |
| 31 | 28 |
| 32 // extensions::IconImage::Observer overrides. | 29 // extensions::IconImage::Observer overrides. |
| 33 void ExtensionActionIconFactory::OnExtensionIconImageChanged(IconImage* image) { | 30 void ExtensionActionIconFactory::OnExtensionIconImageChanged(IconImage* image) { |
| (...skipping 10 matching lines...) Expand all Loading... |
| 44 gfx::Image icon = action_->GetExplicitlySetIcon(tab_id); | 41 gfx::Image icon = action_->GetExplicitlySetIcon(tab_id); |
| 45 if (!icon.IsEmpty()) | 42 if (!icon.IsEmpty()) |
| 46 return icon; | 43 return icon; |
| 47 | 44 |
| 48 icon = action_->GetDeclarativeIcon(tab_id); | 45 icon = action_->GetDeclarativeIcon(tab_id); |
| 49 if (!icon.IsEmpty()) | 46 if (!icon.IsEmpty()) |
| 50 return icon; | 47 return icon; |
| 51 | 48 |
| 52 return action_->GetDefaultIconImage(); | 49 return action_->GetDefaultIconImage(); |
| 53 } | 50 } |
| OLD | NEW |