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

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

Issue 9374009: Install platform apps into a separate data directory (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix comment 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) 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 <Cocoa/Cocoa.h> 5 #import <Cocoa/Cocoa.h>
6 6
7 #include "chrome/browser/web_applications/web_app_mac.h" 7 #include "chrome/browser/web_applications/web_app_mac.h"
8 8
9 #include "base/file_util.h" 9 #include "base/file_util.h"
10 #include "base/mac/bundle_locations.h" 10 #include "base/mac/bundle_locations.h"
11 #include "base/mac/foundation_util.h" 11 #include "base/mac/foundation_util.h"
12 #include "base/scoped_temp_dir.h" 12 #include "base/scoped_temp_dir.h"
13 #include "base/sys_string_conversions.h" 13 #include "base/sys_string_conversions.h"
14 #include "chrome/browser/web_applications/web_app.h" 14 #include "chrome/browser/web_applications/web_app.h"
15 #include "chrome/common/mac/app_mode_common.h" 15 #include "chrome/common/mac/app_mode_common.h"
16 #include "grit/chromium_strings.h" 16 #include "grit/chromium_strings.h"
17 #include "ui/base/l10n/l10n_util_mac.h" 17 #include "ui/base/l10n/l10n_util_mac.h"
18 18
19 namespace web_app { 19 namespace web_app {
20 20
21 WebAppShortcutCreator::WebAppShortcutCreator( 21 WebAppShortcutCreator::WebAppShortcutCreator(
22 const FilePath& web_app_path,
22 const ShellIntegration::ShortcutInfo& shortcut_info) 23 const ShellIntegration::ShortcutInfo& shortcut_info)
23 : info_(shortcut_info) { 24 : web_app_path_(web_app_path), info_(shortcut_info) {
24 } 25 }
25 26
26 WebAppShortcutCreator::~WebAppShortcutCreator() { 27 WebAppShortcutCreator::~WebAppShortcutCreator() {
27 } 28 }
28 29
29 bool WebAppShortcutCreator::CreateShortcut() { 30 bool WebAppShortcutCreator::CreateShortcut() {
30 FilePath app_name = internals::GetSanitizedFileName(info_.title); 31 FilePath app_name = internals::GetSanitizedFileName(info_.title);
31 FilePath app_file_name = app_name.ReplaceExtension("app"); 32 FilePath app_file_name = app_name.ReplaceExtension("app");
32 ScopedTempDir scoped_temp_dir; 33 ScopedTempDir scoped_temp_dir;
33 if (!scoped_temp_dir.CreateUniqueTempDir()) 34 if (!scoped_temp_dir.CreateUniqueTempDir())
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 forKey:app_mode::kCrAppModeShortcutURLKey]; 95 forKey:app_mode::kCrAppModeShortcutURLKey];
95 [dict setObject:base::SysUTF16ToNSString(info_.title) 96 [dict setObject:base::SysUTF16ToNSString(info_.title)
96 forKey:app_mode::kCrAppModeShortcutNameKey]; 97 forKey:app_mode::kCrAppModeShortcutNameKey];
97 [dict setObject:@"Chromium App Mode Loader" 98 [dict setObject:@"Chromium App Mode Loader"
98 forKey:@"CFBundleExecutable"]; 99 forKey:@"CFBundleExecutable"];
99 [dict removeObjectForKey:@"CFBundleDisplayName"]; 100 [dict removeObjectForKey:@"CFBundleDisplayName"];
100 [dict setObject:base::SysUTF16ToNSString(info_.title) 101 [dict setObject:base::SysUTF16ToNSString(info_.title)
101 forKey:@"CFBundleName"]; 102 forKey:@"CFBundleName"];
102 [dict setObject:[base::mac::OuterBundle() bundleIdentifier] 103 [dict setObject:[base::mac::OuterBundle() bundleIdentifier]
103 forKey:app_mode::kBrowserBundleIDKey]; 104 forKey:app_mode::kBrowserBundleIDKey];
105 [dict setObject:base::mac::FilePathToNSString(web_app_path_)
106 forKey:app_mode::kCrAppModeUserDataDirKey];
Robert Sesek 2012/02/09 18:43:59 nit: align colons
sail 2012/02/10 00:13:18 Done.
104 return [dict writeToFile:plist_path atomically:NO]; 107 return [dict writeToFile:plist_path atomically:NO];
105 } 108 }
106 109
107 bool WebAppShortcutCreator::UpdateIcon(const FilePath& app_path) const { 110 bool WebAppShortcutCreator::UpdateIcon(const FilePath& app_path) const {
108 // TODO:(sail) Need to implement this. 111 // TODO:(sail) Need to implement this.
109 return true; 112 return true;
110 } 113 }
111 114
112 namespace internals { 115 namespace internals {
113 116
114 void CreateShortcutTask(const FilePath& web_app_path, 117 void CreateShortcutTask(const FilePath& web_app_path,
115 const FilePath& profile_path, 118 const FilePath& profile_path,
116 const ShellIntegration::ShortcutInfo& shortcut_info) { 119 const ShellIntegration::ShortcutInfo& shortcut_info) {
117 WebAppShortcutCreator shortcut_creator(shortcut_info); 120 WebAppShortcutCreator shortcut_creator(web_app_path, shortcut_info);
118 shortcut_creator.CreateShortcut(); 121 shortcut_creator.CreateShortcut();
119 } 122 }
120 123
121 } // namespace internals 124 } // namespace internals
122 125
123 } // namespace web_app 126 } // namespace web_app
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698