Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(67)

Side by Side Diff: chrome/browser/extensions/chrome_app_icon.cc

Issue 2900783003: Handle app custom icon via aura::Window property. (Closed)
Patch Set: cleanup Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698