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

Side by Side Diff: chrome/browser/chromeos/drive/file_system_util.cc

Issue 1172183002: Move StartsWith[ASCII] to base namespace. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@string_util3
Patch Set: merger Created 5 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
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 #include "chrome/browser/chromeos/drive/file_system_util.h" 5 #include "chrome/browser/chromeos/drive/file_system_util.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 177
178 base::FilePath ExtractDrivePath(const base::FilePath& path) { 178 base::FilePath ExtractDrivePath(const base::FilePath& path) {
179 std::vector<base::FilePath::StringType> components; 179 std::vector<base::FilePath::StringType> components;
180 path.GetComponents(&components); 180 path.GetComponents(&components);
181 if (components.size() < 3) 181 if (components.size() < 3)
182 return base::FilePath(); 182 return base::FilePath();
183 if (components[0] != FILE_PATH_LITERAL("/")) 183 if (components[0] != FILE_PATH_LITERAL("/"))
184 return base::FilePath(); 184 return base::FilePath();
185 if (components[1] != FILE_PATH_LITERAL("special")) 185 if (components[1] != FILE_PATH_LITERAL("special"))
186 return base::FilePath(); 186 return base::FilePath();
187 if (!StartsWithASCII(components[2], "drive", true)) 187 if (!base::StartsWithASCII(components[2], "drive", true))
188 return base::FilePath(); 188 return base::FilePath();
189 189
190 base::FilePath drive_path = GetDriveGrandRootPath(); 190 base::FilePath drive_path = GetDriveGrandRootPath();
191 for (size_t i = 3; i < components.size(); ++i) 191 for (size_t i = 3; i < components.size(); ++i)
192 drive_path = drive_path.Append(components[i]); 192 drive_path = drive_path.Append(components[i]);
193 return drive_path; 193 return drive_path;
194 } 194 }
195 195
196 Profile* ExtractProfileFromPath(const base::FilePath& path) { 196 Profile* ExtractProfileFromPath(const base::FilePath& path) {
197 DCHECK_CURRENTLY_ON(BrowserThread::UI); 197 DCHECK_CURRENTLY_ON(BrowserThread::UI);
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
357 const bool disable_sync_over_celluar = 357 const bool disable_sync_over_celluar =
358 profile->GetPrefs()->GetBoolean(prefs::kDisableDriveOverCellular); 358 profile->GetPrefs()->GetBoolean(prefs::kDisableDriveOverCellular);
359 359
360 if (is_connection_cellular && disable_sync_over_celluar) 360 if (is_connection_cellular && disable_sync_over_celluar)
361 return DRIVE_CONNECTED_METERED; 361 return DRIVE_CONNECTED_METERED;
362 return DRIVE_CONNECTED; 362 return DRIVE_CONNECTED;
363 } 363 }
364 364
365 } // namespace util 365 } // namespace util
366 } // namespace drive 366 } // namespace drive
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/chromeos_utils.cc ('k') | chrome/browser/chromeos/file_manager/file_tasks.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698