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

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

Issue 10214013: Created uber tray UI for monitoring ongoing WebDrive sync operations (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"
27 #include "chrome/browser/prefs/pref_service.h" 29 #include "chrome/browser/prefs/pref_service.h"
28 #include "chrome/browser/profiles/profile.h" 30 #include "chrome/browser/profiles/profile.h"
29 #include "chrome/browser/ui/browser.h" 31 #include "chrome/browser/ui/browser.h"
30 #include "chrome/browser/ui/browser_list.h" 32 #include "chrome/browser/ui/browser_list.h"
31 #include "content/public/browser/browser_thread.h" 33 #include "content/public/browser/browser_thread.h"
32 #include "content/public/browser/child_process_security_policy.h" 34 #include "content/public/browser/child_process_security_policy.h"
33 #include "net/base/escape.h" 35 #include "net/base/escape.h"
34 36
35 namespace gdata { 37 namespace gdata {
36 namespace util { 38 namespace util {
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
240 const FilePath& path) { 242 const FilePath& path) {
241 std::vector<std::pair<FilePath, int> > cache_paths; 243 std::vector<std::pair<FilePath, int> > cache_paths;
242 InsertGDataCachePathsPermissions(profile, path, &cache_paths); 244 InsertGDataCachePathsPermissions(profile, path, &cache_paths);
243 for (size_t i = 0; i < cache_paths.size(); i++) { 245 for (size_t i = 0; i < cache_paths.size(); i++) {
244 content::ChildProcessSecurityPolicy::GetInstance()->GrantPermissionsForFile( 246 content::ChildProcessSecurityPolicy::GetInstance()->GrantPermissionsForFile(
245 pid, cache_paths[i].first, cache_paths[i].second); 247 pid, cache_paths[i].first, cache_paths[i].second);
246 } 248 }
247 } 249 }
248 250
249 bool IsGDataAvailable(Profile* profile) { 251 bool IsGDataAvailable(Profile* profile) {
252 if (!chromeos::UserManager::Get()->IsUserLoggedIn() ||
253 chromeos::UserManager::Get()->IsLoggedInAsGuest() ||
254 chromeos::UserManager::Get()->IsLoggedInAsDemoUser())
255 return false;
256
250 // Do not allow GData for incognito windows / guest mode. 257 // Do not allow GData for incognito windows / guest mode.
251 if (profile->IsOffTheRecord()) 258 if (profile->IsOffTheRecord())
252 return false; 259 return false;
253 260
254 // Disable gdata if preference is set. This can happen with commandline flag 261 // Disable gdata if preference is set. This can happen with commandline flag
255 // --disable-gdata or enterprise policy, or probably with user settings too 262 // --disable-gdata or enterprise policy, or probably with user settings too
256 // in the future. 263 // in the future.
257 if (profile->GetPrefs()->GetBoolean(prefs::kDisableGData)) 264 if (profile->GetPrefs()->GetBoolean(prefs::kDisableGData))
258 return false; 265 return false;
259 266
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
318 // Assign the extracted extensions to md5 and extra_extension. 325 // Assign the extracted extensions to md5 and extra_extension.
319 int extension_count = extensions.size(); 326 int extension_count = extensions.size();
320 *md5 = (extension_count > 0) ? extensions[extension_count - 1] : 327 *md5 = (extension_count > 0) ? extensions[extension_count - 1] :
321 std::string(); 328 std::string();
322 *extra_extension = (extension_count > 1) ? extensions[extension_count - 2] : 329 *extra_extension = (extension_count > 1) ? extensions[extension_count - 2] :
323 std::string(); 330 std::string();
324 } 331 }
325 332
326 } // namespace util 333 } // namespace util
327 } // namespace gdata 334 } // namespace gdata
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698