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

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

Issue 19579005: Move ReadFileToString to the base namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 3 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/sxs_linux.h" 5 #include "chrome/browser/sxs_linux.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/file_util.h" 10 #include "base/file_util.h"
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 // Rely on -Wswitch compiler warning to detect unhandled enum values. 51 // Rely on -Wswitch compiler warning to detect unhandled enum values.
52 } 52 }
53 53
54 base::FilePath channels_path(user_data_dir.AppendASCII("Channels")); 54 base::FilePath channels_path(user_data_dir.AppendASCII("Channels"));
55 std::vector<std::string> user_data_dir_channels; 55 std::vector<std::string> user_data_dir_channels;
56 56
57 // Note: failure to read the channels file is not fatal. It's possible 57 // Note: failure to read the channels file is not fatal. It's possible
58 // and legitimate that it doesn't exist, e.g. for new profile or for profile 58 // and legitimate that it doesn't exist, e.g. for new profile or for profile
59 // existing before channel marks have been introduced. 59 // existing before channel marks have been introduced.
60 std::string channels_contents; 60 std::string channels_contents;
61 if (file_util::ReadFileToString(channels_path, &channels_contents)) 61 if (base::ReadFileToString(channels_path, &channels_contents))
62 base::SplitString(channels_contents, '\n', &user_data_dir_channels); 62 base::SplitString(channels_contents, '\n', &user_data_dir_channels);
63 63
64 if (std::find(user_data_dir_channels.begin(), 64 if (std::find(user_data_dir_channels.begin(),
65 user_data_dir_channels.end(), 65 user_data_dir_channels.end(),
66 product_channel_name) != user_data_dir_channels.end()) { 66 product_channel_name) != user_data_dir_channels.end()) {
67 // No need to do further disk writes if our channel mark is already present. 67 // No need to do further disk writes if our channel mark is already present.
68 return true; 68 return true;
69 } 69 }
70 70
71 user_data_dir_channels.push_back(product_channel_name); 71 user_data_dir_channels.push_back(product_channel_name);
(...skipping 16 matching lines...) Expand all
88 } 88 }
89 89
90 if (!DoAddChannelMarkToUserDataDir(user_data_dir)) { 90 if (!DoAddChannelMarkToUserDataDir(user_data_dir)) {
91 LOG(ERROR) << "Failed to add channel mark to the user data dir (" 91 LOG(ERROR) << "Failed to add channel mark to the user data dir ("
92 << user_data_dir.value() << "). This profile will not be " 92 << user_data_dir.value() << "). This profile will not be "
93 << "automatically migrated for updated Linux packages."; 93 << "automatically migrated for updated Linux packages.";
94 } 94 }
95 } 95 }
96 96
97 } // namespace sxs_linux 97 } // namespace sxs_linux
OLDNEW
« no previous file with comments | « chrome/browser/ssl/ssl_browser_tests.cc ('k') | chrome/browser/sync/profile_sync_service_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698