| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/web_applications/web_app.h" | 5 #include "chrome/browser/web_applications/web_app.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
| 9 #include "base/command_line.h" |
| 9 #include "base/files/file_util.h" | 10 #include "base/files/file_util.h" |
| 10 #include "base/i18n/file_util_icu.h" | 11 #include "base/i18n/file_util_icu.h" |
| 11 #include "base/prefs/pref_service.h" | 12 #include "base/prefs/pref_service.h" |
| 12 #include "base/strings/string_util.h" | 13 #include "base/strings/string_util.h" |
| 13 #include "base/strings/utf_string_conversions.h" | 14 #include "base/strings/utf_string_conversions.h" |
| 14 #include "base/threading/thread.h" | 15 #include "base/threading/thread.h" |
| 15 #include "chrome/browser/browser_process.h" | 16 #include "chrome/browser/browser_process.h" |
| 16 #include "chrome/browser/extensions/extension_ui_util.h" | 17 #include "chrome/browser/extensions/extension_ui_util.h" |
| 17 #include "chrome/browser/profiles/profile.h" | 18 #include "chrome/browser/profiles/profile.h" |
| 18 #include "chrome/browser/profiles/profile_manager.h" | 19 #include "chrome/browser/profiles/profile_manager.h" |
| 19 #include "chrome/common/chrome_constants.h" | 20 #include "chrome/common/chrome_constants.h" |
| 21 #include "chrome/common/chrome_switches.h" |
| 20 #include "chrome/common/chrome_version_info.h" | 22 #include "chrome/common/chrome_version_info.h" |
| 21 #include "chrome/common/extensions/manifest_handlers/app_launch_info.h" | 23 #include "chrome/common/extensions/manifest_handlers/app_launch_info.h" |
| 22 #include "chrome/common/pref_names.h" | 24 #include "chrome/common/pref_names.h" |
| 23 #include "content/public/browser/browser_thread.h" | 25 #include "content/public/browser/browser_thread.h" |
| 24 #include "extensions/browser/extension_registry.h" | 26 #include "extensions/browser/extension_registry.h" |
| 25 #include "extensions/browser/image_loader.h" | 27 #include "extensions/browser/image_loader.h" |
| 26 #include "extensions/common/constants.h" | 28 #include "extensions/common/constants.h" |
| 27 #include "extensions/common/extension.h" | 29 #include "extensions/common/extension.h" |
| 28 #include "extensions/common/extension_set.h" | 30 #include "extensions/common/extension_set.h" |
| 29 #include "extensions/common/manifest_handlers/icons_handler.h" | 31 #include "extensions/common/manifest_handlers/icons_handler.h" |
| (...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 268 extension, profile, base::Bind(&IgnoreFileHandlersInfo, callback)); | 270 extension, profile, base::Bind(&IgnoreFileHandlersInfo, callback)); |
| 269 } | 271 } |
| 270 | 272 |
| 271 bool ShouldCreateShortcutFor(Profile* profile, | 273 bool ShouldCreateShortcutFor(Profile* profile, |
| 272 const extensions::Extension* extension) { | 274 const extensions::Extension* extension) { |
| 273 bool app_type_requires_shortcut = extension->is_platform_app(); | 275 bool app_type_requires_shortcut = extension->is_platform_app(); |
| 274 | 276 |
| 275 // An additional check here for OS X. We need app shims to be | 277 // An additional check here for OS X. We need app shims to be |
| 276 // able to show them in the dock. | 278 // able to show them in the dock. |
| 277 #if defined(OS_MACOSX) | 279 #if defined(OS_MACOSX) |
| 278 app_type_requires_shortcut = | 280 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 279 app_type_requires_shortcut || extension->is_hosted_app(); | 281 switches::kEnableHostedAppShimCreation)) { |
| 282 app_type_requires_shortcut = |
| 283 app_type_requires_shortcut || extension->is_hosted_app(); |
| 284 } |
| 280 #endif | 285 #endif |
| 281 | 286 |
| 282 return (app_type_requires_shortcut && | 287 return (app_type_requires_shortcut && |
| 283 extension->location() != extensions::Manifest::COMPONENT && | 288 extension->location() != extensions::Manifest::COMPONENT && |
| 284 extensions::ui_util::CanDisplayInAppLauncher(extension, profile)); | 289 extensions::ui_util::CanDisplayInAppLauncher(extension, profile)); |
| 285 } | 290 } |
| 286 | 291 |
| 287 base::FilePath GetWebAppDataDirectory(const base::FilePath& profile_path, | 292 base::FilePath GetWebAppDataDirectory(const base::FilePath& profile_path, |
| 288 const std::string& extension_id, | 293 const std::string& extension_id, |
| 289 const GURL& url) { | 294 const GURL& url) { |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 452 | 457 |
| 453 #if defined(OS_LINUX) | 458 #if defined(OS_LINUX) |
| 454 std::string GetWMClassFromAppName(std::string app_name) { | 459 std::string GetWMClassFromAppName(std::string app_name) { |
| 455 base::i18n::ReplaceIllegalCharactersInPath(&app_name, '_'); | 460 base::i18n::ReplaceIllegalCharactersInPath(&app_name, '_'); |
| 456 base::TrimString(app_name, "_", &app_name); | 461 base::TrimString(app_name, "_", &app_name); |
| 457 return app_name; | 462 return app_name; |
| 458 } | 463 } |
| 459 #endif | 464 #endif |
| 460 | 465 |
| 461 } // namespace web_app | 466 } // namespace web_app |
| OLD | NEW |