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

Side by Side Diff: chrome/browser/web_applications/web_app.cc

Issue 399045: Set prop app id for chromium/application shortcut. (Closed)
Patch Set: more for hbono Created 11 years, 1 month 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 (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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/web_applications/web_app.h" 5 #include "chrome/browser/web_applications/web_app.h"
6 6
7 #include "base/file_util.h" 7 #include "base/file_util.h"
8 #include "base/message_loop.h" 8 #include "base/message_loop.h"
9 #include "base/path_service.h" 9 #include "base/path_service.h"
10 #include "base/thread.h" 10 #include "base/thread.h"
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after
262 bool success = true; 262 bool success = true;
263 for (size_t i = 0; i < shortcut_paths.size(); ++i) { 263 for (size_t i = 0; i < shortcut_paths.size(); ++i) {
264 FilePath shortcut_file = shortcut_paths[i].Append(file_name). 264 FilePath shortcut_file = shortcut_paths[i].Append(file_name).
265 ReplaceExtension(FILE_PATH_LITERAL(".lnk")); 265 ReplaceExtension(FILE_PATH_LITERAL(".lnk"));
266 success &= file_util::CreateShortcutLink(chrome_exe.c_str(), 266 success &= file_util::CreateShortcutLink(chrome_exe.c_str(),
267 shortcut_file.value().c_str(), 267 shortcut_file.value().c_str(),
268 chrome_folder.c_str(), 268 chrome_folder.c_str(),
269 wide_switchs.c_str(), 269 wide_switchs.c_str(),
270 shortcut_info_.description.c_str(), 270 shortcut_info_.description.c_str(),
271 icon_file.value().c_str(), 271 icon_file.value().c_str(),
272 0); 272 0,
273 web_app::GenerateApplicationNameFromURL(shortcut_info_.url).c_str());
273 } 274 }
274 275
275 if (success && pin_to_taskbar) { 276 if (success && pin_to_taskbar) {
276 // Any shortcut would work for the pinning. We use the first one. 277 // Any shortcut would work for the pinning. We use the first one.
277 FilePath shortcut_file = shortcut_paths[0].Append(file_name). 278 FilePath shortcut_file = shortcut_paths[0].Append(file_name).
278 ReplaceExtension(FILE_PATH_LITERAL(".lnk")); 279 ReplaceExtension(FILE_PATH_LITERAL(".lnk"));
279 success &= file_util::TaskbarPinShortcutLink(shortcut_file.value().c_str()); 280 success &= file_util::TaskbarPinShortcutLink(shortcut_file.value().c_str());
280 } 281 }
281 282
282 return success; 283 return success;
283 #else 284 #else
284 NOTIMPLEMENTED(); 285 NOTIMPLEMENTED();
285 return false; 286 return false;
286 #endif 287 #endif
287 } 288 }
288 289
289 }; // namespace 290 }; // namespace
290 291
291 namespace web_app { 292 namespace web_app {
292 293
294 std::wstring GenerateApplicationNameFromURL(const GURL& url) {
295 std::string t;
296 t.append(url.host());
297 t.append("_");
298 t.append(url.path());
299 return UTF8ToWide(t);
300 }
301
293 void CreateShortcut( 302 void CreateShortcut(
294 const FilePath& data_dir, 303 const FilePath& data_dir,
295 const ShellIntegration::ShortcutInfo& shortcut_info, 304 const ShellIntegration::ShortcutInfo& shortcut_info,
296 CreateShortcutCallback* callback) { 305 CreateShortcutCallback* callback) {
297 g_browser_process->file_thread()->message_loop()->PostTask(FROM_HERE, 306 g_browser_process->file_thread()->message_loop()->PostTask(FROM_HERE,
298 new CreateShortcutTask(data_dir, shortcut_info, callback)); 307 new CreateShortcutTask(data_dir, shortcut_info, callback));
299 } 308 }
300 309
301 }; // namespace web_app 310 }; // namespace web_app
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698