| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 <string> | 7 #include <string> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "app/l10n_util.h" | 10 #include "app/l10n_util.h" |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 #elif defined(OS_CHROMEOS) | 54 #elif defined(OS_CHROMEOS) |
| 55 #include "chrome/browser/chromeos/chromeos_version_loader.h" | 55 #include "chrome/browser/chromeos/chromeos_version_loader.h" |
| 56 #elif defined(OS_MACOSX) | 56 #elif defined(OS_MACOSX) |
| 57 #include "chrome/browser/cocoa/about_ipc_dialog.h" | 57 #include "chrome/browser/cocoa/about_ipc_dialog.h" |
| 58 #endif | 58 #endif |
| 59 | 59 |
| 60 #if defined(USE_TCMALLOC) | 60 #if defined(USE_TCMALLOC) |
| 61 #include "third_party/tcmalloc/tcmalloc/src/google/malloc_extension.h" | 61 #include "third_party/tcmalloc/tcmalloc/src/google/malloc_extension.h" |
| 62 #endif | 62 #endif |
| 63 | 63 |
| 64 #if defined(BROWSER_SYNC) | |
| 65 using sync_api::SyncManager; | 64 using sync_api::SyncManager; |
| 66 #endif | |
| 67 | 65 |
| 68 using base::Time; | 66 using base::Time; |
| 69 using base::TimeDelta; | 67 using base::TimeDelta; |
| 70 | 68 |
| 71 #if defined(USE_TCMALLOC) | 69 #if defined(USE_TCMALLOC) |
| 72 // Glue between the callback task and the method in the singleton. | 70 // Glue between the callback task and the method in the singleton. |
| 73 void AboutTcmallocRendererCallback(base::ProcessId pid, std::string output) { | 71 void AboutTcmallocRendererCallback(base::ProcessId pid, std::string output) { |
| 74 Singleton<AboutTcmallocOutputs>::get()->RendererCallback(pid, output); | 72 Singleton<AboutTcmallocOutputs>::get()->RendererCallback(pid, output); |
| 75 } | 73 } |
| 76 #endif | 74 #endif |
| (...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 462 | 460 |
| 463 std::string output = version_html; | 461 std::string output = version_html; |
| 464 jstemplate_builder::AppendJsonHtml(localized_strings, &output); | 462 jstemplate_builder::AppendJsonHtml(localized_strings, &output); |
| 465 jstemplate_builder::AppendI18nTemplateSourceHtml(&output); | 463 jstemplate_builder::AppendI18nTemplateSourceHtml(&output); |
| 466 jstemplate_builder::AppendI18nTemplateProcessHtml(&output); | 464 jstemplate_builder::AppendI18nTemplateProcessHtml(&output); |
| 467 jstemplate_builder::AppendJsTemplateSourceHtml(&output); | 465 jstemplate_builder::AppendJsTemplateSourceHtml(&output); |
| 468 jstemplate_builder::AppendJsTemplateProcessHtml("t", &output); | 466 jstemplate_builder::AppendJsTemplateProcessHtml("t", &output); |
| 469 return output; | 467 return output; |
| 470 } | 468 } |
| 471 | 469 |
| 472 #if defined(BROWSER_SYNC) | |
| 473 static void AddBoolSyncDetail(ListValue* details, const std::wstring& stat_name, | 470 static void AddBoolSyncDetail(ListValue* details, const std::wstring& stat_name, |
| 474 bool stat_value) { | 471 bool stat_value) { |
| 475 DictionaryValue* val = new DictionaryValue; | 472 DictionaryValue* val = new DictionaryValue; |
| 476 val->SetString(L"stat_name", stat_name); | 473 val->SetString(L"stat_name", stat_name); |
| 477 val->SetBoolean(L"stat_value", stat_value); | 474 val->SetBoolean(L"stat_value", stat_value); |
| 478 details->Append(val); | 475 details->Append(val); |
| 479 } | 476 } |
| 480 | 477 |
| 481 static void AddIntSyncDetail(ListValue* details, const std::wstring& stat_name, | 478 static void AddIntSyncDetail(ListValue* details, const std::wstring& stat_name, |
| 482 int64 stat_value) { | 479 int64 stat_value) { |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 553 full_status.max_consecutive_errors); | 550 full_status.max_consecutive_errors); |
| 554 } | 551 } |
| 555 | 552 |
| 556 static const base::StringPiece sync_html( | 553 static const base::StringPiece sync_html( |
| 557 ResourceBundle::GetSharedInstance().GetRawDataResource( | 554 ResourceBundle::GetSharedInstance().GetRawDataResource( |
| 558 IDR_ABOUT_SYNC_HTML)); | 555 IDR_ABOUT_SYNC_HTML)); |
| 559 | 556 |
| 560 return jstemplate_builder::GetTemplateHtml( | 557 return jstemplate_builder::GetTemplateHtml( |
| 561 sync_html, &strings , "t" /* template root node id */); | 558 sync_html, &strings , "t" /* template root node id */); |
| 562 } | 559 } |
| 563 #endif // defined(BROWSER_SYNC) | |
| 564 | 560 |
| 565 // AboutSource ----------------------------------------------------------------- | 561 // AboutSource ----------------------------------------------------------------- |
| 566 | 562 |
| 567 AboutSource::AboutSource() | 563 AboutSource::AboutSource() |
| 568 : DataSource(chrome::kAboutScheme, MessageLoop::current()) { | 564 : DataSource(chrome::kAboutScheme, MessageLoop::current()) { |
| 569 // This should be a singleton. | 565 // This should be a singleton. |
| 570 DCHECK(!about_source); | 566 DCHECK(!about_source); |
| 571 about_source = this; | 567 about_source = this; |
| 572 | 568 |
| 573 // Add us to the global URL handler on the IO thread. | 569 // Add us to the global URL handler on the IO thread. |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 617 return; | 613 return; |
| 618 #else | 614 #else |
| 619 DictionaryValue value; | 615 DictionaryValue value; |
| 620 response = AboutVersion(&value); | 616 response = AboutVersion(&value); |
| 621 #endif | 617 #endif |
| 622 } else if (path == kCreditsPath) { | 618 } else if (path == kCreditsPath) { |
| 623 response = AboutCredits(); | 619 response = AboutCredits(); |
| 624 } else if (path == kTermsPath) { | 620 } else if (path == kTermsPath) { |
| 625 response = AboutTerms(); | 621 response = AboutTerms(); |
| 626 } else if (path == kSyncPath) { | 622 } else if (path == kSyncPath) { |
| 627 #if defined(BROWSER_SYNC) | |
| 628 response = AboutSync(); | 623 response = AboutSync(); |
| 629 #endif | |
| 630 } | 624 } |
| 631 | 625 |
| 632 FinishDataRequest(response, request_id); | 626 FinishDataRequest(response, request_id); |
| 633 } | 627 } |
| 634 | 628 |
| 635 void AboutSource::FinishDataRequest(const std::string& response, | 629 void AboutSource::FinishDataRequest(const std::string& response, |
| 636 int request_id) { | 630 int request_id) { |
| 637 scoped_refptr<RefCountedBytes> html_bytes(new RefCountedBytes); | 631 scoped_refptr<RefCountedBytes> html_bytes(new RefCountedBytes); |
| 638 html_bytes->data.resize(response.size()); | 632 html_bytes->data.resize(response.size()); |
| 639 std::copy(response.begin(), response.end(), html_bytes->data.begin()); | 633 std::copy(response.begin(), response.end(), html_bytes->data.begin()); |
| (...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 900 // Run the dialog. This will re-use the existing one if it's already up. | 894 // Run the dialog. This will re-use the existing one if it's already up. |
| 901 AboutIPCDialog::RunDialog(); | 895 AboutIPCDialog::RunDialog(); |
| 902 return true; | 896 return true; |
| 903 } | 897 } |
| 904 #endif | 898 #endif |
| 905 | 899 |
| 906 #endif // OFFICIAL_BUILD | 900 #endif // OFFICIAL_BUILD |
| 907 | 901 |
| 908 return false; | 902 return false; |
| 909 } | 903 } |
| OLD | NEW |