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

Side by Side Diff: chrome/browser/google_apis/gdata_util.cc

Issue 11363234: google_apis: Remove PostBlockingPoolSequencedTask () and friends (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: address comments Created 8 years, 1 month 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
« no previous file with comments | « chrome/browser/google_apis/gdata_util.h ('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 #include "chrome/browser/google_apis/gdata_util.h" 5 #include "chrome/browser/google_apis/gdata_util.h"
6 6
7 #include <map> 7 #include <map>
8 #include <string> 8 #include <string>
9 #include <utility> 9 #include <utility>
10 #include <vector> 10 #include <vector>
11 11
12 #include "base/basictypes.h" 12 #include "base/basictypes.h"
13 #include "base/command_line.h" 13 #include "base/command_line.h"
14 #include "base/logging.h" 14 #include "base/logging.h"
15 #include "base/platform_file.h"
15 #include "base/string_number_conversions.h" 16 #include "base/string_number_conversions.h"
16 #include "base/string_util.h" 17 #include "base/string_util.h"
17 #include "base/stringprintf.h" 18 #include "base/stringprintf.h"
18 #include "base/time.h" 19 #include "base/time.h"
19 #include "base/tracked_objects.h"
20 #include "chrome/browser/google_apis/auth_service.h"
21 #include "chrome/browser/prefs/pref_service.h"
22 #include "chrome/browser/profiles/profile.h"
23 #include "chrome/common/chrome_switches.h" 20 #include "chrome/common/chrome_switches.h"
24 #include "chrome/common/pref_names.h"
25 #include "content/public/browser/browser_thread.h"
26
27 using content::BrowserThread;
28 21
29 namespace google_apis { 22 namespace google_apis {
30 namespace util { 23 namespace util {
31 24
32 namespace { 25 namespace {
33 26
34 const char kGDataSpecialRootPath[] = "/special";
35
36 const char kGDataMountPointPath[] = "/special/drive";
37
38 const int kReadOnlyFilePermissions = base::PLATFORM_FILE_OPEN |
39 base::PLATFORM_FILE_READ |
40 base::PLATFORM_FILE_EXCLUSIVE_READ |
41 base::PLATFORM_FILE_ASYNC;
42
43 bool ParseTimezone(const base::StringPiece& timezone, 27 bool ParseTimezone(const base::StringPiece& timezone,
44 bool ahead, 28 bool ahead,
45 int* out_offset_to_utc_in_minutes) { 29 int* out_offset_to_utc_in_minutes) {
46 DCHECK(out_offset_to_utc_in_minutes); 30 DCHECK(out_offset_to_utc_in_minutes);
47 31
48 std::vector<base::StringPiece> parts; 32 std::vector<base::StringPiece> parts;
49 int num_of_token = Tokenize(timezone, ":", &parts); 33 int num_of_token = Tokenize(timezone, ":", &parts);
50 34
51 int hour = 0; 35 int hour = 0;
52 if (!base::StringToInt(parts[0], &hour)) 36 if (!base::StringToInt(parts[0], &hour))
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 std::string FormatTimeAsStringLocaltime(const base::Time& time) { 164 std::string FormatTimeAsStringLocaltime(const base::Time& time) {
181 base::Time::Exploded exploded; 165 base::Time::Exploded exploded;
182 time.LocalExplode(&exploded); 166 time.LocalExplode(&exploded);
183 167
184 return base::StringPrintf( 168 return base::StringPrintf(
185 "%04d-%02d-%02dT%02d:%02d:%02d.%03d", 169 "%04d-%02d-%02dT%02d:%02d:%02d.%03d",
186 exploded.year, exploded.month, exploded.day_of_month, 170 exploded.year, exploded.month, exploded.day_of_month,
187 exploded.hour, exploded.minute, exploded.second, exploded.millisecond); 171 exploded.hour, exploded.minute, exploded.second, exploded.millisecond);
188 } 172 }
189 173
190 void PostBlockingPoolSequencedTask(
191 const tracked_objects::Location& from_here,
192 base::SequencedTaskRunner* blocking_task_runner,
193 const base::Closure& task) {
194 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
195
196 const bool posted = blocking_task_runner->PostTask(from_here, task);
197 DCHECK(posted);
198 }
199
200 void PostBlockingPoolSequencedTaskAndReply(
201 const tracked_objects::Location& from_here,
202 base::SequencedTaskRunner* blocking_task_runner,
203 const base::Closure& request_task,
204 const base::Closure& reply_task) {
205 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
206
207 const bool posted = blocking_task_runner->PostTaskAndReply(
208 from_here, request_task, reply_task);
209 DCHECK(posted);
210 }
211
212 } // namespace util 174 } // namespace util
213 } // namespace google_apis 175 } // namespace google_apis
OLDNEW
« no previous file with comments | « chrome/browser/google_apis/gdata_util.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698