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

Side by Side Diff: chrome/browser/google/google_brand_chromeos.cc

Issue 1493503002: base: get rid of deprecated TrimWhitespace() function (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: REBASE Created 5 years 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "base/basictypes.h" 5 #include "base/basictypes.h"
6 #include "base/bind.h" 6 #include "base/bind.h"
7 #include "base/files/file_path.h" 7 #include "base/files/file_path.h"
8 #include "base/files/file_util.h" 8 #include "base/files/file_util.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/prefs/pref_service.h" 10 #include "base/prefs/pref_service.h"
(...skipping 13 matching lines...) Expand all
24 // Path to file that stores the RLZ brand code on ChromeOS. 24 // Path to file that stores the RLZ brand code on ChromeOS.
25 const base::FilePath::CharType kRLZBrandFilePath[] = 25 const base::FilePath::CharType kRLZBrandFilePath[] =
26 FILE_PATH_LITERAL("/opt/oem/etc/BRAND_CODE"); 26 FILE_PATH_LITERAL("/opt/oem/etc/BRAND_CODE");
27 27
28 // Reads the brand code from file |kRLZBrandFilePath|. 28 // Reads the brand code from file |kRLZBrandFilePath|.
29 std::string ReadBrandFromFile() { 29 std::string ReadBrandFromFile() {
30 std::string brand; 30 std::string brand;
31 base::FilePath brand_file_path(kRLZBrandFilePath); 31 base::FilePath brand_file_path(kRLZBrandFilePath);
32 if (!base::ReadFileToString(brand_file_path, &brand)) 32 if (!base::ReadFileToString(brand_file_path, &brand))
33 LOG(WARNING) << "Brand code file missing: " << brand_file_path.value(); 33 LOG(WARNING) << "Brand code file missing: " << brand_file_path.value();
34 base::TrimWhitespace(brand, base::TRIM_ALL, &brand); 34 base::TrimWhitespaceASCII(brand, base::TRIM_ALL, &brand);
35 return brand; 35 return brand;
36 } 36 }
37 37
38 // Sets the brand code to |brand|. 38 // Sets the brand code to |brand|.
39 void SetBrand(const base::Closure& callback, const std::string& brand) { 39 void SetBrand(const base::Closure& callback, const std::string& brand) {
40 g_browser_process->local_state()->SetString(prefs::kRLZBrand, brand); 40 g_browser_process->local_state()->SetString(prefs::kRLZBrand, brand);
41 callback.Run(); 41 callback.Run();
42 } 42 }
43 43
44 // True if brand code has been cleared for the current session. 44 // True if brand code has been cleared for the current session.
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 78
79 base::PostTaskAndReplyWithResult( 79 base::PostTaskAndReplyWithResult(
80 base::WorkerPool::GetTaskRunner(false /* task_is_slow */).get(), 80 base::WorkerPool::GetTaskRunner(false /* task_is_slow */).get(),
81 FROM_HERE, 81 FROM_HERE,
82 base::Bind(&ReadBrandFromFile), 82 base::Bind(&ReadBrandFromFile),
83 base::Bind(&SetBrand, callback)); 83 base::Bind(&SetBrand, callback));
84 } 84 }
85 85
86 } // namespace chromeos 86 } // namespace chromeos
87 } // namespace google_brand 87 } // namespace google_brand
OLDNEW
« no previous file with comments | « chrome/browser/devtools/device/android_device_manager.cc ('k') | chrome/browser/net/firefox_proxy_settings.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698