| 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 3a7b237f1f4e34fa21c738e9af121cd5470ece5f..bf39f623be7f79aeb04d34d034d59a3072dc4fc3 100644
|
| --- a/chrome/browser/web_applications/web_app_mac.mm
|
| +++ b/chrome/browser/web_applications/web_app_mac.mm
|
| @@ -24,7 +24,9 @@
|
| #include "base/strings/sys_string_conversions.h"
|
| #include "base/strings/utf_string_conversions.h"
|
| #import "chrome/browser/mac/dock.h"
|
| +#include "chrome/browser/browser_process.h"
|
| #include "chrome/browser/profiles/profile.h"
|
| +#include "chrome/browser/profiles/profile_manager.h"
|
| #include "chrome/browser/shell_integration.h"
|
| #include "chrome/common/chrome_constants.h"
|
| #include "chrome/common/chrome_paths.h"
|
| @@ -32,6 +34,7 @@
|
| #include "chrome/common/chrome_version_info.h"
|
| #import "chrome/common/mac/app_mode_common.h"
|
| #include "content/public/browser/browser_thread.h"
|
| +#include "extensions/browser/extension_registry.h"
|
| #include "extensions/common/extension.h"
|
| #include "grit/chrome_unscaled_resources.h"
|
| #include "grit/chromium_strings.h"
|
| @@ -482,6 +485,24 @@ void UpdateFileTypes(NSMutableDictionary* plist,
|
| forKey:app_mode::kCFBundleDocumentTypesKey];
|
| }
|
|
|
| +void UpdateShortcutsOnUIThread(
|
| + const base::FilePath& profile_path,
|
| + const std::string app_id) {
|
| + ProfileManager* profile_manager = g_browser_process->profile_manager();
|
| + Profile* profile = profile_manager->GetProfileByPath(profile_path);
|
| + if (!profile || !profile_manager->IsValidProfile(profile))
|
| + return;
|
| +
|
| + extensions::ExtensionRegistry* registry =
|
| + extensions::ExtensionRegistry::Get(profile);
|
| + const extensions::Extension* extension = registry->GetExtensionById(
|
| + app_id, extensions::ExtensionRegistry::EVERYTHING);
|
| + if (!extension || !extension->is_platform_app())
|
| + return;
|
| +
|
| + web_app::UpdateAllShortcuts(base::string16(), profile, extension);
|
| +}
|
| +
|
| } // namespace
|
|
|
| namespace web_app {
|
| @@ -969,6 +990,19 @@ void DeleteAllShortcutsForProfile(const base::FilePath& profile_path) {
|
| }
|
| }
|
|
|
| +void UpdateShortcutsForAllAppsForProfile(const base::FilePath& profile_path,
|
| + const std::set<std::string>& app_ids) {
|
| + DCHECK_CURRENTLY_ON(content::BrowserThread::FILE);
|
| + for (std::set<std::string>::const_iterator it = app_ids.begin();
|
| + it != app_ids.end();
|
| + ++it) {
|
| + content::BrowserThread::PostTask(
|
| + content::BrowserThread::UI,
|
| + FROM_HERE,
|
| + base::Bind(&UpdateShortcutsOnUIThread, profile_path, *it));
|
| + }
|
| +}
|
| +
|
| } // namespace internals
|
|
|
| } // namespace web_app
|
|
|