Chromium Code Reviews| Index: chrome/browser/web_applications/web_app_mac.mm |
| diff --git a/chrome/browser/web_applications/web_app_mac.mm b/chrome/browser/web_applications/web_app_mac.mm |
| index 02f3f0dc7c14ead4c29c6e2e6b3ff23c5122760f..862c19f1e67aa4404cdf26a43c4b92085649d614 100644 |
| --- a/chrome/browser/web_applications/web_app_mac.mm |
| +++ b/chrome/browser/web_applications/web_app_mac.mm |
| @@ -16,6 +16,7 @@ |
| #include "base/mac/mac_util.h" |
| #include "base/mac/scoped_cftyperef.h" |
| #include "base/mac/scoped_nsobject.h" |
| +#include "base/metrics/histogram.h" |
| #include "base/path_service.h" |
| #include "base/process/process_handle.h" |
| #include "base/strings/string16.h" |
| @@ -57,6 +58,17 @@ namespace { |
| // Launch Services Key to run as an agent app, which doesn't launch in the dock. |
| NSString* const kLSUIElement = @"LSUIElement"; |
| +// When a --app-shim-error is triggered, this is used to record the version of |
| +// the app shim. These are chosen to track the change from 32-bit to 64-bit. |
| +// Order must be maintained as this is used in UMA. |
| +enum AppShimError { |
| + APP_SHIM_ERROR_UNKNOWN, |
| + APP_SHIM_ERROR_37_OR_LOWER, |
| + APP_SHIM_ERROR_38, |
| + APP_SHIM_ERROR_39_OR_HIGHER, |
| + APP_SHIM_ERROR_COUNT, |
| +}; |
| + |
| class ScopedCarbonHandle { |
| public: |
| ScopedCarbonHandle(size_t initial_size) : handle_(NewHandle(initial_size)) { |
| @@ -496,6 +508,27 @@ web_app::ShortcutInfo BuildShortcutInfoFromBundle( |
| return shortcut_info; |
| } |
| +web_app::ShortcutInfo RecordAppShimErrorAndBuildShortcutInfo( |
| + const base::FilePath& bundle_path) { |
| + NSDictionary* plist = ReadPlist(GetPlistPath(bundle_path)); |
| + int version = [[[[plist valueForKey:app_mode::kCFBundleShortVersionStringKey] |
|
Robert Sesek
2014/07/01 14:10:39
May want to use base/version.h.
jackhou1
2014/07/02 03:18:12
Done.
|
| + componentsSeparatedByString:@"."] objectAtIndex:0] intValue]; |
| + AppShimError error_enum; |
| + if (version < 38) |
|
tapted
2014/07/01 12:48:11
probably needs `version > 0 &&..` here so the unkn
jackhou1
2014/07/02 03:18:12
Done.
|
| + error_enum = APP_SHIM_ERROR_37_OR_LOWER; |
| + else if (version == 38) |
| + error_enum = APP_SHIM_ERROR_38; |
| + else if (version > 38) |
| + error_enum = APP_SHIM_ERROR_39_OR_HIGHER; |
| + else |
| + error_enum = APP_SHIM_ERROR_UNKNOWN; |
| + UMA_HISTOGRAM_ENUMERATION("Apps.AppShimError", |
|
Robert Sesek
2014/07/01 14:10:39
Would it make more sense to just histogram the |ve
jackhou1
2014/07/02 03:18:11
Done.
|
| + error_enum, |
| + APP_SHIM_ERROR_COUNT); |
| + |
| + return BuildShortcutInfoFromBundle(bundle_path); |
| +} |
| + |
| void UpdateFileTypes(NSMutableDictionary* plist, |
| const extensions::FileHandlersInfo& file_handlers_info) { |
| NSMutableArray* document_types = |
| @@ -939,7 +972,7 @@ bool MaybeRebuildShortcut(const CommandLine& command_line) { |
| base::PostTaskAndReplyWithResult( |
| content::BrowserThread::GetBlockingPool(), |
| FROM_HERE, |
| - base::Bind(&BuildShortcutInfoFromBundle, |
| + base::Bind(&RecordAppShimErrorAndBuildShortcutInfo, |
| command_line.GetSwitchValuePath(app_mode::kAppShimError)), |
| base::Bind(&RebuildAppAndLaunch)); |
| return true; |