| 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/file_util.h" | 9 #include "base/file_util.h" |
| 10 #include "base/i18n/file_util_icu.h" | 10 #include "base/i18n/file_util_icu.h" |
| (...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 230 | 230 |
| 231 ShortcutInfo::ShortcutInfo() | 231 ShortcutInfo::ShortcutInfo() |
| 232 : is_platform_app(false) { | 232 : is_platform_app(false) { |
| 233 } | 233 } |
| 234 | 234 |
| 235 ShortcutInfo::~ShortcutInfo() {} | 235 ShortcutInfo::~ShortcutInfo() {} |
| 236 | 236 |
| 237 ShortcutLocations::ShortcutLocations() | 237 ShortcutLocations::ShortcutLocations() |
| 238 : on_desktop(false), | 238 : on_desktop(false), |
| 239 applications_menu_location(APP_MENU_LOCATION_NONE), | 239 applications_menu_location(APP_MENU_LOCATION_NONE), |
| 240 in_quick_launch_bar(false) | 240 in_quick_launch_bar(false), |
| 241 #if defined(OS_POSIX) | 241 hidden(false) { |
| 242 , hidden(false) | |
| 243 #endif | |
| 244 { | |
| 245 } | 242 } |
| 246 | 243 |
| 247 void GetShortcutInfoForTab(content::WebContents* web_contents, | 244 void GetShortcutInfoForTab(content::WebContents* web_contents, |
| 248 ShortcutInfo* info) { | 245 ShortcutInfo* info) { |
| 249 DCHECK(info); // Must provide a valid info. | 246 DCHECK(info); // Must provide a valid info. |
| 250 | 247 |
| 251 const FaviconTabHelper* favicon_tab_helper = | 248 const FaviconTabHelper* favicon_tab_helper = |
| 252 FaviconTabHelper::FromWebContents(web_contents); | 249 FaviconTabHelper::FromWebContents(web_contents); |
| 253 const extensions::TabHelper* extensions_tab_helper = | 250 const extensions::TabHelper* extensions_tab_helper = |
| 254 extensions::TabHelper::FromWebContents(web_contents); | 251 extensions::TabHelper::FromWebContents(web_contents); |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 291 Profile* profile, | 288 Profile* profile, |
| 292 const ShortcutInfoCallback& callback) { | 289 const ShortcutInfoCallback& callback) { |
| 293 GetInfoForApp(extension, | 290 GetInfoForApp(extension, |
| 294 profile, | 291 profile, |
| 295 base::Bind(&IgnoreFileHandlersInfo, callback)); | 292 base::Bind(&IgnoreFileHandlersInfo, callback)); |
| 296 } | 293 } |
| 297 | 294 |
| 298 bool ShouldCreateShortcutFor(Profile* profile, | 295 bool ShouldCreateShortcutFor(Profile* profile, |
| 299 const extensions::Extension* extension) { | 296 const extensions::Extension* extension) { |
| 300 return extension->is_platform_app() && | 297 return extension->is_platform_app() && |
| 301 extension->location() != extensions::Manifest::COMPONENT && | 298 extension->location() != extensions::Manifest::COMPONENT && |
| 302 extensions::ui_util::ShouldDisplayInAppLauncher(extension, profile); | 299 extensions::ui_util::ShouldDisplayInAppLauncherIgnoreEphemeral( |
| 300 extension, profile); |
| 303 } | 301 } |
| 304 | 302 |
| 305 base::FilePath GetWebAppDataDirectory(const base::FilePath& profile_path, | 303 base::FilePath GetWebAppDataDirectory(const base::FilePath& profile_path, |
| 306 const std::string& extension_id, | 304 const std::string& extension_id, |
| 307 const GURL& url) { | 305 const GURL& url) { |
| 308 DCHECK(!profile_path.empty()); | 306 DCHECK(!profile_path.empty()); |
| 309 base::FilePath app_data_dir(profile_path.Append(chrome::kWebAppDirname)); | 307 base::FilePath app_data_dir(profile_path.Append(chrome::kWebAppDirname)); |
| 310 | 308 |
| 311 if (!extension_id.empty()) { | 309 if (!extension_id.empty()) { |
| 312 return app_data_dir.AppendASCII( | 310 return app_data_dir.AppendASCII( |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 451 | 449 |
| 452 #if defined(OS_LINUX) | 450 #if defined(OS_LINUX) |
| 453 std::string GetWMClassFromAppName(std::string app_name) { | 451 std::string GetWMClassFromAppName(std::string app_name) { |
| 454 file_util::ReplaceIllegalCharactersInPath(&app_name, '_'); | 452 file_util::ReplaceIllegalCharactersInPath(&app_name, '_'); |
| 455 base::TrimString(app_name, "_", &app_name); | 453 base::TrimString(app_name, "_", &app_name); |
| 456 return app_name; | 454 return app_name; |
| 457 } | 455 } |
| 458 #endif | 456 #endif |
| 459 | 457 |
| 460 } // namespace web_app | 458 } // namespace web_app |
| OLD | NEW |