| 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 1c467079d783e9788d418d0471d413cfa1770edc..4b750759d8dbc91a7ce468a81fad8fd6616a9299 100644
|
| --- a/chrome/browser/web_applications/web_app_mac.mm
|
| +++ b/chrome/browser/web_applications/web_app_mac.mm
|
| @@ -214,9 +214,8 @@ bool HasSameUserDataDir(const base::FilePath& bundle_path) {
|
| user_data_dir.value(), base::CompareCase::SENSITIVE);
|
| }
|
|
|
| -void LaunchShimOnFileThread(
|
| - std::unique_ptr<web_app::ShortcutInfo> shortcut_info,
|
| - bool launched_after_rebuild) {
|
| +void LaunchShimOnFileThread(scoped_refptr<web_app::ShortcutInfo> shortcut_info,
|
| + bool launched_after_rebuild) {
|
| DCHECK_CURRENTLY_ON(content::BrowserThread::FILE);
|
| base::FilePath shim_path = web_app::GetAppInstallPath(*shortcut_info);
|
|
|
| @@ -266,7 +265,7 @@ void UpdatePlatformShortcutsInternal(
|
| }
|
|
|
| void UpdateAndLaunchShimOnFileThread(
|
| - std::unique_ptr<web_app::ShortcutInfo> shortcut_info) {
|
| + scoped_refptr<web_app::ShortcutInfo> shortcut_info) {
|
| base::FilePath shortcut_data_dir = web_app::GetWebAppDataDirectory(
|
| shortcut_info->profile_path, shortcut_info->extension_id, GURL());
|
| UpdatePlatformShortcutsInternal(shortcut_data_dir, base::string16(),
|
| @@ -274,13 +273,13 @@ void UpdateAndLaunchShimOnFileThread(
|
| LaunchShimOnFileThread(std::move(shortcut_info), true);
|
| }
|
|
|
| -void UpdateAndLaunchShim(std::unique_ptr<web_app::ShortcutInfo> shortcut_info) {
|
| - content::BrowserThread::PostTask(content::BrowserThread::FILE, FROM_HERE,
|
| - base::Bind(&UpdateAndLaunchShimOnFileThread,
|
| - base::Passed(&shortcut_info)));
|
| +void UpdateAndLaunchShim(scoped_refptr<web_app::ShortcutInfo> shortcut_info) {
|
| + content::BrowserThread::PostTask(
|
| + content::BrowserThread::FILE, FROM_HERE,
|
| + base::Bind(&UpdateAndLaunchShimOnFileThread, std::move(shortcut_info)));
|
| }
|
|
|
| -void RebuildAppAndLaunch(std::unique_ptr<web_app::ShortcutInfo> shortcut_info) {
|
| +void RebuildAppAndLaunch(scoped_refptr<web_app::ShortcutInfo> shortcut_info) {
|
| DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
|
| if (shortcut_info->extension_id == app_mode::kAppListModeId) {
|
| AppListService* app_list_service = AppListService::Get();
|
| @@ -477,12 +476,11 @@ std::vector<base::FilePath> GetAllAppBundlesInPath(
|
| return bundle_paths;
|
| }
|
|
|
| -std::unique_ptr<web_app::ShortcutInfo> BuildShortcutInfoFromBundle(
|
| +scoped_refptr<web_app::ShortcutInfo> BuildShortcutInfoFromBundle(
|
| const base::FilePath& bundle_path) {
|
| NSDictionary* plist = ReadPlist(GetPlistPath(bundle_path));
|
|
|
| - std::unique_ptr<web_app::ShortcutInfo> shortcut_info(
|
| - new web_app::ShortcutInfo);
|
| + scoped_refptr<web_app::ShortcutInfo> shortcut_info(new web_app::ShortcutInfo);
|
| shortcut_info->extension_id = base::SysNSStringToUTF8(
|
| [plist valueForKey:app_mode::kCrAppModeShortcutIDKey]);
|
| shortcut_info->is_platform_app = true;
|
| @@ -507,7 +505,7 @@ std::unique_ptr<web_app::ShortcutInfo> BuildShortcutInfoFromBundle(
|
| return shortcut_info;
|
| }
|
|
|
| -std::unique_ptr<web_app::ShortcutInfo> RecordAppShimErrorAndBuildShortcutInfo(
|
| +scoped_refptr<web_app::ShortcutInfo> RecordAppShimErrorAndBuildShortcutInfo(
|
| const base::FilePath& bundle_path) {
|
| NSDictionary* plist = ReadPlist(GetPlistPath(bundle_path));
|
| NSString* version_string = [plist valueForKey:app_mode::kCrBundleVersionKey];
|
| @@ -526,7 +524,7 @@ std::unique_ptr<web_app::ShortcutInfo> RecordAppShimErrorAndBuildShortcutInfo(
|
| }
|
|
|
| void RevealAppShimInFinderForAppOnFileThread(
|
| - std::unique_ptr<web_app::ShortcutInfo> shortcut_info,
|
| + scoped_refptr<web_app::ShortcutInfo> shortcut_info,
|
| const base::FilePath& app_path) {
|
| web_app::WebAppShortcutCreator shortcut_creator(app_path,
|
| shortcut_info.get());
|
| @@ -971,7 +969,7 @@ base::FilePath GetAppInstallPath(const ShortcutInfo& shortcut_info) {
|
| return shortcut_creator.GetApplicationsShortcutPath();
|
| }
|
|
|
| -void MaybeLaunchShortcut(std::unique_ptr<ShortcutInfo> shortcut_info) {
|
| +void MaybeLaunchShortcut(scoped_refptr<ShortcutInfo> shortcut_info) {
|
| if (AppShimsDisabledForTest() &&
|
| !g_app_shims_allow_update_and_launch_in_tests) {
|
| return;
|
| @@ -979,7 +977,7 @@ void MaybeLaunchShortcut(std::unique_ptr<ShortcutInfo> shortcut_info) {
|
|
|
| content::BrowserThread::PostTask(
|
| content::BrowserThread::FILE, FROM_HERE,
|
| - base::Bind(&LaunchShimOnFileThread, base::Passed(&shortcut_info), false));
|
| + base::Bind(&LaunchShimOnFileThread, std::move(shortcut_info), false));
|
| }
|
|
|
| bool MaybeRebuildShortcut(const base::CommandLine& command_line) {
|
| @@ -1020,21 +1018,20 @@ void UpdateShortcutsForAllApps(Profile* profile,
|
|
|
| void RevealAppShimInFinderForApp(Profile* profile,
|
| const extensions::Extension* app) {
|
| - std::unique_ptr<web_app::ShortcutInfo> shortcut_info =
|
| + scoped_refptr<web_app::ShortcutInfo> shortcut_info =
|
| ShortcutInfoForExtensionAndProfile(app, profile);
|
| content::BrowserThread::PostTask(
|
| content::BrowserThread::FILE, FROM_HERE,
|
| base::Bind(&RevealAppShimInFinderForAppOnFileThread,
|
| - base::Passed(&shortcut_info), app->path()));
|
| + std::move(shortcut_info), app->path()));
|
| }
|
|
|
| namespace internals {
|
|
|
| -bool CreatePlatformShortcuts(
|
| - const base::FilePath& app_data_path,
|
| - std::unique_ptr<ShortcutInfo> shortcut_info,
|
| - const ShortcutLocations& creation_locations,
|
| - ShortcutCreationReason creation_reason) {
|
| +bool CreatePlatformShortcuts(const base::FilePath& app_data_path,
|
| + scoped_refptr<ShortcutInfo> shortcut_info,
|
| + const ShortcutLocations& creation_locations,
|
| + ShortcutCreationReason creation_reason) {
|
| DCHECK_CURRENTLY_ON(content::BrowserThread::FILE);
|
| if (AppShimsDisabledForTest())
|
| return true;
|
| @@ -1044,7 +1041,7 @@ bool CreatePlatformShortcuts(
|
| }
|
|
|
| void DeletePlatformShortcuts(const base::FilePath& app_data_path,
|
| - std::unique_ptr<ShortcutInfo> shortcut_info) {
|
| + scoped_refptr<ShortcutInfo> shortcut_info) {
|
| DCHECK_CURRENTLY_ON(content::BrowserThread::FILE);
|
| WebAppShortcutCreator shortcut_creator(app_data_path, shortcut_info.get());
|
| shortcut_creator.DeleteShortcuts();
|
| @@ -1052,7 +1049,7 @@ void DeletePlatformShortcuts(const base::FilePath& app_data_path,
|
|
|
| void UpdatePlatformShortcuts(const base::FilePath& app_data_path,
|
| const base::string16& old_app_title,
|
| - std::unique_ptr<ShortcutInfo> shortcut_info) {
|
| + scoped_refptr<ShortcutInfo> shortcut_info) {
|
| UpdatePlatformShortcutsInternal(app_data_path, old_app_title, *shortcut_info);
|
| }
|
|
|
| @@ -1063,7 +1060,7 @@ void DeleteAllShortcutsForProfile(const base::FilePath& profile_path) {
|
|
|
| for (std::vector<base::FilePath>::const_iterator it = bundles.begin();
|
| it != bundles.end(); ++it) {
|
| - std::unique_ptr<web_app::ShortcutInfo> shortcut_info =
|
| + scoped_refptr<web_app::ShortcutInfo> shortcut_info =
|
| BuildShortcutInfoFromBundle(*it);
|
| WebAppShortcutCreator shortcut_creator(it->DirName(), shortcut_info.get());
|
| shortcut_creator.DeleteShortcuts();
|
|
|