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/files/file_util.h" | 8 #include "base/files/file_util.h" |
9 #include "base/prefs/pref_change_registrar.h" | 9 #include "base/prefs/pref_change_registrar.h" |
10 #include "base/prefs/pref_service.h" | 10 #include "base/prefs/pref_service.h" |
(...skipping 13 matching lines...) Expand all Loading... |
24 #include "chrome/browser/chromeos/file_manager/path_util.h" | 24 #include "chrome/browser/chromeos/file_manager/path_util.h" |
25 #include "chrome/browser/chromeos/profiles/profile_util.h" | 25 #include "chrome/browser/chromeos/profiles/profile_util.h" |
26 #include "chrome/browser/download/download_prefs.h" | 26 #include "chrome/browser/download/download_prefs.h" |
27 #include "chrome/browser/download/download_service.h" | 27 #include "chrome/browser/download/download_service.h" |
28 #include "chrome/browser/download/download_service_factory.h" | 28 #include "chrome/browser/download/download_service_factory.h" |
29 #include "chrome/browser/drive/drive_notification_manager_factory.h" | 29 #include "chrome/browser/drive/drive_notification_manager_factory.h" |
30 #include "chrome/browser/profiles/incognito_helpers.h" | 30 #include "chrome/browser/profiles/incognito_helpers.h" |
31 #include "chrome/browser/profiles/profile.h" | 31 #include "chrome/browser/profiles/profile.h" |
32 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" | 32 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" |
33 #include "chrome/browser/signin/signin_manager_factory.h" | 33 #include "chrome/browser/signin/signin_manager_factory.h" |
34 #include "chrome/common/chrome_version_info.h" | |
35 #include "chrome/common/pref_names.h" | 34 #include "chrome/common/pref_names.h" |
36 #include "chrome/grit/generated_resources.h" | 35 #include "chrome/grit/generated_resources.h" |
37 #include "components/drive/drive_api_util.h" | 36 #include "components/drive/drive_api_util.h" |
38 #include "components/drive/drive_app_registry.h" | 37 #include "components/drive/drive_app_registry.h" |
39 #include "components/drive/drive_notification_manager.h" | 38 #include "components/drive/drive_notification_manager.h" |
40 #include "components/drive/event_logger.h" | 39 #include "components/drive/event_logger.h" |
41 #include "components/drive/service/drive_api_service.h" | 40 #include "components/drive/service/drive_api_service.h" |
42 #include "components/keyed_service/content/browser_context_dependency_manager.h" | 41 #include "components/keyed_service/content/browser_context_dependency_manager.h" |
43 #include "components/signin/core/browser/profile_oauth2_token_service.h" | 42 #include "components/signin/core/browser/profile_oauth2_token_service.h" |
44 #include "components/signin/core/browser/signin_manager.h" | 43 #include "components/signin/core/browser/signin_manager.h" |
| 44 #include "components/version_info/version_info.h" |
45 #include "content/public/browser/browser_context.h" | 45 #include "content/public/browser/browser_context.h" |
46 #include "content/public/browser/browser_thread.h" | 46 #include "content/public/browser/browser_thread.h" |
47 #include "content/public/browser/notification_service.h" | 47 #include "content/public/browser/notification_service.h" |
48 #include "content/public/common/user_agent.h" | 48 #include "content/public/common/user_agent.h" |
49 #include "google_apis/drive/auth_service.h" | 49 #include "google_apis/drive/auth_service.h" |
50 #include "storage/browser/fileapi/external_mount_points.h" | 50 #include "storage/browser/fileapi/external_mount_points.h" |
51 #include "ui/base/l10n/l10n_util.h" | 51 #include "ui/base/l10n/l10n_util.h" |
52 | 52 |
53 using content::BrowserContext; | 53 using content::BrowserContext; |
54 using content::BrowserThread; | 54 using content::BrowserThread; |
(...skipping 15 matching lines...) Expand all Loading... |
70 // Returns a user agent string used for communicating with the Drive backend, | 70 // Returns a user agent string used for communicating with the Drive backend, |
71 // both WAPI and Drive API. The user agent looks like: | 71 // both WAPI and Drive API. The user agent looks like: |
72 // | 72 // |
73 // chromedrive-<VERSION> chrome-cc/none (<OS_CPU_INFO>) | 73 // chromedrive-<VERSION> chrome-cc/none (<OS_CPU_INFO>) |
74 // chromedrive-24.0.1274.0 chrome-cc/none (CrOS x86_64 0.4.0) | 74 // chromedrive-24.0.1274.0 chrome-cc/none (CrOS x86_64 0.4.0) |
75 // | 75 // |
76 // TODO(satorux): Move this function to somewhere else: crbug.com/151605 | 76 // TODO(satorux): Move this function to somewhere else: crbug.com/151605 |
77 std::string GetDriveUserAgent() { | 77 std::string GetDriveUserAgent() { |
78 const char kDriveClientName[] = "chromedrive"; | 78 const char kDriveClientName[] = "chromedrive"; |
79 | 79 |
80 chrome::VersionInfo version_info; | 80 const std::string version = version_info::GetVersionNumber(); |
81 const std::string version = version_info.Version(); | |
82 | 81 |
83 // This part is <client_name>/<version>. | 82 // This part is <client_name>/<version>. |
84 const char kLibraryInfo[] = "chrome-cc/none"; | 83 const char kLibraryInfo[] = "chrome-cc/none"; |
85 | 84 |
86 const std::string os_cpu_info = content::BuildOSCpuInfo(); | 85 const std::string os_cpu_info = content::BuildOSCpuInfo(); |
87 | 86 |
88 // Add "gzip" to receive compressed data from the server. | 87 // Add "gzip" to receive compressed data from the server. |
89 // (see https://developers.google.com/drive/performance) | 88 // (see https://developers.google.com/drive/performance) |
90 return base::StringPrintf("%s-%s %s (%s) (gzip)", | 89 return base::StringPrintf("%s-%s %s (%s) (gzip)", |
91 kDriveClientName, | 90 kDriveClientName, |
(...skipping 551 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
643 profile, preference_watcher, | 642 profile, preference_watcher, |
644 NULL, std::string(), base::FilePath(), NULL); | 643 NULL, std::string(), base::FilePath(), NULL); |
645 } else { | 644 } else { |
646 service = factory_for_test_->Run(profile); | 645 service = factory_for_test_->Run(profile); |
647 } | 646 } |
648 | 647 |
649 return service; | 648 return service; |
650 } | 649 } |
651 | 650 |
652 } // namespace drive | 651 } // namespace drive |
OLD | NEW |