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

Side by Side Diff: chrome/installer/util/shell_util.cc

Issue 10559097: Replace all spaces by '_' in the AppUserModelId (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 6 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 | Annotate | Revision Log
« base/win/win_util.cc ('K') | « base/win/win_util.cc ('k') | no next file » | 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 // This file defines functions that integrate Chrome in Windows shell. These 5 // This file defines functions that integrate Chrome in Windows shell. These
6 // functions can be used by Chrome as well as Chrome installer. All of the 6 // functions can be used by Chrome as well as Chrome installer. All of the
7 // work is done by the local functions defined in anonymous namespace in 7 // work is done by the local functions defined in anonymous namespace in
8 // this class. 8 // this class.
9 9
10 #include "chrome/installer/util/shell_util.h" 10 #include "chrome/installer/util/shell_util.h"
(...skipping 1098 matching lines...) Expand 10 before | Expand all | Expand 10 after
1109 return (*components.begin()).substr(0, installer::kMaxAppModelIdLength); 1109 return (*components.begin()).substr(0, installer::kMaxAppModelIdLength);
1110 } 1110 }
1111 1111
1112 string16 app_id; 1112 string16 app_id;
1113 app_id.reserve(installer::kMaxAppModelIdLength); 1113 app_id.reserve(installer::kMaxAppModelIdLength);
1114 for (std::vector<string16>::const_iterator it = components.begin(); 1114 for (std::vector<string16>::const_iterator it = components.begin();
1115 it != components.end(); ++it) { 1115 it != components.end(); ++it) {
1116 if (it != components.begin()) 1116 if (it != components.begin())
1117 app_id.push_back(L'.'); 1117 app_id.push_back(L'.');
1118 1118
1119 const string16& component = *it; 1119 string16 component = *it;
1120 DCHECK(!component.empty()); 1120 DCHECK(!component.empty());
1121 // No spaces are allowed in the AppUserModelId according to MSDN.
1122 ReplaceChars(component, L" ", L"_", &component);
robertshield 2012/06/20 21:50:16 could you do this replacement at the end of the lo
gab 2012/06/20 21:58:36 Done.
1121 if (component.length() > max_component_length) { 1123 if (component.length() > max_component_length) {
1122 // Append a shortened version of this component. Cut in the middle to try 1124 // Append a shortened version of this component. Cut in the middle to try
1123 // to avoid losing the unique parts of this component (which are usually 1125 // to avoid losing the unique parts of this component (which are usually
1124 // at the beginning or end for things like usernames and paths). 1126 // at the beginning or end for things like usernames and paths).
1125 app_id.append(component.c_str(), 0, max_component_length / 2); 1127 app_id.append(component.c_str(), 0, max_component_length / 2);
1126 app_id.append(component.c_str(), 1128 app_id.append(component.c_str(),
1127 component.length() - ((max_component_length + 1) / 2), 1129 component.length() - ((max_component_length + 1) / 2),
1128 string16::npos); 1130 string16::npos);
1129 } else { 1131 } else {
1130 app_id.append(component); 1132 app_id.append(component);
(...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after
1511 chrome_exe.c_str(), 1513 chrome_exe.c_str(),
1512 shortcut.c_str(), 1514 shortcut.c_str(),
1513 chrome_path.value().c_str(), 1515 chrome_path.value().c_str(),
1514 arguments.c_str(), 1516 arguments.c_str(),
1515 description.c_str(), 1517 description.c_str(),
1516 icon_path.c_str(), 1518 icon_path.c_str(),
1517 icon_index, 1519 icon_index,
1518 app_id.c_str(), 1520 app_id.c_str(),
1519 ConvertShellUtilShortcutOptionsToFileUtil(options)); 1521 ConvertShellUtilShortcutOptionsToFileUtil(options));
1520 } 1522 }
OLDNEW
« base/win/win_util.cc ('K') | « base/win/win_util.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698