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

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

Issue 2129413002: Use output_all_resource_defines=false in some chrome/ grd files. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase, address comment, more whitelist.cc cleanup Created 4 years, 5 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/common/common_resources.grd » ('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 <stddef.h> 8 #include <stddef.h>
9 9
10 #include <memory> 10 #include <memory>
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after
245 DefaultWebClientState IsDefaultProtocolClient(const std::string& protocol) { 245 DefaultWebClientState IsDefaultProtocolClient(const std::string& protocol) {
246 return GetIsDefaultWebClient(protocol); 246 return GetIsDefaultWebClient(protocol);
247 } 247 }
248 248
249 } // namespace shell_integration 249 } // namespace shell_integration
250 250
251 namespace shell_integration_linux { 251 namespace shell_integration_linux {
252 252
253 namespace { 253 namespace {
254 254
255 #if defined(ENABLE_APP_LIST)
255 // The Categories for the App Launcher desktop shortcut. Should be the same as 256 // The Categories for the App Launcher desktop shortcut. Should be the same as
256 // the Chrome desktop shortcut, so they are in the same sub-menu. 257 // the Chrome desktop shortcut, so they are in the same sub-menu.
257 const char kAppListCategories[] = "Network;WebBrowser;"; 258 const char kAppListCategories[] = "Network;WebBrowser;";
259 #endif
258 260
259 std::string CreateShortcutIcon(const gfx::ImageFamily& icon_images, 261 std::string CreateShortcutIcon(const gfx::ImageFamily& icon_images,
260 const base::FilePath& shortcut_filename) { 262 const base::FilePath& shortcut_filename) {
261 if (icon_images.empty()) 263 if (icon_images.empty())
262 return std::string(); 264 return std::string();
263 265
264 // TODO(phajdan.jr): Report errors from this function, possibly as infobars. 266 // TODO(phajdan.jr): Report errors from this function, possibly as infobars.
265 base::ScopedTempDir temp_dir; 267 base::ScopedTempDir temp_dir;
266 if (!temp_dir.CreateUniqueTempDir()) 268 if (!temp_dir.CreateUniqueTempDir())
267 return std::string(); 269 return std::string();
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
475 return quoted_path; 477 return quoted_path;
476 } 478 }
477 479
478 const char kDesktopEntry[] = "Desktop Entry"; 480 const char kDesktopEntry[] = "Desktop Entry";
479 481
480 const char kXdgOpenShebang[] = "#!/usr/bin/env xdg-open"; 482 const char kXdgOpenShebang[] = "#!/usr/bin/env xdg-open";
481 #endif 483 #endif
482 484
483 const char kDirectoryFilename[] = "chrome-apps.directory"; 485 const char kDirectoryFilename[] = "chrome-apps.directory";
484 486
487 #if defined(ENABLE_APP_LIST)
485 #if defined(GOOGLE_CHROME_BUILD) 488 #if defined(GOOGLE_CHROME_BUILD)
486 const char kAppListDesktopName[] = "chrome-app-list"; 489 const char kAppListDesktopName[] = "chrome-app-list";
487 #else // CHROMIUM_BUILD 490 #else // CHROMIUM_BUILD
488 const char kAppListDesktopName[] = "chromium-app-list"; 491 const char kAppListDesktopName[] = "chromium-app-list";
489 #endif 492 #endif
493 #endif
490 494
491 // Get the value of NoDisplay from the [Desktop Entry] section of a .desktop 495 // Get the value of NoDisplay from the [Desktop Entry] section of a .desktop
492 // file, given in |shortcut_contents|. If the key is not found, returns false. 496 // file, given in |shortcut_contents|. If the key is not found, returns false.
493 bool GetNoDisplayFromDesktopFile(const std::string& shortcut_contents) { 497 bool GetNoDisplayFromDesktopFile(const std::string& shortcut_contents) {
494 #if defined(USE_GLIB) 498 #if defined(USE_GLIB)
495 // An empty file causes a crash with glib <= 2.32, so special case here. 499 // An empty file causes a crash with glib <= 2.32, so special case here.
496 if (shortcut_contents.empty()) 500 if (shortcut_contents.empty())
497 return false; 501 return false;
498 502
499 GKeyFile* key_file = g_key_file_new(); 503 GKeyFile* key_file = g_key_file_new();
(...skipping 467 matching lines...) Expand 10 before | Expand all | Expand 10 after
967 "", 971 "",
968 creation_locations.applications_menu_location == 972 creation_locations.applications_menu_location ==
969 web_app::APP_MENU_LOCATION_HIDDEN); 973 web_app::APP_MENU_LOCATION_HIDDEN);
970 success = CreateShortcutInApplicationsMenu( 974 success = CreateShortcutInApplicationsMenu(
971 shortcut_filename, contents, directory_filename, directory_contents) && 975 shortcut_filename, contents, directory_filename, directory_contents) &&
972 success; 976 success;
973 977
974 return success; 978 return success;
975 } 979 }
976 980
981 #if defined(ENABLE_APP_LIST)
977 bool CreateAppListDesktopShortcut( 982 bool CreateAppListDesktopShortcut(
978 const std::string& wm_class, 983 const std::string& wm_class,
979 const std::string& title) { 984 const std::string& title) {
980 DCHECK_CURRENTLY_ON(BrowserThread::FILE); 985 DCHECK_CURRENTLY_ON(BrowserThread::FILE);
981 986
982 base::FilePath desktop_name(kAppListDesktopName); 987 base::FilePath desktop_name(kAppListDesktopName);
983 base::FilePath shortcut_filename = desktop_name.AddExtension("desktop"); 988 base::FilePath shortcut_filename = desktop_name.AddExtension("desktop");
984 989
985 // We do not want duplicate shortcuts. Delete any that already exist and 990 // We do not want duplicate shortcuts. Delete any that already exist and
986 // replace them. 991 // replace them.
(...skipping 19 matching lines...) Expand all
1006 GetDesktopFileContentsForCommand(command_line, 1011 GetDesktopFileContentsForCommand(command_line,
1007 wm_class, 1012 wm_class,
1008 GURL(), 1013 GURL(),
1009 base::UTF8ToUTF16(title), 1014 base::UTF8ToUTF16(title),
1010 icon_name, 1015 icon_name,
1011 kAppListCategories, 1016 kAppListCategories,
1012 false); 1017 false);
1013 return CreateShortcutInApplicationsMenu( 1018 return CreateShortcutInApplicationsMenu(
1014 shortcut_filename, contents, base::FilePath(), ""); 1019 shortcut_filename, contents, base::FilePath(), "");
1015 } 1020 }
1021 #endif
1016 1022
1017 void DeleteDesktopShortcuts(const base::FilePath& profile_path, 1023 void DeleteDesktopShortcuts(const base::FilePath& profile_path,
1018 const std::string& extension_id) { 1024 const std::string& extension_id) {
1019 DCHECK_CURRENTLY_ON(BrowserThread::FILE); 1025 DCHECK_CURRENTLY_ON(BrowserThread::FILE);
1020 1026
1021 base::FilePath shortcut_filename = GetExtensionShortcutFilename( 1027 base::FilePath shortcut_filename = GetExtensionShortcutFilename(
1022 profile_path, extension_id); 1028 profile_path, extension_id);
1023 DCHECK(!shortcut_filename.empty()); 1029 DCHECK(!shortcut_filename.empty());
1024 1030
1025 DeleteShortcutOnDesktop(shortcut_filename); 1031 DeleteShortcutOnDesktop(shortcut_filename);
(...skipping 24 matching lines...) Expand all
1050 base::FilePath applications_menu = GetDataWriteLocation(env.get()); 1056 base::FilePath applications_menu = GetDataWriteLocation(env.get());
1051 applications_menu = applications_menu.AppendASCII("applications"); 1057 applications_menu = applications_menu.AppendASCII("applications");
1052 std::vector<base::FilePath> shortcut_filenames_app_menu = 1058 std::vector<base::FilePath> shortcut_filenames_app_menu =
1053 GetExistingProfileShortcutFilenames(profile_path, applications_menu); 1059 GetExistingProfileShortcutFilenames(profile_path, applications_menu);
1054 for (const auto& menu : shortcut_filenames_app_menu) { 1060 for (const auto& menu : shortcut_filenames_app_menu) {
1055 DeleteShortcutInApplicationsMenu(menu, base::FilePath(kDirectoryFilename)); 1061 DeleteShortcutInApplicationsMenu(menu, base::FilePath(kDirectoryFilename));
1056 } 1062 }
1057 } 1063 }
1058 1064
1059 } // namespace shell_integration_linux 1065 } // namespace shell_integration_linux
OLDNEW
« no previous file with comments | « chrome/browser/shell_integration_linux.h ('k') | chrome/common/common_resources.grd » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698