OLD | NEW |
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/drive_integration_service.h" | 5 #include "chrome/browser/chromeos/drive/drive_integration_service.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/command_line.h" | |
9 #include "base/prefs/pref_service.h" | 8 #include "base/prefs/pref_service.h" |
10 #include "chrome/browser/browser_process.h" | 9 #include "chrome/browser/browser_process.h" |
11 #include "chrome/browser/chromeos/drive/debug_info_collector.h" | 10 #include "chrome/browser/chromeos/drive/debug_info_collector.h" |
12 #include "chrome/browser/chromeos/drive/download_handler.h" | 11 #include "chrome/browser/chromeos/drive/download_handler.h" |
13 #include "chrome/browser/chromeos/drive/drive_webapps_registry.h" | 12 #include "chrome/browser/chromeos/drive/drive_webapps_registry.h" |
14 #include "chrome/browser/chromeos/drive/file_cache.h" | 13 #include "chrome/browser/chromeos/drive/file_cache.h" |
15 #include "chrome/browser/chromeos/drive/file_system.h" | 14 #include "chrome/browser/chromeos/drive/file_system.h" |
16 #include "chrome/browser/chromeos/drive/file_system_proxy.h" | 15 #include "chrome/browser/chromeos/drive/file_system_proxy.h" |
17 #include "chrome/browser/chromeos/drive/file_system_util.h" | 16 #include "chrome/browser/chromeos/drive/file_system_util.h" |
18 #include "chrome/browser/chromeos/drive/file_write_helper.h" | 17 #include "chrome/browser/chromeos/drive/file_write_helper.h" |
19 #include "chrome/browser/chromeos/drive/logging.h" | 18 #include "chrome/browser/chromeos/drive/logging.h" |
20 #include "chrome/browser/chromeos/drive/sync_client.h" | 19 #include "chrome/browser/chromeos/drive/sync_client.h" |
21 #include "chrome/browser/download/download_service.h" | 20 #include "chrome/browser/download/download_service.h" |
22 #include "chrome/browser/download/download_service_factory.h" | 21 #include "chrome/browser/download/download_service_factory.h" |
23 #include "chrome/browser/download/download_util.h" | 22 #include "chrome/browser/download/download_util.h" |
24 #include "chrome/browser/google_apis/auth_service.h" | 23 #include "chrome/browser/google_apis/auth_service.h" |
25 #include "chrome/browser/google_apis/drive_api_service.h" | 24 #include "chrome/browser/google_apis/drive_api_service.h" |
26 #include "chrome/browser/google_apis/drive_api_util.h" | 25 #include "chrome/browser/google_apis/drive_api_util.h" |
27 #include "chrome/browser/google_apis/drive_notification_manager.h" | 26 #include "chrome/browser/google_apis/drive_notification_manager.h" |
28 #include "chrome/browser/google_apis/drive_notification_manager_factory.h" | 27 #include "chrome/browser/google_apis/drive_notification_manager_factory.h" |
29 #include "chrome/browser/google_apis/gdata_wapi_service.h" | 28 #include "chrome/browser/google_apis/gdata_wapi_service.h" |
30 #include "chrome/browser/google_apis/gdata_wapi_url_generator.h" | 29 #include "chrome/browser/google_apis/gdata_wapi_url_generator.h" |
31 #include "chrome/browser/profiles/profile.h" | 30 #include "chrome/browser/profiles/profile.h" |
32 #include "chrome/browser/sync/profile_sync_service_factory.h" | |
33 #include "chrome/common/chrome_switches.h" | |
34 #include "chrome/common/chrome_version_info.h" | 31 #include "chrome/common/chrome_version_info.h" |
35 #include "chrome/common/pref_names.h" | 32 #include "chrome/common/pref_names.h" |
36 #include "components/browser_context_keyed_service/browser_context_dependency_ma
nager.h" | 33 #include "components/browser_context_keyed_service/browser_context_dependency_ma
nager.h" |
37 #include "content/public/browser/browser_context.h" | 34 #include "content/public/browser/browser_context.h" |
38 #include "content/public/browser/browser_thread.h" | 35 #include "content/public/browser/browser_thread.h" |
39 #include "content/public/browser/storage_partition.h" | |
40 #include "google/cacheinvalidation/types.pb.h" | |
41 #include "webkit/browser/fileapi/external_mount_points.h" | 36 #include "webkit/browser/fileapi/external_mount_points.h" |
42 #include "webkit/common/user_agent/user_agent_util.h" | 37 #include "webkit/common/user_agent/user_agent_util.h" |
43 | 38 |
44 using content::BrowserContext; | 39 using content::BrowserContext; |
45 using content::BrowserThread; | 40 using content::BrowserThread; |
46 | 41 |
47 namespace drive { | 42 namespace drive { |
48 namespace { | 43 namespace { |
49 | 44 |
50 static const size_t kEventLogHistorySize = 100; | |
51 | |
52 // Returns true if Drive is enabled for the given Profile. | 45 // Returns true if Drive is enabled for the given Profile. |
53 bool IsDriveEnabledForProfile(Profile* profile) { | 46 bool IsDriveEnabledForProfile(Profile* profile) { |
54 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 47 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
55 | 48 |
56 if (!google_apis::AuthService::CanAuthenticate(profile)) | 49 if (!google_apis::AuthService::CanAuthenticate(profile)) |
57 return false; | 50 return false; |
58 | 51 |
59 // Disable Drive if preference is set. This can happen with commandline flag | 52 // Disable Drive if preference is set. This can happen with commandline flag |
60 // --disable-gdata or enterprise policy, or probably with user settings too | 53 // --disable-gdata or enterprise policy, or probably with user settings too |
61 // in the future. | 54 // in the future. |
(...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
431 profile, NULL, base::FilePath(), NULL); | 424 profile, NULL, base::FilePath(), NULL); |
432 } else { | 425 } else { |
433 service = factory_for_test_.Run(profile); | 426 service = factory_for_test_.Run(profile); |
434 } | 427 } |
435 | 428 |
436 service->Initialize(); | 429 service->Initialize(); |
437 return service; | 430 return service; |
438 } | 431 } |
439 | 432 |
440 } // namespace drive | 433 } // namespace drive |
OLD | NEW |