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

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

Issue 11367002: Add a flag to control whether there is a shortcut for the app list / launcher in the Windows taskba… (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Added comment Created 8 years, 1 month 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/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 23 matching lines...) Expand all
34 #include "chrome/installer/util/shell_util.h" 34 #include "chrome/installer/util/shell_util.h"
35 #include "chrome/installer/util/util_constants.h" 35 #include "chrome/installer/util/util_constants.h"
36 #include "chrome/installer/util/work_item.h" 36 #include "chrome/installer/util/work_item.h"
37 #include "chrome/installer/util/work_item_list.h" 37 #include "chrome/installer/util/work_item_list.h"
38 #include "content/public/browser/browser_thread.h" 38 #include "content/public/browser/browser_thread.h"
39 39
40 using content::BrowserThread; 40 using content::BrowserThread;
41 41
42 namespace { 42 namespace {
43 43
44 #if defined(GOOGLE_CHROME_BUILD)
45 const wchar_t kAppListAppName[] = L"ChromeAppList";
46 #else
47 const wchar_t kAppListAppName[] = L"ChromiumAppList";
48 #endif
49
44 // Helper function for ShellIntegration::GetAppId to generates profile id 50 // Helper function for ShellIntegration::GetAppId to generates profile id
45 // from profile path. "profile_id" is composed of sanitized basenames of 51 // from profile path. "profile_id" is composed of sanitized basenames of
46 // user data dir and profile dir joined by a ".". 52 // user data dir and profile dir joined by a ".".
47 string16 GetProfileIdFromPath(const FilePath& profile_path) { 53 string16 GetProfileIdFromPath(const FilePath& profile_path) {
48 // Return empty string if profile_path is empty 54 // Return empty string if profile_path is empty
49 if (profile_path.empty()) 55 if (profile_path.empty())
50 return string16(); 56 return string16();
51 57
52 FilePath default_user_data_dir; 58 FilePath default_user_data_dir;
53 // Return empty string if profile_path is in default user data 59 // Return empty string if profile_path is in default user data
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 chrome::kInitialProfile); 138 chrome::kInitialProfile);
133 } 139 }
134 140
135 string16 app_name; 141 string16 app_name;
136 if (command_line.HasSwitch(switches::kApp)) { 142 if (command_line.HasSwitch(switches::kApp)) {
137 app_name = UTF8ToUTF16(web_app::GenerateApplicationNameFromURL( 143 app_name = UTF8ToUTF16(web_app::GenerateApplicationNameFromURL(
138 GURL(command_line.GetSwitchValueASCII(switches::kApp)))); 144 GURL(command_line.GetSwitchValueASCII(switches::kApp))));
139 } else if (command_line.HasSwitch(switches::kAppId)) { 145 } else if (command_line.HasSwitch(switches::kAppId)) {
140 app_name = UTF8ToUTF16(web_app::GenerateApplicationNameFromExtensionId( 146 app_name = UTF8ToUTF16(web_app::GenerateApplicationNameFromExtensionId(
141 command_line.GetSwitchValueASCII(switches::kAppId))); 147 command_line.GetSwitchValueASCII(switches::kAppId)));
148 } else if (command_line.HasSwitch(switches::kShowAppList)) {
149 app_name = kAppListAppName;
142 } else { 150 } else {
143 BrowserDistribution* dist = BrowserDistribution::GetDistribution(); 151 BrowserDistribution* dist = BrowserDistribution::GetDistribution();
144 app_name = ShellUtil::GetBrowserModelId( 152 app_name = ShellUtil::GetBrowserModelId(
145 dist, InstallUtil::IsPerUserInstall(chrome_exe.value().c_str())); 153 dist, InstallUtil::IsPerUserInstall(chrome_exe.value().c_str()));
146 } 154 }
147 155
148 expected_app_id->assign( 156 expected_app_id->assign(
149 ShellIntegration::GetAppModelIdForProfile(app_name, profile_path)); 157 ShellIntegration::GetAppModelIdForProfile(app_name, profile_path));
150 return true; 158 return true;
151 } 159 }
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after
404 if (!PathService::Get(base::FILE_EXE, &chrome_exe)) { 412 if (!PathService::Get(base::FILE_EXE, &chrome_exe)) {
405 NOTREACHED(); 413 NOTREACHED();
406 return dist->GetBaseAppId(); 414 return dist->GetBaseAppId();
407 } 415 }
408 return GetAppModelIdForProfile( 416 return GetAppModelIdForProfile(
409 ShellUtil::GetBrowserModelId( 417 ShellUtil::GetBrowserModelId(
410 dist, InstallUtil::IsPerUserInstall(chrome_exe.value().c_str())), 418 dist, InstallUtil::IsPerUserInstall(chrome_exe.value().c_str())),
411 profile_path); 419 profile_path);
412 } 420 }
413 421
422 string16 ShellIntegration::GetAppListAppModelIdForProfile(
423 const FilePath& profile_path) {
424 return ShellIntegration::GetAppModelIdForProfile(kAppListAppName,
425 profile_path);
426 }
427
414 string16 ShellIntegration::GetChromiumIconPath() { 428 string16 ShellIntegration::GetChromiumIconPath() {
415 // Determine the app path. If we can't determine what that is, we have 429 // Determine the app path. If we can't determine what that is, we have
416 // bigger fish to fry... 430 // bigger fish to fry...
417 FilePath app_path; 431 FilePath app_path;
418 if (!PathService::Get(base::FILE_EXE, &app_path)) { 432 if (!PathService::Get(base::FILE_EXE, &app_path)) {
419 NOTREACHED(); 433 NOTREACHED();
420 return string16(); 434 return string16();
421 } 435 }
422 436
423 string16 icon_path(app_path.value()); 437 string16 icon_path(app_path.value());
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
456 } 470 }
457 471
458 shortcut = shortcut.Append(shortcut_name).Append(shortcut_name + 472 shortcut = shortcut.Append(shortcut_name).Append(shortcut_name +
459 installer::kLnkExt); 473 installer::kLnkExt);
460 if (file_util::PathExists(shortcut)) 474 if (file_util::PathExists(shortcut))
461 return shortcut; 475 return shortcut;
462 } 476 }
463 477
464 return FilePath(); 478 return FilePath();
465 } 479 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698