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

Side by Side Diff: chrome/browser/ui/webui/version_handler.cc

Issue 1995113002: Rename WebUI::CallJavascriptFunction to WebUI::CallJavascriptFunctionUnsafe (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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
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/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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 content::BrowserThread::FILE, FROM_HERE, 80 content::BrowserThread::FILE, FROM_HERE,
81 base::Bind(&GetFilePaths, Profile::FromWebUI(web_ui())->GetPath(), 81 base::Bind(&GetFilePaths, Profile::FromWebUI(web_ui())->GetPath(),
82 base::Unretained(exec_path_buffer), 82 base::Unretained(exec_path_buffer),
83 base::Unretained(profile_path_buffer)), 83 base::Unretained(profile_path_buffer)),
84 base::Bind(&VersionHandler::OnGotFilePaths, 84 base::Bind(&VersionHandler::OnGotFilePaths,
85 weak_ptr_factory_.GetWeakPtr(), 85 weak_ptr_factory_.GetWeakPtr(),
86 base::Owned(exec_path_buffer), 86 base::Owned(exec_path_buffer),
87 base::Owned(profile_path_buffer))); 87 base::Owned(profile_path_buffer)));
88 88
89 // Respond with the variations info immediately. 89 // Respond with the variations info immediately.
90 web_ui()->CallJavascriptFunction(version_ui::kReturnVariationInfo, 90 web_ui()->CallJavascriptFunctionUnsafe(version_ui::kReturnVariationInfo,
91 *version_ui::GetVariationsList()); 91 *version_ui::GetVariationsList());
92 } 92 }
93 93
94 void VersionHandler::OnGotFilePaths(base::string16* executable_path_data, 94 void VersionHandler::OnGotFilePaths(base::string16* executable_path_data,
95 base::string16* profile_path_data) { 95 base::string16* profile_path_data) {
96 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); 96 DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
97 97
98 base::StringValue exec_path(*executable_path_data); 98 base::StringValue exec_path(*executable_path_data);
99 base::StringValue profile_path(*profile_path_data); 99 base::StringValue profile_path(*profile_path_data);
100 web_ui()->CallJavascriptFunction(version_ui::kReturnFilePaths, exec_path, 100 web_ui()->CallJavascriptFunctionUnsafe(version_ui::kReturnFilePaths,
101 profile_path); 101 exec_path, profile_path);
102 } 102 }
103 103
104 #if defined(ENABLE_PLUGINS) 104 #if defined(ENABLE_PLUGINS)
105 void VersionHandler::OnGotPlugins( 105 void VersionHandler::OnGotPlugins(
106 const std::vector<content::WebPluginInfo>& plugins) { 106 const std::vector<content::WebPluginInfo>& plugins) {
107 // Obtain the version of the first enabled Flash plugin. 107 // Obtain the version of the first enabled Flash plugin.
108 std::vector<content::WebPluginInfo> info_array; 108 std::vector<content::WebPluginInfo> info_array;
109 content::PluginService::GetInstance()->GetPluginInfoArray( 109 content::PluginService::GetInstance()->GetPluginInfoArray(
110 GURL(), content::kFlashPluginSwfMimeType, false, &info_array, NULL); 110 GURL(), content::kFlashPluginSwfMimeType, false, &info_array, NULL);
111 base::string16 flash_version = 111 base::string16 flash_version =
112 l10n_util::GetStringUTF16(IDS_PLUGINS_DISABLED_PLUGIN); 112 l10n_util::GetStringUTF16(IDS_PLUGINS_DISABLED_PLUGIN);
113 PluginPrefs* plugin_prefs = 113 PluginPrefs* plugin_prefs =
114 PluginPrefs::GetForProfile(Profile::FromWebUI(web_ui())).get(); 114 PluginPrefs::GetForProfile(Profile::FromWebUI(web_ui())).get();
115 if (plugin_prefs) { 115 if (plugin_prefs) {
116 for (size_t i = 0; i < info_array.size(); ++i) { 116 for (size_t i = 0; i < info_array.size(); ++i) {
117 if (plugin_prefs->IsPluginEnabled(info_array[i])) { 117 if (plugin_prefs->IsPluginEnabled(info_array[i])) {
118 flash_version = info_array[i].version; 118 flash_version = info_array[i].version;
119 break; 119 break;
120 } 120 }
121 } 121 }
122 } 122 }
123 123
124 base::StringValue arg(flash_version); 124 base::StringValue arg(flash_version);
125 web_ui()->CallJavascriptFunction(version_ui::kReturnFlashVersion, arg); 125 web_ui()->CallJavascriptFunctionUnsafe(version_ui::kReturnFlashVersion, arg);
126 } 126 }
127 #endif // defined(ENABLE_PLUGINS) 127 #endif // defined(ENABLE_PLUGINS)
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/user_actions/user_actions_ui_handler.cc ('k') | chrome/browser/ui/webui/version_handler_chromeos.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698