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

Side by Side Diff: chrome/browser/chromeos/gdata/gdata_util.cc

Issue 10285002: Revert 134774 because of win aura compile and chromium os browser_test crashes - Created uber tray … (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 7 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/chromeos/gdata/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/file_path.h" 14 #include "base/file_path.h"
15 #include "base/file_util.h" 15 #include "base/file_util.h"
16 #include "base/json/json_reader.h" 16 #include "base/json/json_reader.h"
17 #include "base/logging.h" 17 #include "base/logging.h"
18 #include "base/stringprintf.h" 18 #include "base/stringprintf.h"
19 #include "base/string_util.h" 19 #include "base/string_util.h"
20 #include "base/threading/sequenced_worker_pool.h" 20 #include "base/threading/sequenced_worker_pool.h"
21 #include "chrome/common/chrome_version_info.h" 21 #include "chrome/common/chrome_version_info.h"
22 #include "chrome/common/libxml_utils.h" 22 #include "chrome/common/libxml_utils.h"
23 #include "chrome/common/pref_names.h" 23 #include "chrome/common/pref_names.h"
24 #include "chrome/common/url_constants.h" 24 #include "chrome/common/url_constants.h"
25 #include "chrome/browser/chromeos/gdata/gdata_file_system.h" 25 #include "chrome/browser/chromeos/gdata/gdata_file_system.h"
26 #include "chrome/browser/chromeos/gdata/gdata_system_service.h" 26 #include "chrome/browser/chromeos/gdata/gdata_system_service.h"
27 #include "chrome/browser/chromeos/login/user.h"
28 #include "chrome/browser/chromeos/login/user_manager.h"
29 #include "chrome/browser/prefs/pref_service.h" 27 #include "chrome/browser/prefs/pref_service.h"
30 #include "chrome/browser/profiles/profile.h" 28 #include "chrome/browser/profiles/profile.h"
31 #include "chrome/browser/ui/browser.h" 29 #include "chrome/browser/ui/browser.h"
32 #include "chrome/browser/ui/browser_list.h" 30 #include "chrome/browser/ui/browser_list.h"
33 #include "content/public/browser/browser_thread.h" 31 #include "content/public/browser/browser_thread.h"
34 #include "content/public/browser/child_process_security_policy.h" 32 #include "content/public/browser/child_process_security_policy.h"
35 #include "net/base/escape.h" 33 #include "net/base/escape.h"
36 34
37 namespace gdata { 35 namespace gdata {
38 namespace util { 36 namespace util {
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 kReadOnlyFilePermissions)); 229 kReadOnlyFilePermissions));
232 cache_paths->push_back(std::make_pair( 230 cache_paths->push_back(std::make_pair(
233 file_system->GetCacheFilePath(resource_id, file_md5, 231 file_system->GetCacheFilePath(resource_id, file_md5,
234 GDataRootDirectory::CACHE_TYPE_TMP, 232 GDataRootDirectory::CACHE_TYPE_TMP,
235 GDataFileSystem::CACHED_FILE_FROM_SERVER), 233 GDataFileSystem::CACHED_FILE_FROM_SERVER),
236 kReadOnlyFilePermissions)); 234 kReadOnlyFilePermissions));
237 235
238 } 236 }
239 237
240 bool IsGDataAvailable(Profile* profile) { 238 bool IsGDataAvailable(Profile* profile) {
241 if (!chromeos::UserManager::Get()->IsUserLoggedIn() ||
242 chromeos::UserManager::Get()->IsLoggedInAsGuest() ||
243 chromeos::UserManager::Get()->IsLoggedInAsDemoUser())
244 return false;
245
246 // Do not allow GData for incognito windows / guest mode. 239 // Do not allow GData for incognito windows / guest mode.
247 if (profile->IsOffTheRecord()) 240 if (profile->IsOffTheRecord())
248 return false; 241 return false;
249 242
250 // Disable gdata if preference is set. This can happen with commandline flag 243 // Disable gdata if preference is set. This can happen with commandline flag
251 // --disable-gdata or enterprise policy, or probably with user settings too 244 // --disable-gdata or enterprise policy, or probably with user settings too
252 // in the future. 245 // in the future.
253 if (profile->GetPrefs()->GetBoolean(prefs::kDisableGData)) 246 if (profile->GetPrefs()->GetBoolean(prefs::kDisableGData))
254 return false; 247 return false;
255 248
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
314 // Assign the extracted extensions to md5 and extra_extension. 307 // Assign the extracted extensions to md5 and extra_extension.
315 int extension_count = extensions.size(); 308 int extension_count = extensions.size();
316 *md5 = (extension_count > 0) ? extensions[extension_count - 1] : 309 *md5 = (extension_count > 0) ? extensions[extension_count - 1] :
317 std::string(); 310 std::string();
318 *extra_extension = (extension_count > 1) ? extensions[extension_count - 2] : 311 *extra_extension = (extension_count > 1) ? extensions[extension_count - 2] :
319 std::string(); 312 std::string();
320 } 313 }
321 314
322 } // namespace util 315 } // namespace util
323 } // namespace gdata 316 } // namespace gdata
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/gdata/gdata_operation_registry.cc ('k') | chrome/browser/chromeos/system/ash_system_tray_delegate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698