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

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

Issue 10920091: Move Drive API files to google_apis directory (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rename google_api directory to google_apis Created 8 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 (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/gdata/gdata_util.h" 5 #include "chrome/browser/google_apis/gdata_util.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 #include <utility> 9 #include <utility>
10 10
11 #include "base/basictypes.h" 11 #include "base/basictypes.h"
12 #include "base/bind.h" 12 #include "base/bind.h"
13 #include "base/bind_helpers.h" 13 #include "base/bind_helpers.h"
14 #include "base/command_line.h" 14 #include "base/command_line.h"
15 #include "base/file_path.h" 15 #include "base/file_path.h"
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 if (num_of_token > 1 && !base::StringToInt(parts[1], &minute)) 58 if (num_of_token > 1 && !base::StringToInt(parts[1], &minute))
59 return false; 59 return false;
60 60
61 *out_offset_to_utc_in_minutes = (hour * 60 + minute) * (ahead ? +1 : -1); 61 *out_offset_to_utc_in_minutes = (hour * 60 + minute) * (ahead ? +1 : -1);
62 return true; 62 return true;
63 } 63 }
64 64
65 } // namespace 65 } // namespace
66 66
67 bool IsGDataAvailable(Profile* profile) { 67 bool IsGDataAvailable(Profile* profile) {
68 #if defined(OS_CHROMEOS)
68 if (!chromeos::UserManager::Get()->IsUserLoggedIn() || 69 if (!chromeos::UserManager::Get()->IsUserLoggedIn() ||
69 chromeos::UserManager::Get()->IsLoggedInAsGuest() || 70 chromeos::UserManager::Get()->IsLoggedInAsGuest() ||
70 chromeos::UserManager::Get()->IsLoggedInAsDemoUser()) 71 chromeos::UserManager::Get()->IsLoggedInAsDemoUser())
71 return false; 72 return false;
72 73
73 // Do not allow GData for incognito windows / guest mode. 74 // Do not allow GData for incognito windows / guest mode.
74 if (profile->IsOffTheRecord()) 75 if (profile->IsOffTheRecord())
75 return false; 76 return false;
76 77
77 // Disable gdata if preference is set. This can happen with commandline flag 78 // Disable gdata if preference is set. This can happen with commandline flag
78 // --disable-gdata or enterprise policy, or probably with user settings too 79 // --disable-gdata or enterprise policy, or probably with user settings too
79 // in the future. 80 // in the future.
80 if (profile->GetPrefs()->GetBoolean(prefs::kDisableGData)) 81 if (profile->GetPrefs()->GetBoolean(prefs::kDisableGData))
81 return false; 82 return false;
82 83
83 return true; 84 return true;
85 #else
86 return false;
kochi 2012/09/07 06:56:21 Can you add a TODO() here for what's necessary for
nhiroki 2012/09/07 09:06:26 Done.
87 #endif
84 } 88 }
85 89
86 bool IsDriveV2ApiEnabled() { 90 bool IsDriveV2ApiEnabled() {
87 static bool enabled = CommandLine::ForCurrentProcess()->HasSwitch( 91 static bool enabled = CommandLine::ForCurrentProcess()->HasSwitch(
88 switches::kEnableDriveV2Api); 92 switches::kEnableDriveV2Api);
89 return enabled; 93 return enabled;
90 } 94 }
91 95
92 base::PlatformFileError DriveFileErrorToPlatformError( 96 base::PlatformFileError DriveFileErrorToPlatformError(
93 gdata::DriveFileError error) { 97 gdata::DriveFileError error) {
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
285 const base::Closure& reply_task) { 289 const base::Closure& reply_task) {
286 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 290 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
287 291
288 const bool posted = blocking_task_runner->PostTaskAndReply( 292 const bool posted = blocking_task_runner->PostTaskAndReply(
289 from_here, request_task, reply_task); 293 from_here, request_task, reply_task);
290 DCHECK(posted); 294 DCHECK(posted);
291 } 295 }
292 296
293 } // namespace util 297 } // namespace util
294 } // namespace gdata 298 } // namespace gdata
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698