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

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

Issue 6152003: Get rid of FilePath::FromWStringHack from google_chrome_distribution.[cc,h]. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 11 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
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 specific implementation of BrowserDistribution class for 5 // This file defines specific implementation of BrowserDistribution class for
6 // Google Chrome. 6 // Google Chrome.
7 7
8 #include "chrome/installer/util/google_chrome_distribution.h" 8 #include "chrome/installer/util/google_chrome_distribution.h"
9 9
10 #include <windows.h> 10 #include <windows.h>
11 #include <wtsapi32.h> 11 #include <wtsapi32.h>
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after
275 275
276 std::string value; 276 std::string value;
277 uninstall_metrics_dict->GetStringWithoutPathExpansion(*iter, &value); 277 uninstall_metrics_dict->GetStringWithoutPathExpansion(*iter, &value);
278 metrics->append(UTF8ToWide(value)); 278 metrics->append(UTF8ToWide(value));
279 } 279 }
280 280
281 return has_values; 281 return has_values;
282 } 282 }
283 283
284 bool GoogleChromeDistribution::ExtractUninstallMetricsFromFile( 284 bool GoogleChromeDistribution::ExtractUninstallMetricsFromFile(
285 const std::wstring& file_path, std::wstring* uninstall_metrics_string) { 285 const FilePath& file_path,
286 286 std::wstring* uninstall_metrics_string) {
287 JSONFileValueSerializer json_serializer(FilePath::FromWStringHack(file_path)); 287 JSONFileValueSerializer json_serializer(file_path);
288 288
289 std::string json_error_string; 289 std::string json_error_string;
290 scoped_ptr<Value> root(json_serializer.Deserialize(NULL, NULL)); 290 scoped_ptr<Value> root(json_serializer.Deserialize(NULL, NULL));
291 if (!root.get()) 291 if (!root.get())
292 return false; 292 return false;
293 293
294 // Preferences should always have a dictionary root. 294 // Preferences should always have a dictionary root.
295 if (!root->IsType(Value::TYPE_DICTIONARY)) 295 if (!root->IsType(Value::TYPE_DICTIONARY))
296 return false; 296 return false;
297 297
(...skipping 22 matching lines...) Expand all
320 if (!BuildUninstallMetricsString(uninstall_metrics_dict, 320 if (!BuildUninstallMetricsString(uninstall_metrics_dict,
321 uninstall_metrics_string)) { 321 uninstall_metrics_string)) {
322 return false; 322 return false;
323 } 323 }
324 324
325 return true; 325 return true;
326 } 326 }
327 #endif 327 #endif
328 328
329 void GoogleChromeDistribution::DoPostUninstallOperations( 329 void GoogleChromeDistribution::DoPostUninstallOperations(
330 const Version& version, const FilePath& local_data_path, 330 const Version& version,
331 const FilePath& local_data_path,
331 const std::wstring& distribution_data) { 332 const std::wstring& distribution_data) {
332 // Send the Chrome version and OS version as params to the form. 333 // Send the Chrome version and OS version as params to the form.
333 // It would be nice to send the locale, too, but I don't see an 334 // It would be nice to send the locale, too, but I don't see an
334 // easy way to get that in the existing code. It's something we 335 // easy way to get that in the existing code. It's something we
335 // can add later, if needed. 336 // can add later, if needed.
336 // We depend on installed_version.GetString() not having spaces or other 337 // We depend on installed_version.GetString() not having spaces or other
337 // characters that need escaping: 0.2.13.4. Should that change, we will 338 // characters that need escaping: 0.2.13.4. Should that change, we will
338 // need to escape the string before using it in a URL. 339 // need to escape the string before using it in a URL.
339 const std::wstring kVersionParam = L"crversion"; 340 const std::wstring kVersionParam = L"crversion";
340 const std::wstring kOSParam = L"os"; 341 const std::wstring kOSParam = L"os";
(...skipping 11 matching lines...) Expand all
352 return; 353 return;
353 354
354 iexplore = iexplore.AppendASCII("Internet Explorer"); 355 iexplore = iexplore.AppendASCII("Internet Explorer");
355 iexplore = iexplore.AppendASCII("iexplore.exe"); 356 iexplore = iexplore.AppendASCII("iexplore.exe");
356 357
357 std::wstring command = iexplore.value() + L" " + GetUninstallSurveyUrl() + 358 std::wstring command = iexplore.value() + L" " + GetUninstallSurveyUrl() +
358 L"&" + kVersionParam + L"=" + UTF8ToWide(version.GetString()) + L"&" + 359 L"&" + kVersionParam + L"=" + UTF8ToWide(version.GetString()) + L"&" +
359 kOSParam + L"=" + os_version; 360 kOSParam + L"=" + os_version;
360 361
361 std::wstring uninstall_metrics; 362 std::wstring uninstall_metrics;
362 if (ExtractUninstallMetricsFromFile(local_data_path.value(), 363 if (ExtractUninstallMetricsFromFile(local_data_path, &uninstall_metrics)) {
363 &uninstall_metrics)) {
364 // The user has opted into anonymous usage data collection, so append 364 // The user has opted into anonymous usage data collection, so append
365 // metrics and distribution data. 365 // metrics and distribution data.
366 command += uninstall_metrics; 366 command += uninstall_metrics;
367 if (!distribution_data.empty()) { 367 if (!distribution_data.empty()) {
368 command += L"&"; 368 command += L"&";
369 command += distribution_data; 369 command += distribution_data;
370 } 370 }
371 } 371 }
372 372
373 int pid = 0; 373 int pid = 0;
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after
688 base::LaunchApp(cmd, false, false, NULL); 688 base::LaunchApp(cmd, false, false, NULL);
689 } 689 }
690 #endif 690 #endif
691 691
692 bool GoogleChromeDistribution::SetChannelFlags( 692 bool GoogleChromeDistribution::SetChannelFlags(
693 bool set, 693 bool set,
694 installer::ChannelInfo* channel_info) { 694 installer::ChannelInfo* channel_info) {
695 DCHECK(channel_info); 695 DCHECK(channel_info);
696 return channel_info->SetChrome(set); 696 return channel_info->SetChrome(set);
697 } 697 }
OLDNEW
« no previous file with comments | « chrome/installer/util/google_chrome_distribution.h ('k') | chrome/installer/util/google_chrome_distribution_dummy.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698