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

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

Issue 9316004: Move common file path related methods between chrome & content to file_util. I reduced the 4 meth... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 8 years, 10 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 #if defined(OS_WIN) 7 #if defined(OS_WIN)
8 #include <shlobj.h> 8 #include <shlobj.h>
9 #endif // defined(OS_WIN) 9 #endif // defined(OS_WIN)
10 10
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after
283 std::wstring app_id = ShellIntegration::GetAppId( 283 std::wstring app_id = ShellIntegration::GetAppId(
284 UTF8ToWide(app_name), profile_path); 284 UTF8ToWide(app_name), profile_path);
285 285
286 FilePath shortcut_to_pin; 286 FilePath shortcut_to_pin;
287 287
288 bool success = true; 288 bool success = true;
289 for (size_t i = 0; i < shortcut_paths.size(); ++i) { 289 for (size_t i = 0; i < shortcut_paths.size(); ++i) {
290 FilePath shortcut_file = shortcut_paths[i].Append(file_name). 290 FilePath shortcut_file = shortcut_paths[i].Append(file_name).
291 ReplaceExtension(FILE_PATH_LITERAL(".lnk")); 291 ReplaceExtension(FILE_PATH_LITERAL(".lnk"));
292 292
293 int unique_number = DownloadFile::GetUniquePathNumber(shortcut_file); 293 int unique_number =
294 file_util::GetUniquePathNumber(shortcut_file, FILE_PATH_LITERAL(""));
294 if (unique_number == -1) { 295 if (unique_number == -1) {
295 success = false; 296 success = false;
296 continue; 297 continue;
297 } else if (unique_number > 0) { 298 } else if (unique_number > 0) {
298 DownloadFile::AppendNumberToPath(&shortcut_file, unique_number); 299 file_util::AppendNumberToPath(&shortcut_file, unique_number);
299 } 300 }
300 301
301 success &= file_util::CreateShortcutLink(chrome_exe.value().c_str(), 302 success &= file_util::CreateShortcutLink(chrome_exe.value().c_str(),
302 shortcut_file.value().c_str(), 303 shortcut_file.value().c_str(),
303 chrome_folder.value().c_str(), 304 chrome_folder.value().c_str(),
304 wide_switches.c_str(), 305 wide_switches.c_str(),
305 description.c_str(), 306 description.c_str(),
306 icon_file.value().c_str(), 307 icon_file.value().c_str(),
307 0, 308 0,
308 app_id.c_str()); 309 app_id.c_str());
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
473 474
474 #if defined(TOOLKIT_USES_GTK) 475 #if defined(TOOLKIT_USES_GTK)
475 std::string GetWMClassFromAppName(std::string app_name) { 476 std::string GetWMClassFromAppName(std::string app_name) {
476 file_util::ReplaceIllegalCharactersInPath(&app_name, '_'); 477 file_util::ReplaceIllegalCharactersInPath(&app_name, '_');
477 TrimString(app_name, "_", &app_name); 478 TrimString(app_name, "_", &app_name);
478 return app_name; 479 return app_name;
479 } 480 }
480 #endif 481 #endif
481 482
482 } // namespace web_app 483 } // namespace web_app
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698