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

Side by Side Diff: chrome/installer/setup/install.cc

Issue 15255004: Refactor of BrowserDistribution. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years, 4 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
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/installer/setup/install.h" 5 #include "chrome/installer/setup/install.h"
6 6
7 #include <windows.h> 7 #include <windows.h>
8 #include <shlobj.h> 8 #include <shlobj.h>
9 #include <time.h> 9 #include <time.h>
10 10
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 message.append("Start menu "); 80 message.append("Start menu ");
81 break; 81 break;
82 default: 82 default:
83 NOTREACHED(); 83 NOTREACHED();
84 } 84 }
85 85
86 message.push_back('"'); 86 message.push_back('"');
87 if (properties.has_shortcut_name()) 87 if (properties.has_shortcut_name())
88 message.append(UTF16ToUTF8(properties.shortcut_name)); 88 message.append(UTF16ToUTF8(properties.shortcut_name));
89 else 89 else
90 message.append(UTF16ToUTF8(dist->GetAppShortCutName())); 90 message.append(UTF16ToUTF8(dist->GetDisplayName()));
91 message.push_back('"'); 91 message.push_back('"');
92 92
93 message.append(" shortcut to "); 93 message.append(" shortcut to ");
94 message.append(UTF16ToUTF8(properties.target.value())); 94 message.append(UTF16ToUTF8(properties.target.value()));
95 if (properties.has_arguments()) 95 if (properties.has_arguments())
96 message.append(UTF16ToUTF8(properties.arguments)); 96 message.append(UTF16ToUTF8(properties.arguments));
97 97
98 if (properties.pin_to_taskbar && 98 if (properties.pin_to_taskbar &&
99 base::win::GetVersion() >= base::win::VERSION_WIN7) { 99 base::win::GetVersion() >= base::win::VERSION_WIN7) {
100 message.append(" and pinning to the taskbar."); 100 message.append(" and pinning to the taskbar.");
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
323 " <SplashScreen Image='%2$ls\\splash-620x300.png'/>\r\n" 323 " <SplashScreen Image='%2$ls\\splash-620x300.png'/>\r\n"
324 " </VisualElements>\r\n" 324 " </VisualElements>\r\n"
325 "</Application>"; 325 "</Application>";
326 326
327 const string16 manifest_template(ASCIIToUTF16(kManifestTemplate)); 327 const string16 manifest_template(ASCIIToUTF16(kManifestTemplate));
328 328
329 BrowserDistribution* dist = BrowserDistribution::GetSpecificDistribution( 329 BrowserDistribution* dist = BrowserDistribution::GetSpecificDistribution(
330 BrowserDistribution::CHROME_BROWSER); 330 BrowserDistribution::CHROME_BROWSER);
331 // TODO(grt): http://crbug.com/75152 Write a reference to a localized 331 // TODO(grt): http://crbug.com/75152 Write a reference to a localized
332 // resource for |display_name|. 332 // resource for |display_name|.
333 string16 display_name(dist->GetAppShortCutName()); 333 string16 display_name(dist->GetDisplayName());
334 EscapeXmlAttributeValueInSingleQuotes(&display_name); 334 EscapeXmlAttributeValueInSingleQuotes(&display_name);
335 335
336 // Fill the manifest with the desired values. 336 // Fill the manifest with the desired values.
337 string16 manifest16(base::StringPrintf(manifest_template.c_str(), 337 string16 manifest16(base::StringPrintf(manifest_template.c_str(),
338 display_name.c_str(), 338 display_name.c_str(),
339 elements_dir.c_str())); 339 elements_dir.c_str()));
340 340
341 // Write the manifest to |src_path|. 341 // Write the manifest to |src_path|.
342 const std::string manifest(UTF16ToUTF8(manifest16)); 342 const std::string manifest(UTF16ToUTF8(manifest16));
343 if (file_util::WriteFile( 343 if (file_util::WriteFile(
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
404 ShellUtil::SYSTEM_LEVEL : ShellUtil::CURRENT_USER); 404 ShellUtil::SYSTEM_LEVEL : ShellUtil::CURRENT_USER);
405 405
406 // |base_properties|: The basic properties to set on every shortcut installed 406 // |base_properties|: The basic properties to set on every shortcut installed
407 // (to be refined on a per-shortcut basis). 407 // (to be refined on a per-shortcut basis).
408 ShellUtil::ShortcutProperties base_properties(shortcut_level); 408 ShellUtil::ShortcutProperties base_properties(shortcut_level);
409 product.AddDefaultShortcutProperties(target, &base_properties); 409 product.AddDefaultShortcutProperties(target, &base_properties);
410 410
411 if (!do_not_create_desktop_shortcut || 411 if (!do_not_create_desktop_shortcut ||
412 shortcut_operation == ShellUtil::SHELL_SHORTCUT_REPLACE_EXISTING) { 412 shortcut_operation == ShellUtil::SHELL_SHORTCUT_REPLACE_EXISTING) {
413 ShellUtil::ShortcutProperties desktop_properties(base_properties); 413 ShellUtil::ShortcutProperties desktop_properties(base_properties);
414 if (alternate_desktop_shortcut) 414 if (alternate_desktop_shortcut) {
415 desktop_properties.set_shortcut_name(dist->GetAlternateApplicationName()); 415 desktop_properties.set_shortcut_name(
416 dist->GetShortcutName(
417 BrowserDistribution::SHORTCUT_CHROME_ALTERNATE));
418 }
416 ExecuteAndLogShortcutOperation( 419 ExecuteAndLogShortcutOperation(
417 ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist, desktop_properties, 420 ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist, desktop_properties,
418 shortcut_operation); 421 shortcut_operation);
419 422
420 // On update there is no harm in always trying to update the alternate 423 // On update there is no harm in always trying to update the alternate
421 // Desktop shortcut. 424 // Desktop shortcut.
422 if (!alternate_desktop_shortcut && 425 if (!alternate_desktop_shortcut &&
423 shortcut_operation == ShellUtil::SHELL_SHORTCUT_REPLACE_EXISTING) { 426 shortcut_operation == ShellUtil::SHELL_SHORTCUT_REPLACE_EXISTING) {
424 desktop_properties.set_shortcut_name(dist->GetAlternateApplicationName()); 427 desktop_properties.set_shortcut_name(
428 dist->GetShortcutName(
429 BrowserDistribution::SHORTCUT_CHROME_ALTERNATE));
425 ExecuteAndLogShortcutOperation( 430 ExecuteAndLogShortcutOperation(
426 ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist, desktop_properties, 431 ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist, desktop_properties,
427 shortcut_operation); 432 shortcut_operation);
428 } 433 }
429 } 434 }
430 435
431 if (!do_not_create_quick_launch_shortcut || 436 if (!do_not_create_quick_launch_shortcut ||
432 shortcut_operation == ShellUtil::SHELL_SHORTCUT_REPLACE_EXISTING) { 437 shortcut_operation == ShellUtil::SHELL_SHORTCUT_REPLACE_EXISTING) {
433 // There is no such thing as an all-users Quick Launch shortcut, always 438 // There is no such thing as an all-users Quick Launch shortcut, always
434 // install the per-user shortcut. 439 // install the per-user shortcut.
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after
689 if (app_host_path.empty()) 694 if (app_host_path.empty())
690 return false; 695 return false;
691 696
692 CommandLine cmd(app_host_path); 697 CommandLine cmd(app_host_path);
693 cmd.AppendSwitchASCII(::switches::kInstallFromWebstore, app_code); 698 cmd.AppendSwitchASCII(::switches::kInstallFromWebstore, app_code);
694 VLOG(1) << "App install command: " << cmd.GetCommandLineString(); 699 VLOG(1) << "App install command: " << cmd.GetCommandLineString();
695 return base::LaunchProcess(cmd, base::LaunchOptions(), NULL); 700 return base::LaunchProcess(cmd, base::LaunchOptions(), NULL);
696 } 701 }
697 702
698 } // namespace installer 703 } // namespace installer
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/app_list/app_list_controller_win.cc ('k') | chrome/installer/setup/install_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698