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

Side by Side Diff: chrome/browser/shell_integration_linux.cc

Issue 10915079: remove --enable-experimental-extension-apis from packaged app shortcut args (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: is_platform_app data member on ShortcutInfo no longer required Created 8 years, 3 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 unified diff | Download patch
« no previous file with comments | « chrome/browser/shell_integration_linux.h ('k') | chrome/browser/shell_integration_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/shell_integration_linux.h" 5 #include "chrome/browser/shell_integration_linux.h"
6 6
7 #include <fcntl.h> 7 #include <fcntl.h>
8 #include <glib.h> 8 #include <glib.h>
9 #include <stdlib.h> 9 #include <stdlib.h>
10 #include <sys/stat.h> 10 #include <sys/stat.h>
(...skipping 502 matching lines...) Expand 10 before | Expand all | Expand 10 after
513 .append(profile_path.BaseName().value()); 513 .append(profile_path.BaseName().value());
514 file_util::ReplaceIllegalCharactersInPath(&filename, '_'); 514 file_util::ReplaceIllegalCharactersInPath(&filename, '_');
515 return FilePath(filename.append(".desktop")); 515 return FilePath(filename.append(".desktop"));
516 } 516 }
517 517
518 std::string GetDesktopFileContents( 518 std::string GetDesktopFileContents(
519 const std::string& template_contents, 519 const std::string& template_contents,
520 const std::string& app_name, 520 const std::string& app_name,
521 const GURL& url, 521 const GURL& url,
522 const std::string& extension_id, 522 const std::string& extension_id,
523 const bool is_platform_app,
524 const FilePath& extension_path, 523 const FilePath& extension_path,
525 const string16& title, 524 const string16& title,
526 const std::string& icon_name, 525 const std::string& icon_name,
527 const FilePath& profile_path) { 526 const FilePath& profile_path) {
528 if (template_contents.empty()) 527 if (template_contents.empty())
529 return std::string(kXdgOpenShebang) + "\n"; 528 return std::string(kXdgOpenShebang) + "\n";
530 529
531 // See http://standards.freedesktop.org/desktop-entry-spec/latest/ 530 // See http://standards.freedesktop.org/desktop-entry-spec/latest/
532 // http://developer.gnome.org/glib/unstable/glib-Key-value-file-parser.html 531 // http://developer.gnome.org/glib/unstable/glib-Key-value-file-parser.html
533 GKeyFile* key_file = g_key_file_new(); 532 GKeyFile* key_file = g_key_file_new();
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
582 StringTokenizer exec_tokenizer(exec_string, " "); 581 StringTokenizer exec_tokenizer(exec_string, " ");
583 582
584 std::string final_path; 583 std::string final_path;
585 while (exec_tokenizer.GetNext() && exec_tokenizer.token() != "%U") { 584 while (exec_tokenizer.GetNext() && exec_tokenizer.token() != "%U") {
586 if (!final_path.empty()) 585 if (!final_path.empty())
587 final_path += " "; 586 final_path += " ";
588 final_path += exec_tokenizer.token(); 587 final_path += exec_tokenizer.token();
589 } 588 }
590 CommandLine cmd_line(CommandLine::NO_PROGRAM); 589 CommandLine cmd_line(CommandLine::NO_PROGRAM);
591 cmd_line = ShellIntegration::CommandLineArgsForLauncher( 590 cmd_line = ShellIntegration::CommandLineArgsForLauncher(
592 url, extension_id, is_platform_app, profile_path); 591 url, extension_id, profile_path);
593 const CommandLine::SwitchMap& switch_map = cmd_line.GetSwitches(); 592 const CommandLine::SwitchMap& switch_map = cmd_line.GetSwitches();
594 for (CommandLine::SwitchMap::const_iterator i = switch_map.begin(); 593 for (CommandLine::SwitchMap::const_iterator i = switch_map.begin();
595 i != switch_map.end(); ++i) { 594 i != switch_map.end(); ++i) {
596 if (i->second.empty()) { 595 if (i->second.empty()) {
597 final_path += " --" + i->first; 596 final_path += " --" + i->first;
598 } else { 597 } else {
599 final_path += " " + QuoteArgForDesktopFileExec("--" + i->first + 598 final_path += " " + QuoteArgForDesktopFileExec("--" + i->first +
600 "=" + i->second); 599 "=" + i->second);
601 } 600 }
602 } 601 }
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
651 650
652 std::string icon_name = CreateShortcutIcon(shortcut_info, shortcut_filename); 651 std::string icon_name = CreateShortcutIcon(shortcut_info, shortcut_filename);
653 652
654 std::string app_name = 653 std::string app_name =
655 web_app::GenerateApplicationNameFromInfo(shortcut_info); 654 web_app::GenerateApplicationNameFromInfo(shortcut_info);
656 std::string contents = ShellIntegrationLinux::GetDesktopFileContents( 655 std::string contents = ShellIntegrationLinux::GetDesktopFileContents(
657 shortcut_template, 656 shortcut_template,
658 app_name, 657 app_name,
659 shortcut_info.url, 658 shortcut_info.url,
660 shortcut_info.extension_id, 659 shortcut_info.extension_id,
661 shortcut_info.is_platform_app,
662 shortcut_info.extension_path, 660 shortcut_info.extension_path,
663 shortcut_info.title, 661 shortcut_info.title,
664 icon_name, 662 icon_name,
665 shortcut_info.profile_path); 663 shortcut_info.profile_path);
666 664
667 bool success = true; 665 bool success = true;
668 666
669 if (shortcut_info.create_on_desktop) 667 if (shortcut_info.create_on_desktop)
670 success = CreateShortcutOnDesktop(shortcut_filename, contents); 668 success = CreateShortcutOnDesktop(shortcut_filename, contents);
671 669
(...skipping 10 matching lines...) Expand all
682 680
683 FilePath shortcut_filename = GetExtensionShortcutFilename( 681 FilePath shortcut_filename = GetExtensionShortcutFilename(
684 profile_path, extension_id); 682 profile_path, extension_id);
685 DCHECK(!shortcut_filename.empty()); 683 DCHECK(!shortcut_filename.empty());
686 684
687 DeleteShortcutOnDesktop(shortcut_filename); 685 DeleteShortcutOnDesktop(shortcut_filename);
688 DeleteShortcutInApplicationsMenu(shortcut_filename); 686 DeleteShortcutInApplicationsMenu(shortcut_filename);
689 } 687 }
690 688
691 } // namespace ShellIntegrationLinux 689 } // namespace ShellIntegrationLinux
OLDNEW
« no previous file with comments | « chrome/browser/shell_integration_linux.h ('k') | chrome/browser/shell_integration_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698