| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 const char kDnsPath[] = "dns"; | 68 const char kDnsPath[] = "dns"; |
| 69 const char kHistogramsPath[] = "histograms"; | 69 const char kHistogramsPath[] = "histograms"; |
| 70 const char kObjectsPath[] = "objects"; | 70 const char kObjectsPath[] = "objects"; |
| 71 const char kMemoryRedirectPath[] = "memory-redirect"; | 71 const char kMemoryRedirectPath[] = "memory-redirect"; |
| 72 const char kMemoryPath[] = "memory"; | 72 const char kMemoryPath[] = "memory"; |
| 73 const char kPluginsPath[] = "plugins"; | 73 const char kPluginsPath[] = "plugins"; |
| 74 const char kStatsPath[] = "stats"; | 74 const char kStatsPath[] = "stats"; |
| 75 const char kVersionPath[] = "version"; | 75 const char kVersionPath[] = "version"; |
| 76 const char kCreditsPath[] = "credits"; | 76 const char kCreditsPath[] = "credits"; |
| 77 const char kTermsPath[] = "terms"; | 77 const char kTermsPath[] = "terms"; |
| 78 const char kLinuxSplash[] = "linux-splash"; | |
| 79 const char kSyncPath[] = "sync"; | 78 const char kSyncPath[] = "sync"; |
| 80 | 79 |
| 81 // Points to the singleton AboutSource object, if any. | 80 // Points to the singleton AboutSource object, if any. |
| 82 ChromeURLDataManager::DataSource* about_source = NULL; | 81 ChromeURLDataManager::DataSource* about_source = NULL; |
| 83 | 82 |
| 84 // When you type about:memory, it actually loads an intermediate URL that | 83 // When you type about:memory, it actually loads an intermediate URL that |
| 85 // redirects you to the final page. This avoids the problem where typing | 84 // redirects you to the final page. This avoids the problem where typing |
| 86 // "about:memory" on the new tab page or any other page where a process | 85 // "about:memory" on the new tab page or any other page where a process |
| 87 // transition would occur to the about URL will cause some confusion. | 86 // transition would occur to the about URL will cause some confusion. |
| 88 // | 87 // |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 188 HistogramSynchronizer* current_synchronizer = | 187 HistogramSynchronizer* current_synchronizer = |
| 189 HistogramSynchronizer::CurrentSynchronizer(); | 188 HistogramSynchronizer::CurrentSynchronizer(); |
| 190 DCHECK(current_synchronizer != NULL); | 189 DCHECK(current_synchronizer != NULL); |
| 191 current_synchronizer->FetchRendererHistogramsSynchronously(wait_time); | 190 current_synchronizer->FetchRendererHistogramsSynchronously(wait_time); |
| 192 | 191 |
| 193 std::string data; | 192 std::string data; |
| 194 StatisticsRecorder::WriteHTMLGraph(query, &data); | 193 StatisticsRecorder::WriteHTMLGraph(query, &data); |
| 195 return data; | 194 return data; |
| 196 } | 195 } |
| 197 | 196 |
| 198 std::string AboutLinuxSplash() { | |
| 199 int resource_id = IDR_LINUX_SPLASH_HTML_CHROMIUM; | |
| 200 scoped_ptr<FileVersionInfo> version_info( | |
| 201 FileVersionInfo::CreateFileVersionInfoForCurrentModule()); | |
| 202 if (version_info == NULL) { | |
| 203 DLOG(ERROR) << "Unable to create FileVersionInfo object"; | |
| 204 } else { | |
| 205 if (version_info->is_official_build()) { | |
| 206 resource_id = IDR_LINUX_SPLASH_HTML_CHROME; | |
| 207 } | |
| 208 } | |
| 209 static const std::string linux_splash_html = | |
| 210 ResourceBundle::GetSharedInstance().GetDataResource(resource_id); | |
| 211 | |
| 212 return linux_splash_html; | |
| 213 } | |
| 214 | |
| 215 void AboutMemory(AboutSource* source, int request_id) { | 197 void AboutMemory(AboutSource* source, int request_id) { |
| 216 // The AboutMemoryHandler cleans itself up. | 198 // The AboutMemoryHandler cleans itself up. |
| 217 new AboutMemoryHandler(source, request_id); | 199 new AboutMemoryHandler(source, request_id); |
| 218 } | 200 } |
| 219 | 201 |
| 220 std::string AboutObjects(const std::string& query) { | 202 std::string AboutObjects(const std::string& query) { |
| 221 std::string data; | 203 std::string data; |
| 222 tracked_objects::ThreadData::WriteHTML(query, &data); | 204 tracked_objects::ThreadData::WriteHTML(query, &data); |
| 223 return data; | 205 return data; |
| 224 } | 206 } |
| (...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 578 #endif | 560 #endif |
| 579 } else if (path == kCreditsPath) { | 561 } else if (path == kCreditsPath) { |
| 580 response = AboutCredits(); | 562 response = AboutCredits(); |
| 581 } else if (path == kTermsPath) { | 563 } else if (path == kTermsPath) { |
| 582 response = AboutTerms(); | 564 response = AboutTerms(); |
| 583 } else if (path == kSyncPath) { | 565 } else if (path == kSyncPath) { |
| 584 #ifdef CHROME_PERSONALIZATION | 566 #ifdef CHROME_PERSONALIZATION |
| 585 response = AboutSync(); | 567 response = AboutSync(); |
| 586 #endif | 568 #endif |
| 587 } | 569 } |
| 588 #if defined(OS_LINUX) | |
| 589 else if (path == kLinuxSplash) { | |
| 590 response = AboutLinuxSplash(); | |
| 591 } | |
| 592 #endif | |
| 593 | 570 |
| 594 FinishDataRequest(response, request_id); | 571 FinishDataRequest(response, request_id); |
| 595 } | 572 } |
| 596 | 573 |
| 597 void AboutSource::FinishDataRequest(const std::string& response, | 574 void AboutSource::FinishDataRequest(const std::string& response, |
| 598 int request_id) { | 575 int request_id) { |
| 599 scoped_refptr<RefCountedBytes> html_bytes(new RefCountedBytes); | 576 scoped_refptr<RefCountedBytes> html_bytes(new RefCountedBytes); |
| 600 html_bytes->data.resize(response.size()); | 577 html_bytes->data.resize(response.size()); |
| 601 std::copy(response.begin(), response.end(), html_bytes->data.begin()); | 578 std::copy(response.begin(), response.end(), html_bytes->data.begin()); |
| 602 SendResponse(request_id, html_bytes); | 579 SendResponse(request_id, html_bytes); |
| (...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 860 AboutIPCDialog::RunDialog(); | 837 AboutIPCDialog::RunDialog(); |
| 861 return true; | 838 return true; |
| 862 } | 839 } |
| 863 #endif | 840 #endif |
| 864 | 841 |
| 865 #else | 842 #else |
| 866 // TODO(port) Implement this. | 843 // TODO(port) Implement this. |
| 867 #endif | 844 #endif |
| 868 return false; | 845 return false; |
| 869 } | 846 } |
| OLD | NEW |