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/ui/webui/version_handler.h" | 5 #include "chrome/browser/ui/webui/version_handler.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/files/file_util.h" | 10 #include "base/files/file_util.h" |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 base::Bind(&VersionHandler::OnGotPlugins, | 73 base::Bind(&VersionHandler::OnGotPlugins, |
74 weak_ptr_factory_.GetWeakPtr())); | 74 weak_ptr_factory_.GetWeakPtr())); |
75 #endif | 75 #endif |
76 | 76 |
77 // Grab the executable path on the FILE thread. It is returned in | 77 // Grab the executable path on the FILE thread. It is returned in |
78 // OnGotFilePaths. | 78 // OnGotFilePaths. |
79 base::string16* exec_path_buffer = new base::string16; | 79 base::string16* exec_path_buffer = new base::string16; |
80 base::string16* profile_path_buffer = new base::string16; | 80 base::string16* profile_path_buffer = new base::string16; |
81 content::BrowserThread::PostTaskAndReply( | 81 content::BrowserThread::PostTaskAndReply( |
82 content::BrowserThread::FILE, FROM_HERE, | 82 content::BrowserThread::FILE, FROM_HERE, |
83 base::Bind(&GetFilePaths, Profile::FromWebUI(web_ui())->GetPath(), | 83 base::BindOnce(&GetFilePaths, Profile::FromWebUI(web_ui())->GetPath(), |
84 base::Unretained(exec_path_buffer), | 84 base::Unretained(exec_path_buffer), |
85 base::Unretained(profile_path_buffer)), | 85 base::Unretained(profile_path_buffer)), |
86 base::Bind(&VersionHandler::OnGotFilePaths, | 86 base::BindOnce( |
87 weak_ptr_factory_.GetWeakPtr(), | 87 &VersionHandler::OnGotFilePaths, weak_ptr_factory_.GetWeakPtr(), |
88 base::Owned(exec_path_buffer), | 88 base::Owned(exec_path_buffer), base::Owned(profile_path_buffer))); |
89 base::Owned(profile_path_buffer))); | |
90 | 89 |
91 // Respond with the variations info immediately. | 90 // Respond with the variations info immediately. |
92 web_ui()->CallJavascriptFunctionUnsafe(version_ui::kReturnVariationInfo, | 91 web_ui()->CallJavascriptFunctionUnsafe(version_ui::kReturnVariationInfo, |
93 *version_ui::GetVariationsList()); | 92 *version_ui::GetVariationsList()); |
94 } | 93 } |
95 | 94 |
96 void VersionHandler::OnGotFilePaths(base::string16* executable_path_data, | 95 void VersionHandler::OnGotFilePaths(base::string16* executable_path_data, |
97 base::string16* profile_path_data) { | 96 base::string16* profile_path_data) { |
98 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 97 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
99 | 98 |
(...skipping 23 matching lines...) Expand all Loading... |
123 break; | 122 break; |
124 } | 123 } |
125 } | 124 } |
126 } | 125 } |
127 | 126 |
128 base::Value arg(flash_version_and_path); | 127 base::Value arg(flash_version_and_path); |
129 | 128 |
130 web_ui()->CallJavascriptFunctionUnsafe(version_ui::kReturnFlashVersion, arg); | 129 web_ui()->CallJavascriptFunctionUnsafe(version_ui::kReturnFlashVersion, arg); |
131 } | 130 } |
132 #endif // BUILDFLAG(ENABLE_PLUGINS) | 131 #endif // BUILDFLAG(ENABLE_PLUGINS) |
OLD | NEW |