Enable setting icon for addUserTasks

This commit is contained in:
Cheng Zhao 2014-11-17 17:35:51 +08:00
parent 0db2769781
commit 0b1b0940d2
3 changed files with 12 additions and 0 deletions

View file

@ -35,6 +35,7 @@ using atom::Browser;
namespace mate {
#if defined(OS_WIN)
template<>
struct Converter<Browser::UserTask> {
static bool FromV8(v8::Isolate* isolate, v8::Handle<v8::Value> val,
@ -45,11 +46,15 @@ struct Converter<Browser::UserTask> {
if (!dict.Get("program", &(out->program)) ||
!dict.Get("title", &(out->title)))
return false;
if (dict.Get("iconPath", &(out->icon_path)) &&
!dict.Get("iconIndex", &(out->icon_index)))
return false;
dict.Get("arguments", &(out->arguments));
dict.Get("description", &(out->description));
return true;
}
};
#endif
} // namespace mate

View file

@ -91,6 +91,8 @@ class Browser : public WindowListObserver {
base::string16 arguments;
base::string16 title;
base::string16 description;
base::FilePath icon_path;
int icon_index;
};
// Add a custom task to jump list.

View file

@ -96,6 +96,11 @@ void Browser::AddUserTasks(const std::vector<UserTask>& tasks) {
FAILED(link->SetDescription(task.description.c_str())))
return;
if (!task.icon_path.empty() &&
FAILED(link->SetIconLocation(task.icon_path.value().c_str(),
task.icon_index)))
return;
CComQIPtr<IPropertyStore> property_store = link;
if (!base::win::SetStringValueForPropertyStore(property_store, PKEY_Title,
task.title.c_str()))