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

Side by Side Diff: chrome/browser/browser_about_handler.cc

Issue 8071013: Finish moving plugin probing out of process. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Ready for review Created 9 years, 2 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/browser_about_handler.h" 5 #include "chrome/browser/browser_about_handler.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/bind.h"
11 #include "base/callback.h" 12 #include "base/callback.h"
12 #include "base/command_line.h" 13 #include "base/command_line.h"
13 #include "base/file_util.h" 14 #include "base/file_util.h"
14 #include "base/i18n/number_formatting.h" 15 #include "base/i18n/number_formatting.h"
15 #include "base/json/json_writer.h" 16 #include "base/json/json_writer.h"
16 #include "base/memory/singleton.h" 17 #include "base/memory/singleton.h"
17 #include "base/metrics/histogram.h" 18 #include "base/metrics/histogram.h"
18 #include "base/metrics/stats_table.h" 19 #include "base/metrics/stats_table.h"
19 #include "base/path_service.h" 20 #include "base/path_service.h"
20 #include "base/string_number_conversions.h" 21 #include "base/string_number_conversions.h"
(...skipping 18 matching lines...) Expand all
39 #include "chrome/browser/ui/webui/chrome_url_data_manager.h" 40 #include "chrome/browser/ui/webui/chrome_url_data_manager.h"
40 #include "chrome/common/about_handler.h" 41 #include "chrome/common/about_handler.h"
41 #include "chrome/common/chrome_paths.h" 42 #include "chrome/common/chrome_paths.h"
42 #include "chrome/common/chrome_version_info.h" 43 #include "chrome/common/chrome_version_info.h"
43 #include "chrome/common/jstemplate_builder.h" 44 #include "chrome/common/jstemplate_builder.h"
44 #include "chrome/common/net/gaia/google_service_auth_error.h" 45 #include "chrome/common/net/gaia/google_service_auth_error.h"
45 #include "chrome/common/render_messages.h" 46 #include "chrome/common/render_messages.h"
46 #include "chrome/common/url_constants.h" 47 #include "chrome/common/url_constants.h"
47 #include "content/browser/browser_thread.h" 48 #include "content/browser/browser_thread.h"
48 #include "content/browser/gpu/gpu_process_host.h" 49 #include "content/browser/gpu/gpu_process_host.h"
50 #include "content/browser/plugin_service.h"
49 #include "content/browser/renderer_host/render_process_host.h" 51 #include "content/browser/renderer_host/render_process_host.h"
50 #include "content/browser/renderer_host/render_view_host.h" 52 #include "content/browser/renderer_host/render_view_host.h"
51 #include "content/browser/sensors/sensors_provider.h" 53 #include "content/browser/sensors/sensors_provider.h"
52 #include "content/common/gpu/gpu_messages.h" 54 #include "content/common/gpu/gpu_messages.h"
53 #include "crypto/nss_util.h" 55 #include "crypto/nss_util.h"
54 #include "googleurl/src/gurl.h" 56 #include "googleurl/src/gurl.h"
55 #include "grit/browser_resources.h" 57 #include "grit/browser_resources.h"
56 #include "grit/chromium_strings.h" 58 #include "grit/chromium_strings.h"
57 #include "grit/generated_resources.h" 59 #include "grit/generated_resources.h"
58 #include "grit/locale_settings.h" 60 #include "grit/locale_settings.h"
59 #include "net/base/escape.h" 61 #include "net/base/escape.h"
60 #include "net/base/net_util.h" 62 #include "net/base/net_util.h"
61 #include "ui/base/l10n/l10n_util.h" 63 #include "ui/base/l10n/l10n_util.h"
62 #include "ui/base/resource/resource_bundle.h" 64 #include "ui/base/resource/resource_bundle.h"
63 #include "v8/include/v8.h" 65 #include "v8/include/v8.h"
64 #include "webkit/glue/user_agent.h" 66 #include "webkit/glue/user_agent.h"
65 #include "webkit/glue/webkit_glue.h" 67 #include "webkit/glue/webkit_glue.h"
66 #include "webkit/plugins/npapi/plugin_list.h"
67 #include "webkit/plugins/webplugininfo.h" 68 #include "webkit/plugins/webplugininfo.h"
68 69
69 #if defined(OS_WIN) 70 #if defined(OS_WIN)
70 #include "chrome/browser/enumerate_modules_model_win.h" 71 #include "chrome/browser/enumerate_modules_model_win.h"
71 #elif defined(OS_CHROMEOS) 72 #elif defined(OS_CHROMEOS)
72 #include "chrome/browser/chromeos/cros/cros_library.h" 73 #include "chrome/browser/chromeos/cros/cros_library.h"
73 #include "chrome/browser/chromeos/cros/cryptohome_library.h" 74 #include "chrome/browser/chromeos/cros/cryptohome_library.h"
74 #include "chrome/browser/chromeos/cros/network_library.h" 75 #include "chrome/browser/chromeos/cros/network_library.h"
75 #include "chrome/browser/chromeos/customization_document.h" 76 #include "chrome/browser/chromeos/customization_document.h"
76 #include "chrome/browser/chromeos/login/wizard_controller.h" 77 #include "chrome/browser/chromeos/login/wizard_controller.h"
(...skipping 1072 matching lines...) Expand 10 before | Expand all | Expand 10 after
1149 localized_strings->SetString("platform", 1150 localized_strings->SetString("platform",
1150 l10n_util::GetStringUTF16(IDS_PLATFORM_LABEL)); 1151 l10n_util::GetStringUTF16(IDS_PLATFORM_LABEL));
1151 localized_strings->SetString("os_type", version_info.OSType()); 1152 localized_strings->SetString("os_type", version_info.OSType());
1152 localized_strings->SetString("webkit_version", 1153 localized_strings->SetString("webkit_version",
1153 webkit_glue::GetWebKitVersion()); 1154 webkit_glue::GetWebKitVersion());
1154 localized_strings->SetString("js_engine", "V8"); 1155 localized_strings->SetString("js_engine", "V8");
1155 localized_strings->SetString("js_version", v8::V8::GetVersion()); 1156 localized_strings->SetString("js_version", v8::V8::GetVersion());
1156 1157
1157 // Obtain the version of the first enabled Flash plugin. 1158 // Obtain the version of the first enabled Flash plugin.
1158 std::vector<webkit::WebPluginInfo> info_array; 1159 std::vector<webkit::WebPluginInfo> info_array;
1159 webkit::npapi::PluginList::Singleton()->GetPluginInfoArray( 1160 PluginService::GetInstance()->GetPluginInfoArray(
1160 GURL(), "application/x-shockwave-flash", false, NULL, &info_array, NULL); 1161 GURL(), "application/x-shockwave-flash", false, &info_array, NULL);
1161 string16 flash_version = 1162 string16 flash_version =
1162 l10n_util::GetStringUTF16(IDS_PLUGINS_DISABLED_PLUGIN); 1163 l10n_util::GetStringUTF16(IDS_PLUGINS_DISABLED_PLUGIN);
1163 PluginPrefs* plugin_prefs = PluginPrefs::GetForProfile(profile); 1164 PluginPrefs* plugin_prefs = PluginPrefs::GetForProfile(profile);
1164 for (size_t i = 0; i < info_array.size(); ++i) { 1165 for (size_t i = 0; i < info_array.size(); ++i) {
1165 if (plugin_prefs->IsPluginEnabled(info_array[i])) { 1166 if (plugin_prefs->IsPluginEnabled(info_array[i])) {
1166 flash_version = info_array[i].version; 1167 flash_version = info_array[i].version;
1167 break; 1168 break;
1168 } 1169 }
1169 } 1170 }
1170 localized_strings->SetString("flash_plugin", "Flash"); 1171 localized_strings->SetString("flash_plugin", "Flash");
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
1223 } else { 1224 } else {
1224 localized_strings->SetString("profile_path", 1225 localized_strings->SetString("profile_path",
1225 l10n_util::GetStringUTF16(IDS_ABOUT_VERSION_PATH_NOTFOUND)); 1226 l10n_util::GetStringUTF16(IDS_ABOUT_VERSION_PATH_NOTFOUND));
1226 } 1227 }
1227 1228
1228 std::string data; 1229 std::string data;
1229 jstemplate_builder::AppendJsonJS(localized_strings, &data); 1230 jstemplate_builder::AppendJsonJS(localized_strings, &data);
1230 return data; 1231 return data;
1231 } 1232 }
1232 1233
1234 // Used as a callback for PluginService::GetPlugins().
1235 void HandleAboutVersionStrings(AboutSource* source,
1236 int request_id,
1237 const std::vector<webkit::WebPluginInfo>&) {
1238 #if defined(OS_CHROMEOS)
1239 new ChromeOSAboutVersionHandler(source, request_id);
1240 #else
1241 DictionaryValue localized_strings;
1242 localized_strings.SetString("os_version", "");
1243 source->FinishDataRequest(
1244 AboutVersionStrings(&localized_strings, source->profile()),
1245 request_id);
1246 #endif
1247 }
1248
1233 // AboutMemoryHandler ---------------------------------------------------------- 1249 // AboutMemoryHandler ----------------------------------------------------------
1234 1250
1235 // Helper for AboutMemory to bind results from a ProcessMetrics object 1251 // Helper for AboutMemory to bind results from a ProcessMetrics object
1236 // to a DictionaryValue. Fills ws_usage and comm_usage so that the objects 1252 // to a DictionaryValue. Fills ws_usage and comm_usage so that the objects
1237 // can be used in caller's scope (e.g for appending to a net total). 1253 // can be used in caller's scope (e.g for appending to a net total).
1238 void AboutMemoryHandler::BindProcessMetrics(DictionaryValue* data, 1254 void AboutMemoryHandler::BindProcessMetrics(DictionaryValue* data,
1239 ProcessMemoryInformation* info) { 1255 ProcessMemoryInformation* info) {
1240 DCHECK(data && info); 1256 DCHECK(data && info);
1241 1257
1242 // Bind metrics to dictionary. 1258 // Bind metrics to dictionary.
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
1452 } else if (host == chrome::kChromeUITermsHost) { 1468 } else if (host == chrome::kChromeUITermsHost) {
1453 #if defined(OS_CHROMEOS) 1469 #if defined(OS_CHROMEOS)
1454 ChromeOSTermsHandler::Start(this, path, request_id); 1470 ChromeOSTermsHandler::Start(this, path, request_id);
1455 return; 1471 return;
1456 #else 1472 #else
1457 response = ResourceBundle::GetSharedInstance().GetRawDataResource( 1473 response = ResourceBundle::GetSharedInstance().GetRawDataResource(
1458 IDR_TERMS_HTML).as_string(); 1474 IDR_TERMS_HTML).as_string();
1459 #endif 1475 #endif
1460 } else if (host == chrome::kChromeUIVersionHost) { 1476 } else if (host == chrome::kChromeUIVersionHost) {
1461 if (path == kStringsJsPath) { 1477 if (path == kStringsJsPath) {
1462 #if defined(OS_CHROMEOS) 1478 // The Flash version information is needed on this page, so make sure
1463 new ChromeOSAboutVersionHandler(this, request_id); 1479 // the plugins are loaded.
1480 PluginService::GetInstance()->GetPlugins(
1481 base::Bind(&HandleAboutVersionStrings,
1482 make_scoped_refptr(this), request_id));
1464 return; 1483 return;
1465 #else
1466 DictionaryValue localized_strings;
1467 localized_strings.SetString("os_version", "");
1468 response = AboutVersionStrings(&localized_strings, profile_);
1469 #endif
1470 } else { 1484 } else {
1471 response = AboutVersionStaticContent(path); 1485 response = AboutVersionStaticContent(path);
1472 } 1486 }
1473 } 1487 }
1474 1488
1475 FinishDataRequest(response, request_id); 1489 FinishDataRequest(response, request_id);
1476 } 1490 }
1477 1491
1478 void AboutSource::FinishDataRequest(const std::string& html, int request_id) { 1492 void AboutSource::FinishDataRequest(const std::string& html, int request_id) {
1479 std::string html_copy(html); 1493 std::string html_copy(html);
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
1606 return false; 1620 return false;
1607 } 1621 }
1608 1622
1609 std::vector<std::string> ChromePaths() { 1623 std::vector<std::string> ChromePaths() {
1610 std::vector<std::string> paths; 1624 std::vector<std::string> paths;
1611 paths.reserve(arraysize(kChromePaths)); 1625 paths.reserve(arraysize(kChromePaths));
1612 for (size_t i = 0; i < arraysize(kChromePaths); i++) 1626 for (size_t i = 0; i < arraysize(kChromePaths); i++)
1613 paths.push_back(kChromePaths[i]); 1627 paths.push_back(kChromePaths[i]);
1614 return paths; 1628 return paths;
1615 } 1629 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/chromeos/gview_request_interceptor.cc » ('j') | chrome/browser/plugin_data_remover_helper.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698