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

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

Issue 1095763003: [chrome/browser/web_applications] favor DCHECK_CURRENTLY_ON for better logs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 8 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
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 <Carbon/Carbon.h> 7 #import <Carbon/Carbon.h>
8 #import <Cocoa/Cocoa.h> 8 #import <Cocoa/Cocoa.h>
9 9
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 DCHECK(!user_data_dir.empty()); 214 DCHECK(!user_data_dir.empty());
215 return StartsWithASCII( 215 return StartsWithASCII(
216 base::SysNSStringToUTF8( 216 base::SysNSStringToUTF8(
217 [plist valueForKey:app_mode::kCrAppModeUserDataDirKey]), 217 [plist valueForKey:app_mode::kCrAppModeUserDataDirKey]),
218 user_data_dir.value(), 218 user_data_dir.value(),
219 true /* case_sensitive */); 219 true /* case_sensitive */);
220 } 220 }
221 221
222 void LaunchShimOnFileThread(scoped_ptr<web_app::ShortcutInfo> shortcut_info, 222 void LaunchShimOnFileThread(scoped_ptr<web_app::ShortcutInfo> shortcut_info,
223 bool launched_after_rebuild) { 223 bool launched_after_rebuild) {
224 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::FILE)); 224 DCHECK_CURRENTLY_ON(content::BrowserThread::FILE);
225 base::FilePath shim_path = web_app::GetAppInstallPath(*shortcut_info); 225 base::FilePath shim_path = web_app::GetAppInstallPath(*shortcut_info);
226 226
227 if (shim_path.empty() || 227 if (shim_path.empty() ||
228 !base::PathExists(shim_path) || 228 !base::PathExists(shim_path) ||
229 !HasSameUserDataDir(shim_path)) { 229 !HasSameUserDataDir(shim_path)) {
230 // The user may have deleted the copy in the Applications folder, use the 230 // The user may have deleted the copy in the Applications folder, use the
231 // one in the web app's |app_data_dir_|. 231 // one in the web app's |app_data_dir_|.
232 base::FilePath app_data_dir = web_app::GetWebAppDataDirectory( 232 base::FilePath app_data_dir = web_app::GetWebAppDataDirectory(
233 shortcut_info->profile_path, shortcut_info->extension_id, GURL()); 233 shortcut_info->profile_path, shortcut_info->extension_id, GURL());
234 shim_path = app_data_dir.Append(shim_path.BaseName()); 234 shim_path = app_data_dir.Append(shim_path.BaseName());
(...skipping 16 matching lines...) Expand all
251 base::FilePath GetAppLoaderPath() { 251 base::FilePath GetAppLoaderPath() {
252 return base::mac::PathForFrameworkBundleResource( 252 return base::mac::PathForFrameworkBundleResource(
253 base::mac::NSToCFCast(@"app_mode_loader.app")); 253 base::mac::NSToCFCast(@"app_mode_loader.app"));
254 } 254 }
255 255
256 void UpdatePlatformShortcutsInternal( 256 void UpdatePlatformShortcutsInternal(
257 const base::FilePath& app_data_path, 257 const base::FilePath& app_data_path,
258 const base::string16& old_app_title, 258 const base::string16& old_app_title,
259 const web_app::ShortcutInfo& shortcut_info, 259 const web_app::ShortcutInfo& shortcut_info,
260 const extensions::FileHandlersInfo& file_handlers_info) { 260 const extensions::FileHandlersInfo& file_handlers_info) {
261 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::FILE)); 261 DCHECK_CURRENTLY_ON(content::BrowserThread::FILE);
262 if (AppShimsDisabledForTest() && 262 if (AppShimsDisabledForTest() &&
263 !g_app_shims_allow_update_and_launch_in_tests) { 263 !g_app_shims_allow_update_and_launch_in_tests) {
264 return; 264 return;
265 } 265 }
266 266
267 web_app::WebAppShortcutCreator shortcut_creator(app_data_path, &shortcut_info, 267 web_app::WebAppShortcutCreator shortcut_creator(app_data_path, &shortcut_info,
268 file_handlers_info); 268 file_handlers_info);
269 shortcut_creator.UpdateShortcuts(); 269 shortcut_creator.UpdateShortcuts();
270 } 270 }
271 271
(...skipping 874 matching lines...) Expand 10 before | Expand all | Expand 10 after
1146 } 1146 }
1147 1147
1148 namespace internals { 1148 namespace internals {
1149 1149
1150 bool CreatePlatformShortcuts( 1150 bool CreatePlatformShortcuts(
1151 const base::FilePath& app_data_path, 1151 const base::FilePath& app_data_path,
1152 scoped_ptr<ShortcutInfo> shortcut_info, 1152 scoped_ptr<ShortcutInfo> shortcut_info,
1153 const extensions::FileHandlersInfo& file_handlers_info, 1153 const extensions::FileHandlersInfo& file_handlers_info,
1154 const ShortcutLocations& creation_locations, 1154 const ShortcutLocations& creation_locations,
1155 ShortcutCreationReason creation_reason) { 1155 ShortcutCreationReason creation_reason) {
1156 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::FILE)); 1156 DCHECK_CURRENTLY_ON(content::BrowserThread::FILE);
1157 if (AppShimsDisabledForTest()) 1157 if (AppShimsDisabledForTest())
1158 return true; 1158 return true;
1159 1159
1160 WebAppShortcutCreator shortcut_creator(app_data_path, shortcut_info.get(), 1160 WebAppShortcutCreator shortcut_creator(app_data_path, shortcut_info.get(),
1161 file_handlers_info); 1161 file_handlers_info);
1162 return shortcut_creator.CreateShortcuts(creation_reason, creation_locations); 1162 return shortcut_creator.CreateShortcuts(creation_reason, creation_locations);
1163 } 1163 }
1164 1164
1165 void DeletePlatformShortcuts(const base::FilePath& app_data_path, 1165 void DeletePlatformShortcuts(const base::FilePath& app_data_path,
1166 scoped_ptr<ShortcutInfo> shortcut_info) { 1166 scoped_ptr<ShortcutInfo> shortcut_info) {
1167 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::FILE)); 1167 DCHECK_CURRENTLY_ON(content::BrowserThread::FILE);
1168 WebAppShortcutCreator shortcut_creator(app_data_path, shortcut_info.get(), 1168 WebAppShortcutCreator shortcut_creator(app_data_path, shortcut_info.get(),
1169 extensions::FileHandlersInfo()); 1169 extensions::FileHandlersInfo());
1170 shortcut_creator.DeleteShortcuts(); 1170 shortcut_creator.DeleteShortcuts();
1171 } 1171 }
1172 1172
1173 void UpdatePlatformShortcuts( 1173 void UpdatePlatformShortcuts(
1174 const base::FilePath& app_data_path, 1174 const base::FilePath& app_data_path,
1175 const base::string16& old_app_title, 1175 const base::string16& old_app_title,
1176 scoped_ptr<ShortcutInfo> shortcut_info, 1176 scoped_ptr<ShortcutInfo> shortcut_info,
1177 const extensions::FileHandlersInfo& file_handlers_info) { 1177 const extensions::FileHandlersInfo& file_handlers_info) {
(...skipping 30 matching lines...) Expand all
1208 web_app::GetShortcutInfoForApp( 1208 web_app::GetShortcutInfoForApp(
1209 app, 1209 app,
1210 profile, 1210 profile,
1211 base::Bind(&web_app::CreateAppShortcutInfoLoaded, 1211 base::Bind(&web_app::CreateAppShortcutInfoLoaded,
1212 profile, 1212 profile,
1213 app, 1213 app,
1214 close_callback)); 1214 close_callback));
1215 } 1215 }
1216 1216
1217 } // namespace chrome 1217 } // namespace chrome
OLDNEW
« no previous file with comments | « chrome/browser/web_applications/web_app_linux.cc ('k') | chrome/browser/web_applications/web_app_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698