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

Unified Diff: chrome/browser/web_applications/web_app.cc

Issue 265163006: [Mac] Rebuild app shims when they fail to dyload Chrome Framework. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 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 side-by-side diff with in-line comments
Download patch
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_";
+
+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) {

Powered by Google App Engine
This is Rietveld 408576698