OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #if defined(OS_WIN) | 7 #if defined(OS_WIN) |
8 #include <shlobj.h> | 8 #include <shlobj.h> |
9 #endif // defined(OS_WIN) | 9 #endif // defined(OS_WIN) |
10 | 10 |
(...skipping 457 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
468 t.append(url.path()); | 468 t.append(url.path()); |
469 return t; | 469 return t; |
470 } | 470 } |
471 | 471 |
472 std::string GenerateApplicationNameFromExtensionId(const std::string& id) { | 472 std::string GenerateApplicationNameFromExtensionId(const std::string& id) { |
473 std::string t(web_app::kCrxAppPrefix); | 473 std::string t(web_app::kCrxAppPrefix); |
474 t.append(id); | 474 t.append(id); |
475 return t; | 475 return t; |
476 } | 476 } |
477 | 477 |
| 478 std::string GetExtensionIdFromApplicationName(const std::string& app_name) { |
| 479 std::string prefix(kCrxAppPrefix); |
| 480 if (app_name.substr(0, prefix.length()) != prefix) |
| 481 return std::string(); |
| 482 return app_name.substr(prefix.length()); |
| 483 } |
| 484 |
478 void CreateShortcut( | 485 void CreateShortcut( |
479 const FilePath& data_dir, | 486 const FilePath& data_dir, |
480 const ShellIntegration::ShortcutInfo& shortcut_info, | 487 const ShellIntegration::ShortcutInfo& shortcut_info, |
481 CreateShortcutCallback* callback) { | 488 CreateShortcutCallback* callback) { |
482 BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE, | 489 BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE, |
483 new CreateShortcutTask(data_dir, shortcut_info, callback)); | 490 new CreateShortcutTask(data_dir, shortcut_info, callback)); |
484 } | 491 } |
485 | 492 |
486 bool IsValidUrl(const GURL& url) { | 493 bool IsValidUrl(const GURL& url) { |
487 static const char* const kValidUrlSchemes[] = { | 494 static const char* const kValidUrlSchemes[] = { |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
523 | 530 |
524 #if defined(TOOLKIT_USES_GTK) | 531 #if defined(TOOLKIT_USES_GTK) |
525 std::string GetWMClassFromAppName(std::string app_name) { | 532 std::string GetWMClassFromAppName(std::string app_name) { |
526 file_util::ReplaceIllegalCharactersInPath(&app_name, '_'); | 533 file_util::ReplaceIllegalCharactersInPath(&app_name, '_'); |
527 TrimString(app_name, "_", &app_name); | 534 TrimString(app_name, "_", &app_name); |
528 return app_name; | 535 return app_name; |
529 } | 536 } |
530 #endif | 537 #endif |
531 | 538 |
532 } // namespace web_app | 539 } // namespace web_app |
OLD | NEW |