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

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

Issue 10703162: chromeos: Remove CryptohomeLibrary::TpmGetPassword and TpmIsReady (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: More localized variables Created 8 years, 5 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) 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/about_ui.h" 5 #include "chrome/browser/ui/webui/about_ui.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <string> 8 #include <string>
9 #include <utility> 9 #include <utility>
10 #include <vector> 10 #include <vector>
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 #include "chrome/common/render_messages.h" 48 #include "chrome/common/render_messages.h"
49 #include "chrome/common/url_constants.h" 49 #include "chrome/common/url_constants.h"
50 #include "content/public/browser/browser_thread.h" 50 #include "content/public/browser/browser_thread.h"
51 #include "content/public/browser/plugin_service.h" 51 #include "content/public/browser/plugin_service.h"
52 #include "content/public/browser/render_process_host.h" 52 #include "content/public/browser/render_process_host.h"
53 #include "content/public/browser/render_view_host.h" 53 #include "content/public/browser/render_view_host.h"
54 #include "content/public/browser/web_contents.h" 54 #include "content/public/browser/web_contents.h"
55 #include "content/public/browser/web_ui.h" 55 #include "content/public/browser/web_ui.h"
56 #include "content/public/common/content_client.h" 56 #include "content/public/common/content_client.h"
57 #include "content/public/common/process_type.h" 57 #include "content/public/common/process_type.h"
58 #include "crypto/nss_util.h"
59 #include "googleurl/src/gurl.h" 58 #include "googleurl/src/gurl.h"
60 #include "grit/browser_resources.h" 59 #include "grit/browser_resources.h"
61 #include "grit/chromium_strings.h" 60 #include "grit/chromium_strings.h"
62 #include "grit/generated_resources.h" 61 #include "grit/generated_resources.h"
63 #include "grit/locale_settings.h" 62 #include "grit/locale_settings.h"
64 #include "net/base/escape.h" 63 #include "net/base/escape.h"
65 #include "net/base/net_util.h" 64 #include "net/base/net_util.h"
66 #include "ui/base/l10n/l10n_util.h" 65 #include "ui/base/l10n/l10n_util.h"
67 #include "ui/base/layout.h" 66 #include "ui/base/layout.h"
68 #include "ui/base/resource/resource_bundle.h" 67 #include "ui/base/resource/resource_bundle.h"
69 #include "v8/include/v8.h" 68 #include "v8/include/v8.h"
70 #include "webkit/glue/user_agent.h" 69 #include "webkit/glue/user_agent.h"
71 #include "webkit/glue/webkit_glue.h" 70 #include "webkit/glue/webkit_glue.h"
72 #include "webkit/plugins/webplugininfo.h" 71 #include "webkit/plugins/webplugininfo.h"
73 72
74 #if defined(OS_LINUX) || defined(OS_OPENBSD) 73 #if defined(OS_LINUX) || defined(OS_OPENBSD)
75 #include "content/public/browser/zygote_host_linux.h" 74 #include "content/public/browser/zygote_host_linux.h"
76 #include "content/public/common/sandbox_linux.h" 75 #include "content/public/common/sandbox_linux.h"
77 #endif 76 #endif
78 77
79 #if defined(OS_WIN) 78 #if defined(OS_WIN)
80 #include "chrome/browser/enumerate_modules_model_win.h" 79 #include "chrome/browser/enumerate_modules_model_win.h"
81 #endif 80 #endif
82 81
83 #if defined(OS_CHROMEOS) 82 #if defined(OS_CHROMEOS)
84 #include "chrome/browser/chromeos/cros/cros_library.h" 83 #include "chrome/browser/chromeos/cros/cros_library.h"
85 #include "chrome/browser/chromeos/cros/cryptohome_library.h"
86 #include "chrome/browser/chromeos/cros/network_library.h" 84 #include "chrome/browser/chromeos/cros/network_library.h"
87 #include "chrome/browser/chromeos/customization_document.h" 85 #include "chrome/browser/chromeos/customization_document.h"
88 #include "chrome/browser/chromeos/login/wizard_controller.h" 86 #include "chrome/browser/chromeos/login/wizard_controller.h"
89 #include "chrome/browser/chromeos/oom_priority_manager.h" 87 #include "chrome/browser/chromeos/oom_priority_manager.h"
90 #include "chrome/browser/chromeos/version_loader.h" 88 #include "chrome/browser/chromeos/version_loader.h"
91 #include "chromeos/dbus/cryptohome_client.h"
92 #include "chromeos/dbus/dbus_thread_manager.h"
93 #endif 89 #endif
94 90
95 #if defined(USE_ASH) 91 #if defined(USE_ASH)
96 #include "ash/wm/frame_painter.h" 92 #include "ash/wm/frame_painter.h"
97 #include "base/string_split.h" 93 #include "base/string_split.h"
98 #endif 94 #endif
99 95
100 using base::Time; 96 using base::Time;
101 using base::TimeDelta; 97 using base::TimeDelta;
102 using content::BrowserThread; 98 using content::BrowserThread;
(...skipping 396 matching lines...) Expand 10 before | Expand all | Expand 10 after
499 AppendFooter(&output); 495 AppendFooter(&output);
500 return output; 496 return output;
501 } 497 }
502 498
503 std::string AboutNetwork(const std::string& query) { 499 std::string AboutNetwork(const std::string& query) {
504 int refresh; 500 int refresh;
505 base::StringToInt(query, &refresh); 501 base::StringToInt(query, &refresh);
506 return GetNetworkHtmlInfo(refresh); 502 return GetNetworkHtmlInfo(refresh);
507 } 503 }
508 504
509 std::string AddBoolRow(const std::string& name, bool value) {
510 std::string row;
511 row.append(WrapWithTD(name));
512 row.append(WrapWithTD(value ? "true" : "false"));
513 return WrapWithTR(row);
514 }
515
516 std::string AddStringRow(const std::string& name, const std::string& value) { 505 std::string AddStringRow(const std::string& name, const std::string& value) {
517 std::string row; 506 std::string row;
518 row.append(WrapWithTD(name)); 507 row.append(WrapWithTD(name));
519 row.append(WrapWithTD(value)); 508 row.append(WrapWithTD(value));
520 return WrapWithTR(row); 509 return WrapWithTR(row);
521 } 510 }
522 511
523 void FinishCryptohomeDataRequestInternal(
524 scoped_refptr<AboutUIHTMLSource> source,
525 int refresh,
526 int request_id,
527 chromeos::DBusMethodCallStatus call_status,
528 bool is_tpm_token_ready) {
529 if (call_status != chromeos::DBUS_METHOD_CALL_SUCCESS)
530 is_tpm_token_ready = false;
531
532 chromeos::CryptohomeLibrary* cryptohome =
533 chromeos::CrosLibrary::Get()->GetCryptohomeLibrary();
534 std::string output;
535 AppendHeader(&output, refresh, "About Cryptohome");
536 AppendBody(&output);
537 AppendRefresh(&output, refresh, "cryptohome");
538
539 output.append("<h3>CryptohomeLibrary:</h3>");
540 output.append("<table>");
541 output.append(AddBoolRow("IsMounted", cryptohome->IsMounted()));
542 output.append(AddBoolRow("TpmIsReady", cryptohome->TpmIsReady()));
543 output.append(AddBoolRow("TpmIsEnabled", cryptohome->TpmIsEnabled()));
544 output.append(AddBoolRow("TpmIsOwned", cryptohome->TpmIsOwned()));
545 output.append(AddBoolRow("TpmIsBeingOwned", cryptohome->TpmIsBeingOwned()));
546 output.append(AddBoolRow("Pkcs11IsTpmTokenReady", is_tpm_token_ready));
547 output.append("</table>");
548
549 output.append("<h3>crypto:</h3>");
550 output.append("<table>");
551 output.append(AddBoolRow("IsTPMTokenReady", crypto::IsTPMTokenReady()));
552 std::string token_name, user_pin;
553 if (crypto::IsTPMTokenReady())
554 crypto::GetTPMTokenInfo(&token_name, &user_pin);
555 output.append(AddStringRow("token_name", token_name));
556 output.append(AddStringRow("user_pin", std::string(user_pin.length(), '*')));
557 output.append("</table>");
558 AppendFooter(&output);
559
560 source->FinishDataRequest(output, request_id);
561 }
562
563 void FinishCryptohomeDataRequest(scoped_refptr<AboutUIHTMLSource> source,
564 const std::string& query,
565 int request_id) {
566 int refresh;
567 base::StringToInt(query, &refresh);
568
569 chromeos::DBusThreadManager::Get()->GetCryptohomeClient()->
570 Pkcs11IsTpmTokenReady(base::Bind(&FinishCryptohomeDataRequestInternal,
571 source,
572 refresh,
573 request_id));
574 }
575
576 std::string AboutDiscardsRun() { 512 std::string AboutDiscardsRun() {
577 std::string output; 513 std::string output;
578 AppendHeader(&output, 0, "About discards"); 514 AppendHeader(&output, 0, "About discards");
579 output.append(StringPrintf("<meta http-equiv=\"refresh\" content=\"2;%s\">", 515 output.append(StringPrintf("<meta http-equiv=\"refresh\" content=\"2;%s\">",
580 chrome::kChromeUIDiscardsURL)); 516 chrome::kChromeUIDiscardsURL));
581 output.append(WrapWithTag("p", "Discarding a tab...")); 517 output.append(WrapWithTag("p", "Discarding a tab..."));
582 g_browser_process->oom_priority_manager()->LogMemoryAndDiscardTab(); 518 g_browser_process->oom_priority_manager()->LogMemoryAndDiscardTab();
583 AppendFooter(&output); 519 AppendFooter(&output);
584 return output; 520 return output;
585 } 521 }
(...skipping 771 matching lines...) Expand 10 before | Expand all | Expand 10 after
1357 std::string response; 1293 std::string response;
1358 std::string host = source_name(); 1294 std::string host = source_name();
1359 // Add your data source here, in alphabetical order. 1295 // Add your data source here, in alphabetical order.
1360 if (host == chrome::kChromeUIChromeURLsHost) { 1296 if (host == chrome::kChromeUIChromeURLsHost) {
1361 response = ChromeURLs(); 1297 response = ChromeURLs();
1362 } else if (host == chrome::kChromeUICreditsHost) { 1298 } else if (host == chrome::kChromeUICreditsHost) {
1363 int idr = (path == kCreditsJsPath) ? IDR_CREDITS_JS : IDR_CREDITS_HTML; 1299 int idr = (path == kCreditsJsPath) ? IDR_CREDITS_JS : IDR_CREDITS_HTML;
1364 response = ResourceBundle::GetSharedInstance().GetRawDataResource( 1300 response = ResourceBundle::GetSharedInstance().GetRawDataResource(
1365 idr, ui::SCALE_FACTOR_NONE).as_string(); 1301 idr, ui::SCALE_FACTOR_NONE).as_string();
1366 #if defined(OS_CHROMEOS) 1302 #if defined(OS_CHROMEOS)
1367 } else if (host == chrome::kChromeUICryptohomeHost) {
1368 FinishCryptohomeDataRequest(this, path, request_id);
1369 return;
1370 } else if (host == chrome::kChromeUIDiscardsHost) { 1303 } else if (host == chrome::kChromeUIDiscardsHost) {
1371 response = AboutDiscards(path); 1304 response = AboutDiscards(path);
1372 #endif 1305 #endif
1373 #if defined(USE_ASH) 1306 #if defined(USE_ASH)
1374 } else if (host == chrome::kChromeUITransparencyHost) { 1307 } else if (host == chrome::kChromeUITransparencyHost) {
1375 response = AboutTransparency(path); 1308 response = AboutTransparency(path);
1376 #endif 1309 #endif
1377 } else if (host == chrome::kChromeUIDNSHost) { 1310 } else if (host == chrome::kChromeUIDNSHost) {
1378 AboutDnsHandler::Start(this, request_id); 1311 AboutDnsHandler::Start(this, request_id);
1379 return; 1312 return;
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
1441 1374
1442 AboutUI::AboutUI(content::WebUI* web_ui, const std::string& name) 1375 AboutUI::AboutUI(content::WebUI* web_ui, const std::string& name)
1443 : WebUIController(web_ui) { 1376 : WebUIController(web_ui) {
1444 Profile* profile = Profile::FromWebUI(web_ui); 1377 Profile* profile = Profile::FromWebUI(web_ui);
1445 ChromeURLDataManager::DataSource* source = 1378 ChromeURLDataManager::DataSource* source =
1446 new AboutUIHTMLSource(name, profile); 1379 new AboutUIHTMLSource(name, profile);
1447 if (source) { 1380 if (source) {
1448 ChromeURLDataManager::AddDataSource(profile, source); 1381 ChromeURLDataManager::AddDataSource(profile, source);
1449 } 1382 }
1450 } 1383 }
OLDNEW
« no previous file with comments | « chrome/browser/resources/chromeos/cryptohome.js ('k') | chrome/browser/ui/webui/chrome_web_ui_controller_factory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698