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

Side by Side Diff: chrome/browser/web_applications/web_app_mac.mm

Issue 12294008: Fix more remaining FilePath -> base::FilePath. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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) 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 #import "chrome/browser/web_applications/web_app_mac.h" 5 #import "chrome/browser/web_applications/web_app_mac.h"
6 6
7 #import <Cocoa/Cocoa.h> 7 #import <Cocoa/Cocoa.h>
8 8
9 #include "base/file_util.h" 9 #include "base/file_util.h"
10 #include "base/files/scoped_temp_dir.h" 10 #include "base/files/scoped_temp_dir.h"
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after
251 selectFile:base::mac::FilePathToNSString(generated_bundle) 251 selectFile:base::mac::FilePathToNSString(generated_bundle)
252 inFileViewerRootedAtPath:nil]; 252 inFileViewerRootedAtPath:nil];
253 } 253 }
254 254
255 } // namespace 255 } // namespace
256 256
257 namespace web_app { 257 namespace web_app {
258 258
259 namespace internals { 259 namespace internals {
260 260
261 FilePath GetAppBundleByExtensionId(std::string extension_id) { 261 base::FilePath GetAppBundleByExtensionId(std::string extension_id) {
262 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::FILE)); 262 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::FILE));
263 // This matches APP_MODE_APP_BUNDLE_ID in chrome/chrome.gyp. 263 // This matches APP_MODE_APP_BUNDLE_ID in chrome/chrome.gyp.
264 std::string bundle_id = 264 std::string bundle_id =
265 base::mac::BaseBundleID() + std::string(".app.") + extension_id; 265 base::mac::BaseBundleID() + std::string(".app.") + extension_id;
266 base::mac::ScopedCFTypeRef<CFStringRef> bundle_id_cf( 266 base::mac::ScopedCFTypeRef<CFStringRef> bundle_id_cf(
267 base::SysUTF8ToCFStringRef(bundle_id)); 267 base::SysUTF8ToCFStringRef(bundle_id));
268 CFURLRef url_ref = NULL; 268 CFURLRef url_ref = NULL;
269 OSStatus status = LSFindApplicationForInfo( 269 OSStatus status = LSFindApplicationForInfo(
270 kLSUnknownCreator, bundle_id_cf.get(), NULL, NULL, &url_ref); 270 kLSUnknownCreator, bundle_id_cf.get(), NULL, NULL, &url_ref);
271 base::mac::ScopedCFTypeRef<CFURLRef> url(url_ref); 271 base::mac::ScopedCFTypeRef<CFURLRef> url(url_ref);
272 272
273 if (status != noErr) 273 if (status != noErr)
274 return FilePath(); 274 return base::FilePath();
275 275
276 NSString* path_string = [base::mac::CFToNSCast(url.get()) path]; 276 NSString* path_string = [base::mac::CFToNSCast(url.get()) path];
277 return FilePath([path_string fileSystemRepresentation]); 277 return base::FilePath([path_string fileSystemRepresentation]);
278 } 278 }
279 279
280 bool CreatePlatformShortcuts( 280 bool CreatePlatformShortcuts(
281 const base::FilePath& web_app_path, 281 const base::FilePath& web_app_path,
282 const ShellIntegration::ShortcutInfo& shortcut_info) { 282 const ShellIntegration::ShortcutInfo& shortcut_info) {
283 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::FILE)); 283 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::FILE));
284 string16 bundle_id = UTF8ToUTF16(base::mac::BaseBundleID()); 284 string16 bundle_id = UTF8ToUTF16(base::mac::BaseBundleID());
285 WebAppShortcutCreator shortcut_creator(web_app_path, shortcut_info, 285 WebAppShortcutCreator shortcut_creator(web_app_path, shortcut_info,
286 bundle_id); 286 bundle_id);
287 return shortcut_creator.CreateShortcut(); 287 return shortcut_creator.CreateShortcut();
288 } 288 }
289 289
290 void DeletePlatformShortcuts( 290 void DeletePlatformShortcuts(
291 const base::FilePath& web_app_path, 291 const base::FilePath& web_app_path,
292 const ShellIntegration::ShortcutInfo& info) { 292 const ShellIntegration::ShortcutInfo& info) {
293 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::FILE)); 293 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::FILE));
294 294
295 FilePath bundle_path = GetAppBundleByExtensionId(info.extension_id); 295 base::FilePath bundle_path = GetAppBundleByExtensionId(info.extension_id);
296 file_util::Delete(bundle_path, true); 296 file_util::Delete(bundle_path, true);
297 } 297 }
298 298
299 void UpdatePlatformShortcuts( 299 void UpdatePlatformShortcuts(
300 const base::FilePath& web_app_path, 300 const base::FilePath& web_app_path,
301 const ShellIntegration::ShortcutInfo& shortcut_info) { 301 const ShellIntegration::ShortcutInfo& shortcut_info) {
302 // TODO(benwells): Implement this when shortcuts / weblings are enabled on 302 // TODO(benwells): Implement this when shortcuts / weblings are enabled on
303 // mac. 303 // mac.
304 } 304 }
305 305
306 } // namespace internals 306 } // namespace internals
307 307
308 } // namespace web_app 308 } // namespace web_app
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698