| 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_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 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 195 &success_code); | 195 &success_code); |
| 196 } | 196 } |
| 197 } | 197 } |
| 198 | 198 |
| 199 if (!ran_ok || success_code != EXIT_SUCCESS) { | 199 if (!ran_ok || success_code != EXIT_SUCCESS) { |
| 200 // xdg-settings failed: we can't determine or set the default browser. | 200 // xdg-settings failed: we can't determine or set the default browser. |
| 201 return UNKNOWN_DEFAULT; | 201 return UNKNOWN_DEFAULT; |
| 202 } | 202 } |
| 203 | 203 |
| 204 // Allow any reply that starts with "yes". | 204 // Allow any reply that starts with "yes". |
| 205 return (reply.find("yes") == 0) ? IS_DEFAULT : NOT_DEFAULT; | 205 return base::StartsWith(reply, "yes", base::CompareCase::SENSITIVE) |
| 206 ? IS_DEFAULT |
| 207 : NOT_DEFAULT; |
| 206 #endif | 208 #endif |
| 207 } | 209 } |
| 208 | 210 |
| 209 } // namespace | 211 } // namespace |
| 210 | 212 |
| 211 bool SetAsDefaultBrowser() { | 213 bool SetAsDefaultBrowser() { |
| 212 return SetDefaultWebClient(std::string()); | 214 return SetDefaultWebClient(std::string()); |
| 213 } | 215 } |
| 214 | 216 |
| 215 bool SetAsDefaultProtocolClient(const std::string& protocol) { | 217 bool SetAsDefaultProtocolClient(const std::string& protocol) { |
| (...skipping 832 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1048 base::FilePath applications_menu = GetDataWriteLocation(env.get()); | 1050 base::FilePath applications_menu = GetDataWriteLocation(env.get()); |
| 1049 applications_menu = applications_menu.AppendASCII("applications"); | 1051 applications_menu = applications_menu.AppendASCII("applications"); |
| 1050 std::vector<base::FilePath> shortcut_filenames_app_menu = | 1052 std::vector<base::FilePath> shortcut_filenames_app_menu = |
| 1051 GetExistingProfileShortcutFilenames(profile_path, applications_menu); | 1053 GetExistingProfileShortcutFilenames(profile_path, applications_menu); |
| 1052 for (const auto& menu : shortcut_filenames_app_menu) { | 1054 for (const auto& menu : shortcut_filenames_app_menu) { |
| 1053 DeleteShortcutInApplicationsMenu(menu, base::FilePath(kDirectoryFilename)); | 1055 DeleteShortcutInApplicationsMenu(menu, base::FilePath(kDirectoryFilename)); |
| 1054 } | 1056 } |
| 1055 } | 1057 } |
| 1056 | 1058 |
| 1057 } // namespace shell_integration_linux | 1059 } // namespace shell_integration_linux |
| OLD | NEW |