| 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/shell_integration.h" | 5 #include "chrome/browser/shell_integration.h" |
| 6 | 6 |
| 7 #include <windows.h> | 7 #include <windows.h> |
| 8 #include <shobjidl.h> | 8 #include <shobjidl.h> |
| 9 #include <propkey.h> | 9 #include <propkey.h> |
| 10 #include <propvarutil.h> | 10 #include <propvarutil.h> |
| (...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 287 | 287 |
| 288 string16 app_name; | 288 string16 app_name; |
| 289 if (command_line.HasSwitch(switches::kApp)) { | 289 if (command_line.HasSwitch(switches::kApp)) { |
| 290 app_name = UTF8ToUTF16(web_app::GenerateApplicationNameFromURL( | 290 app_name = UTF8ToUTF16(web_app::GenerateApplicationNameFromURL( |
| 291 GURL(command_line.GetSwitchValueASCII(switches::kApp)))); | 291 GURL(command_line.GetSwitchValueASCII(switches::kApp)))); |
| 292 } else if (command_line.HasSwitch(switches::kAppId)) { | 292 } else if (command_line.HasSwitch(switches::kAppId)) { |
| 293 app_name = UTF8ToUTF16(web_app::GenerateApplicationNameFromExtensionId( | 293 app_name = UTF8ToUTF16(web_app::GenerateApplicationNameFromExtensionId( |
| 294 command_line.GetSwitchValueASCII(switches::kAppId))); | 294 command_line.GetSwitchValueASCII(switches::kAppId))); |
| 295 } else { | 295 } else { |
| 296 BrowserDistribution* dist = BrowserDistribution::GetDistribution(); | 296 BrowserDistribution* dist = BrowserDistribution::GetDistribution(); |
| 297 app_name = ShellUtil::GetBrowserModelId(dist, chrome_exe.value()); | 297 app_name = ShellUtil::GetBrowserModelId( |
| 298 dist, InstallUtil::IsPerUserInstall(chrome_exe.value().c_str())); |
| 298 } | 299 } |
| 299 | 300 |
| 300 expected_app_id->assign( | 301 expected_app_id->assign( |
| 301 ShellIntegration::GetAppModelIdForProfile(app_name, profile_path)); | 302 ShellIntegration::GetAppModelIdForProfile(app_name, profile_path)); |
| 302 return true; | 303 return true; |
| 303 } | 304 } |
| 304 | 305 |
| 305 void MigrateWin7ShortcutsInPath( | 306 void MigrateWin7ShortcutsInPath( |
| 306 const FilePath& chrome_exe, const FilePath& path) { | 307 const FilePath& chrome_exe, const FilePath& path) { |
| 307 // Enumerate all pinned shortcuts in the given path directly. | 308 // Enumerate all pinned shortcuts in the given path directly. |
| (...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 532 | 533 |
| 533 string16 ShellIntegration::GetChromiumModelIdForProfile( | 534 string16 ShellIntegration::GetChromiumModelIdForProfile( |
| 534 const FilePath& profile_path) { | 535 const FilePath& profile_path) { |
| 535 BrowserDistribution* dist = BrowserDistribution::GetDistribution(); | 536 BrowserDistribution* dist = BrowserDistribution::GetDistribution(); |
| 536 FilePath chrome_exe; | 537 FilePath chrome_exe; |
| 537 if (!PathService::Get(base::FILE_EXE, &chrome_exe)) { | 538 if (!PathService::Get(base::FILE_EXE, &chrome_exe)) { |
| 538 NOTREACHED(); | 539 NOTREACHED(); |
| 539 return dist->GetBaseAppId(); | 540 return dist->GetBaseAppId(); |
| 540 } | 541 } |
| 541 return GetAppModelIdForProfile( | 542 return GetAppModelIdForProfile( |
| 542 ShellUtil::GetBrowserModelId(dist, chrome_exe.value()), profile_path); | 543 ShellUtil::GetBrowserModelId( |
| 544 dist, InstallUtil::IsPerUserInstall(chrome_exe.value().c_str())), |
| 545 profile_path); |
| 543 } | 546 } |
| 544 | 547 |
| 545 string16 ShellIntegration::GetChromiumIconPath() { | 548 string16 ShellIntegration::GetChromiumIconPath() { |
| 546 // Determine the app path. If we can't determine what that is, we have | 549 // Determine the app path. If we can't determine what that is, we have |
| 547 // bigger fish to fry... | 550 // bigger fish to fry... |
| 548 FilePath app_path; | 551 FilePath app_path; |
| 549 if (!PathService::Get(base::FILE_EXE, &app_path)) { | 552 if (!PathService::Get(base::FILE_EXE, &app_path)) { |
| 550 NOTREACHED(); | 553 NOTREACHED(); |
| 551 return string16(); | 554 return string16(); |
| 552 } | 555 } |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 586 continue; | 589 continue; |
| 587 } | 590 } |
| 588 | 591 |
| 589 shortcut = shortcut.Append(shortcut_name).Append(shortcut_name + L".lnk"); | 592 shortcut = shortcut.Append(shortcut_name).Append(shortcut_name + L".lnk"); |
| 590 if (file_util::PathExists(shortcut)) | 593 if (file_util::PathExists(shortcut)) |
| 591 return shortcut; | 594 return shortcut; |
| 592 } | 595 } |
| 593 | 596 |
| 594 return FilePath(); | 597 return FilePath(); |
| 595 } | 598 } |
| OLD | NEW |