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

Side by Side Diff: chrome/browser/ui/web_applications/web_app_ui.cc

Issue 18286004: Move PathExists to base namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 5 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/ui/web_applications/web_app_ui.h" 5 #include "chrome/browser/ui/web_applications/web_app_ui.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/file_util.h" 9 #include "base/file_util.h"
10 #include "base/path_service.h" 10 #include "base/path_service.h"
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after
253 if (!PathService::Get(locations[i].location_id, &path)) { 253 if (!PathService::Get(locations[i].location_id, &path)) {
254 NOTREACHED(); 254 NOTREACHED();
255 continue; 255 continue;
256 } 256 }
257 257
258 if (locations[i].sub_dir != NULL) 258 if (locations[i].sub_dir != NULL)
259 path = path.Append(locations[i].sub_dir); 259 path = path.Append(locations[i].sub_dir);
260 260
261 base::FilePath shortcut_file = path.Append(file_name_). 261 base::FilePath shortcut_file = path.Append(file_name_).
262 ReplaceExtension(FILE_PATH_LITERAL(".lnk")); 262 ReplaceExtension(FILE_PATH_LITERAL(".lnk"));
263 if (file_util::PathExists(shortcut_file)) { 263 if (base::PathExists(shortcut_file)) {
264 shortcut_files_.push_back(shortcut_file); 264 shortcut_files_.push_back(shortcut_file);
265 } 265 }
266 } 266 }
267 } 267 }
268 268
269 void UpdateShortcutWorker::UpdateShortcuts() { 269 void UpdateShortcutWorker::UpdateShortcuts() {
270 BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE, 270 BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE,
271 base::Bind(&UpdateShortcutWorker::UpdateShortcutsOnFileThread, 271 base::Bind(&UpdateShortcutWorker::UpdateShortcutsOnFileThread,
272 base::Unretained(this))); 272 base::Unretained(this)));
273 } 273 }
274 274
275 void UpdateShortcutWorker::UpdateShortcutsOnFileThread() { 275 void UpdateShortcutWorker::UpdateShortcutsOnFileThread() {
276 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); 276 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
277 277
278 base::FilePath web_app_path = web_app::GetWebAppDataDirectory( 278 base::FilePath web_app_path = web_app::GetWebAppDataDirectory(
279 profile_path_, shortcut_info_.extension_id, shortcut_info_.url); 279 profile_path_, shortcut_info_.extension_id, shortcut_info_.url);
280 280
281 // Ensure web_app_path exists. web_app_path could be missing for a legacy 281 // Ensure web_app_path exists. web_app_path could be missing for a legacy
282 // shortcut created by Gears. 282 // shortcut created by Gears.
283 if (!file_util::PathExists(web_app_path) && 283 if (!base::PathExists(web_app_path) &&
284 !file_util::CreateDirectory(web_app_path)) { 284 !file_util::CreateDirectory(web_app_path)) {
285 NOTREACHED(); 285 NOTREACHED();
286 return; 286 return;
287 } 287 }
288 288
289 base::FilePath icon_file = web_app_path.Append(file_name_).ReplaceExtension( 289 base::FilePath icon_file = web_app_path.Append(file_name_).ReplaceExtension(
290 FILE_PATH_LITERAL(".ico")); 290 FILE_PATH_LITERAL(".ico"));
291 web_app::internals::CheckAndSaveIcon(icon_file, shortcut_info_.favicon); 291 web_app::internals::CheckAndSaveIcon(icon_file, shortcut_info_.favicon);
292 292
293 // Update existing shortcuts' description, icon and app id. 293 // Update existing shortcuts' description, icon and app id.
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
483 } 483 }
484 484
485 // |info_list| may still be empty at this point, in which case LoadImage 485 // |info_list| may still be empty at this point, in which case LoadImage
486 // will call the OnImageLoaded callback with an empty image and exit 486 // will call the OnImageLoaded callback with an empty image and exit
487 // immediately. 487 // immediately.
488 extensions::ImageLoader::Get(profile)->LoadImagesAsync(&extension, info_list, 488 extensions::ImageLoader::Get(profile)->LoadImagesAsync(&extension, info_list,
489 base::Bind(&OnImageLoaded, shortcut_info, callback)); 489 base::Bind(&OnImageLoaded, shortcut_info, callback));
490 } 490 }
491 491
492 } // namespace web_app 492 } // namespace web_app
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/extensions/native_app_window_views.cc ('k') | chrome/browser/ui/webui/nacl_ui.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698