|
24 | 24 | #include "content/nw/src/common/shell_switches.h" |
25 | 25 | #include "content/nw/src/nw_package.h" |
26 | 26 | #include "content/nw/src/nw_shell.h" |
| 27 | +#include "grit/nw_resources.h" |
| 28 | +#include "ui/base/resource/resource_bundle.h" |
27 | 29 | #include "ui/gfx/rect.h" |
28 | 30 |
|
29 | 31 | #if defined(OS_MACOSX) |
@@ -67,7 +69,7 @@ NativeWindow::NativeWindow(content::Shell* shell, |
67 | 69 | has_frame_(true) { |
68 | 70 | manifest->GetBoolean(switches::kmFrame, &has_frame_); |
69 | 71 |
|
70 | | - LoadAppIconFromPackage(); |
| 72 | + LoadAppIconFromPackage(manifest); |
71 | 73 | } |
72 | 74 |
|
73 | 75 | NativeWindow::~NativeWindow() { |
@@ -132,12 +134,17 @@ void NativeWindow::InitFromManifest(base::DictionaryValue* manifest) { |
132 | 134 | Show(); |
133 | 135 | } |
134 | 136 |
|
135 | | -void NativeWindow::LoadAppIconFromPackage() { |
136 | | - nw::Package* package = shell_->GetPackage(); |
| 137 | +void NativeWindow::LoadAppIconFromPackage(base::DictionaryValue* manifest) { |
137 | 138 | std::string path_string; |
138 | | - if (package->window()->GetString(switches::kmIcon, &path_string)) |
139 | | - package->GetImage(FilePath::FromUTF8Unsafe(path_string), |
140 | | - &app_icon_); |
| 139 | + if (manifest->GetString(switches::kmIcon, &path_string)) { |
| 140 | + // Read icon from "icon" field. |
| 141 | + shell_->GetPackage()->GetImage(FilePath::FromUTF8Unsafe(path_string), |
| 142 | + &app_icon_); |
| 143 | + } else { |
| 144 | + // Set default icon. |
| 145 | + app_icon_ = ui::ResourceBundle::GetSharedInstance(). |
| 146 | + GetNativeImageNamed(IDR_NW_DEFAULT_ICON); |
| 147 | + } |
141 | 148 | } |
142 | 149 |
|
143 | 150 | } // namespace nw |
0 commit comments