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 "sync/util/get_session_name.h" | 5 #include "components/sync/base/get_session_name.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/callback.h" | 9 #include "base/callback.h" |
10 #include "base/location.h" | 10 #include "base/location.h" |
11 #include "base/strings/string_util.h" | 11 #include "base/strings/string_util.h" |
12 #include "base/sys_info.h" | 12 #include "base/sys_info.h" |
13 #include "base/task_runner.h" | 13 #include "base/task_runner.h" |
14 #include "build/build_config.h" | 14 #include "build/build_config.h" |
15 | 15 |
16 #if defined(OS_CHROMEOS) | 16 #if defined(OS_CHROMEOS) |
17 #include "chromeos/system/devicetype.h" | 17 #include "chromeos/system/devicetype.h" |
18 #elif defined(OS_LINUX) | 18 #elif defined(OS_LINUX) |
19 #include "sync/util/get_session_name_linux.h" | 19 #include "components/sync/base/get_session_name_linux.h" |
20 #elif defined(OS_IOS) | 20 #elif defined(OS_IOS) |
21 #include "sync/util/get_session_name_ios.h" | 21 #include "components/sync/base/get_session_name_ios.h" |
22 #elif defined(OS_MACOSX) | 22 #elif defined(OS_MACOSX) |
23 #include "sync/util/get_session_name_mac.h" | 23 #include "components/sync/base/get_session_name_mac.h" |
24 #elif defined(OS_WIN) | 24 #elif defined(OS_WIN) |
25 #include "sync/util/get_session_name_win.h" | 25 #include "components/sync/base/get_session_name_win.h" |
26 #elif defined(OS_ANDROID) | 26 #elif defined(OS_ANDROID) |
27 #include "base/android/build_info.h" | 27 #include "base/android/build_info.h" |
28 #endif | 28 #endif |
29 | 29 |
30 namespace syncer { | 30 namespace syncer { |
31 | 31 |
32 namespace { | 32 namespace { |
33 | 33 |
34 std::string GetSessionNameSynchronously() { | 34 std::string GetSessionNameSynchronously() { |
35 std::string session_name; | 35 std::string session_name; |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 done_callback.Run(*session_name); | 82 done_callback.Run(*session_name); |
83 } | 83 } |
84 | 84 |
85 } // namespace | 85 } // namespace |
86 | 86 |
87 void GetSessionName( | 87 void GetSessionName( |
88 const scoped_refptr<base::TaskRunner>& task_runner, | 88 const scoped_refptr<base::TaskRunner>& task_runner, |
89 const base::Callback<void(const std::string&)>& done_callback) { | 89 const base::Callback<void(const std::string&)>& done_callback) { |
90 std::string* session_name = new std::string(); | 90 std::string* session_name = new std::string(); |
91 task_runner->PostTaskAndReply( | 91 task_runner->PostTaskAndReply( |
92 FROM_HERE, | 92 FROM_HERE, base::Bind(&FillSessionName, base::Unretained(session_name)), |
93 base::Bind(&FillSessionName, | 93 base::Bind(&OnSessionNameFilled, done_callback, |
94 base::Unretained(session_name)), | |
95 base::Bind(&OnSessionNameFilled, | |
96 done_callback, | |
97 base::Owned(session_name))); | 94 base::Owned(session_name))); |
98 } | 95 } |
99 | 96 |
100 std::string GetSessionNameSynchronouslyForTesting() { | 97 std::string GetSessionNameSynchronouslyForTesting() { |
101 return GetSessionNameSynchronously(); | 98 return GetSessionNameSynchronously(); |
102 } | 99 } |
103 | 100 |
104 } // namespace syncer | 101 } // namespace syncer |
OLD | NEW |