Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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/chrome_app_icon.h" | 5 #include "chrome/browser/extensions/chrome_app_icon.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "chrome/browser/extensions/chrome_app_icon_delegate.h" | 9 #include "chrome/browser/extensions/chrome_app_icon_delegate.h" |
| 10 #include "chrome/browser/extensions/extension_util.h" | 10 #include "chrome/browser/extensions/extension_util.h" |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 83 } | 83 } |
| 84 | 84 |
| 85 const Extension* ChromeAppIcon::GetExtension() { | 85 const Extension* ChromeAppIcon::GetExtension() { |
| 86 return ExtensionRegistry::Get(browser_context_) | 86 return ExtensionRegistry::Get(browser_context_) |
| 87 ->GetInstalledExtension(app_id_); | 87 ->GetInstalledExtension(app_id_); |
| 88 } | 88 } |
| 89 | 89 |
| 90 void ChromeAppIcon::Reload() { | 90 void ChromeAppIcon::Reload() { |
| 91 const Extension* extension = GetExtension(); | 91 const Extension* extension = GetExtension(); |
| 92 icon_ = base::MakeUnique<IconImage>( | 92 icon_ = base::MakeUnique<IconImage>( |
| 93 browser_context_, extension, IconsInfo::GetIcons(extension), | 93 browser_context_, extension, |
| 94 extension ? IconsInfo::GetIcons(extension) : ExtensionIconSet(), | |
|
msw
2017/05/23 00:02:28
nit: can IconsInfo::GetIcons just return |g_empty_
khmel
2017/05/23 16:11:43
This might be convenient. Done as recommended.
| |
| 94 resource_size_in_dip_, util::GetDefaultAppIcon(), this); | 95 resource_size_in_dip_, util::GetDefaultAppIcon(), this); |
| 95 UpdateIcon(); | 96 UpdateIcon(); |
| 96 } | 97 } |
| 97 | 98 |
| 98 bool ChromeAppIcon::IsValid() const { | 99 bool ChromeAppIcon::IsValid() const { |
| 99 DCHECK(icon_); | 100 DCHECK(icon_); |
| 100 return icon_->is_valid(); | 101 return icon_->is_valid(); |
| 101 } | 102 } |
| 102 | 103 |
| 103 void ChromeAppIcon::UpdateIcon() { | 104 void ChromeAppIcon::UpdateIcon() { |
| (...skipping 18 matching lines...) Expand all Loading... | |
| 122 | 123 |
| 123 delegate_->OnIconUpdated(this); | 124 delegate_->OnIconUpdated(this); |
| 124 } | 125 } |
| 125 | 126 |
| 126 void ChromeAppIcon::OnExtensionIconImageChanged(IconImage* icon) { | 127 void ChromeAppIcon::OnExtensionIconImageChanged(IconImage* icon) { |
| 127 DCHECK_EQ(icon_.get(), icon); | 128 DCHECK_EQ(icon_.get(), icon); |
| 128 UpdateIcon(); | 129 UpdateIcon(); |
| 129 } | 130 } |
| 130 | 131 |
| 131 } // namespace extensions | 132 } // namespace extensions |
| OLD | NEW |