Chromium Code Reviews| Index: chrome/browser/web_applications/web_app.cc |
| diff --git a/chrome/browser/web_applications/web_app.cc b/chrome/browser/web_applications/web_app.cc |
| index 313e261886555939c2a2b6fec826a81f97149743..a327d226c97ad6eb74a19f40d3386dadbfdcaf57 100644 |
| --- a/chrome/browser/web_applications/web_app.cc |
| +++ b/chrome/browser/web_applications/web_app.cc |
| @@ -42,9 +42,6 @@ using content::BrowserThread; |
| namespace { |
| -typedef base::Callback<void(const web_app::ShortcutInfo&, |
| - const extensions::FileHandlersInfo&)> InfoCallback; |
| - |
| #if defined(OS_MACOSX) |
| const int kDesiredSizes[] = {16, 32, 128, 256, 512}; |
| const size_t kNumDesiredSizes = arraysize(kDesiredSizes); |
| @@ -134,7 +131,7 @@ void UpdateAllShortcutsForShortcutInfo( |
| void OnImageLoaded(web_app::ShortcutInfo shortcut_info, |
| extensions::FileHandlersInfo file_handlers_info, |
| - InfoCallback callback, |
| + web_app::InfoCallback callback, |
| const gfx::ImageFamily& image_family) { |
| // If the image failed to load (e.g. if the resource being loaded was empty) |
| // use the standard application icon. |
| @@ -157,6 +154,27 @@ void OnImageLoaded(web_app::ShortcutInfo shortcut_info, |
| callback.Run(shortcut_info, file_handlers_info); |
| } |
| +void IgnoreFileHandlersInfo( |
| + const web_app::ShortcutInfoCallback& shortcut_info_callback, |
| + const web_app::ShortcutInfo& shortcut_info, |
| + const extensions::FileHandlersInfo& file_handlers_info) { |
| + shortcut_info_callback.Run(shortcut_info); |
| +} |
| + |
| +} // namespace |
| + |
| +namespace web_app { |
| + |
| +// The following string is used to build the directory name for |
| +// shortcuts to chrome applications (the kind which are installed |
| +// from a CRX). Application shortcuts to URLs use the {host}_{path} |
| +// for the name of this directory. Hosts can't include an underscore. |
| +// By starting this string with an underscore, we ensure that there |
| +// are no naming conflicts. |
| +static const char* kCrxAppPrefix = "_crx_"; |
|
tapted
2014/05/06 07:13:24
nit: (since it's showing up in the diff) should th
jackhou1
2014/05/06 08:38:17
Done.
|
| + |
| +namespace internals { |
| + |
| void GetInfoForApp(const extensions::Extension* extension, |
| Profile* profile, |
| const InfoCallback& callback) { |
| @@ -213,27 +231,6 @@ void GetInfoForApp(const extensions::Extension* extension, |
| base::Bind(&OnImageLoaded, shortcut_info, file_handlers_info, callback)); |
| } |
| -void IgnoreFileHandlersInfo( |
| - const web_app::ShortcutInfoCallback& shortcut_info_callback, |
| - const web_app::ShortcutInfo& shortcut_info, |
| - const extensions::FileHandlersInfo& file_handlers_info) { |
| - shortcut_info_callback.Run(shortcut_info); |
| -} |
| - |
| -} // namespace |
| - |
| -namespace web_app { |
| - |
| -// The following string is used to build the directory name for |
| -// shortcuts to chrome applications (the kind which are installed |
| -// from a CRX). Application shortcuts to URLs use the {host}_{path} |
| -// for the name of this directory. Hosts can't include an underscore. |
| -// By starting this string with an underscore, we ensure that there |
| -// are no naming conflicts. |
| -static const char* kCrxAppPrefix = "_crx_"; |
| - |
| -namespace internals { |
| - |
| base::FilePath GetSanitizedFileName(const base::string16& name) { |
| #if defined(OS_WIN) |
| base::string16 file_name = name; |
| @@ -319,9 +316,9 @@ void UpdateShortcutInfoAndIconForApp( |
| const extensions::Extension* extension, |
| Profile* profile, |
| const web_app::ShortcutInfoCallback& callback) { |
| - GetInfoForApp(extension, |
| - profile, |
| - base::Bind(&IgnoreFileHandlersInfo, callback)); |
| + internals::GetInfoForApp(extension, |
| + profile, |
| + base::Bind(&IgnoreFileHandlersInfo, callback)); |
| } |
| base::FilePath GetWebAppDataDirectory(const base::FilePath& profile_path, |
| @@ -412,9 +409,10 @@ void CreateShortcuts( |
| const extensions::Extension* app) { |
| DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| - GetInfoForApp(app, |
| - profile, |
| - base::Bind(&CreateShortcutsWithInfo, reason, locations)); |
| + internals::GetInfoForApp( |
| + app, |
| + profile, |
| + base::Bind(&CreateShortcutsWithInfo, reason, locations)); |
| } |
| void DeleteAllShortcuts(Profile* profile, const extensions::Extension* app) { |
| @@ -432,9 +430,10 @@ void UpdateAllShortcuts(const base::string16& old_app_title, |
| const extensions::Extension* app) { |
| DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| - GetInfoForApp(app, |
| - profile, |
| - base::Bind(&UpdateAllShortcutsForShortcutInfo, old_app_title)); |
| + internals::GetInfoForApp( |
| + app, |
| + profile, |
| + base::Bind(&UpdateAllShortcutsForShortcutInfo, old_app_title)); |
| } |
| bool IsValidUrl(const GURL& url) { |