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

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

Issue 6804: Add about:terms to Chrome, and about:licence to Chromium and Chrome. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 12 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
« no previous file with comments | « chrome/browser/browser_about_handler.h ('k') | chrome/browser/browser_resources.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "base/file_version_info.h" 10 #include "base/file_version_info.h"
11 #include "base/histogram.h" 11 #include "base/histogram.h"
12 #include "base/image_util.h" 12 #include "base/image_util.h"
13 #include "base/process_util.h" 13 #include "base/process_util.h"
14 #include "base/stats_table.h" 14 #include "base/stats_table.h"
15 #include "base/string_piece.h" 15 #include "base/string_piece.h"
16 #include "base/string_util.h" 16 #include "base/string_util.h"
17 #include "base/tracked_objects.h" 17 #include "base/tracked_objects.h"
18 #include "chrome/app/locales/locale_settings.h"
18 #include "chrome/browser/browser.h" 19 #include "chrome/browser/browser.h"
19 #include "chrome/browser/browser_list.h" 20 #include "chrome/browser/browser_list.h"
20 #include "chrome/browser/browser_process.h" 21 #include "chrome/browser/browser_process.h"
21 #include "chrome/browser/browser_resources.h" 22 #include "chrome/browser/browser_resources.h"
22 #include "chrome/browser/dom_ui/chrome_url_data_manager.h" 23 #include "chrome/browser/dom_ui/chrome_url_data_manager.h"
23 #include "chrome/browser/ipc_status_view.h" 24 #include "chrome/browser/ipc_status_view.h"
24 #include "chrome/browser/memory_details.h" 25 #include "chrome/browser/memory_details.h"
25 #include "chrome/browser/net/dns_global.h" 26 #include "chrome/browser/net/dns_global.h"
26 #include "chrome/browser/plugin_process_host.h" 27 #include "chrome/browser/plugin_process_host.h"
27 #include "chrome/browser/plugin_service.h" 28 #include "chrome/browser/plugin_service.h"
(...skipping 21 matching lines...) Expand all
49 50
50 // The paths used for the about pages. 51 // The paths used for the about pages.
51 static const char kCachePath[] = "cache"; 52 static const char kCachePath[] = "cache";
52 static const char kDnsPath[] = "dns"; 53 static const char kDnsPath[] = "dns";
53 static const char kHistogramsPath[] = "histograms"; 54 static const char kHistogramsPath[] = "histograms";
54 static const char kObjectsPath[] = "objects"; 55 static const char kObjectsPath[] = "objects";
55 static const char kMemoryPath[] = "memory"; 56 static const char kMemoryPath[] = "memory";
56 static const char kPluginsPath[] = "plugins"; 57 static const char kPluginsPath[] = "plugins";
57 static const char kStatsPath[] = "stats"; 58 static const char kStatsPath[] = "stats";
58 static const char kVersionPath[] = "version"; 59 static const char kVersionPath[] = "version";
60 static const char kCreditsPath[] = "credits";
61 static const char kTermsPath[] = "terms";
59 62
60 class AboutSource : public ChromeURLDataManager::DataSource { 63 class AboutSource : public ChromeURLDataManager::DataSource {
61 public: 64 public:
62 // Creates our datasource. 65 // Creates our datasource.
63 AboutSource(); 66 AboutSource();
64 virtual ~AboutSource(); 67 virtual ~AboutSource();
65 68
66 // Called when the network layer has requested a resource underneath 69 // Called when the network layer has requested a resource underneath
67 // the path we registered. 70 // the path we registered.
68 virtual void StartDataRequest(const std::string& path, int request_id); 71 virtual void StartDataRequest(const std::string& path, int request_id);
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 BrowserAboutHandler::AboutMemory(this, request_id); 124 BrowserAboutHandler::AboutMemory(this, request_id);
122 return; 125 return;
123 } else if (path == kObjectsPath) { 126 } else if (path == kObjectsPath) {
124 response = BrowserAboutHandler::AboutObjects(info); 127 response = BrowserAboutHandler::AboutObjects(info);
125 } else if (path == kPluginsPath) { 128 } else if (path == kPluginsPath) {
126 response = BrowserAboutHandler::AboutPlugins(); 129 response = BrowserAboutHandler::AboutPlugins();
127 } else if (path == kStatsPath) { 130 } else if (path == kStatsPath) {
128 response = BrowserAboutHandler::AboutStats(); 131 response = BrowserAboutHandler::AboutStats();
129 } else if (path == kVersionPath || path.empty()) { 132 } else if (path == kVersionPath || path.empty()) {
130 response = BrowserAboutHandler::AboutVersion(); 133 response = BrowserAboutHandler::AboutVersion();
134 } else if (path == kCreditsPath) {
135 response = BrowserAboutHandler::AboutCredits();
136 } else if (path == kTermsPath) {
137 response = BrowserAboutHandler::AboutTerms();
131 } 138 }
132 FinishDataRequest(response, request_id); 139 FinishDataRequest(response, request_id);
133 } 140 }
134 141
135 void AboutSource::FinishDataRequest(const std::string& response, 142 void AboutSource::FinishDataRequest(const std::string& response,
136 int request_id) { 143 int request_id) {
137 scoped_refptr<RefCountedBytes> html_bytes(new RefCountedBytes); 144 scoped_refptr<RefCountedBytes> html_bytes(new RefCountedBytes);
138 html_bytes->data.resize(response.size()); 145 html_bytes->data.resize(response.size());
139 std::copy(response.begin(), response.end(), html_bytes->data.begin()); 146 std::copy(response.begin(), response.end(), html_bytes->data.begin());
140 SendResponse(request_id, html_bytes); 147 SendResponse(request_id, html_bytes);
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
267 274
268 static const StringPiece version_html( 275 static const StringPiece version_html(
269 ResourceBundle::GetSharedInstance().GetRawDataResource( 276 ResourceBundle::GetSharedInstance().GetRawDataResource(
270 IDR_ABOUT_VERSION_HTML)); 277 IDR_ABOUT_VERSION_HTML));
271 278
272 return jstemplate_builder::GetTemplateHtml( 279 return jstemplate_builder::GetTemplateHtml(
273 version_html, &localized_strings, "t" /* template root node id */); 280 version_html, &localized_strings, "t" /* template root node id */);
274 } 281 }
275 282
276 // static 283 // static
284 std::string BrowserAboutHandler::AboutCredits() {
285 static const std::string credits_html =
286 ResourceBundle::GetSharedInstance().GetDataResource(
287 IDR_CREDITS_HTML);
288
289 return credits_html;
290 }
291
292 // static
293 std::string BrowserAboutHandler::AboutTerms() {
294 static const std::string terms_html =
295 ResourceBundle::GetSharedInstance().GetDataResource(
296 IDR_TERMS_HTML);
297
298 return terms_html;
299 }
300
301 // static
277 std::string BrowserAboutHandler::AboutPlugins() { 302 std::string BrowserAboutHandler::AboutPlugins() {
278 // Strings used in the JsTemplate file. 303 // Strings used in the JsTemplate file.
279 DictionaryValue localized_strings; 304 DictionaryValue localized_strings;
280 localized_strings.SetString(L"title", 305 localized_strings.SetString(L"title",
281 l10n_util::GetString(IDS_ABOUT_PLUGINS_TITLE)); 306 l10n_util::GetString(IDS_ABOUT_PLUGINS_TITLE));
282 localized_strings.SetString(L"headingPlugs", 307 localized_strings.SetString(L"headingPlugs",
283 l10n_util::GetString(IDS_ABOUT_PLUGINS_HEADING_PLUGS)); 308 l10n_util::GetString(IDS_ABOUT_PLUGINS_HEADING_PLUGS));
284 localized_strings.SetString(L"headingNoPlugs", 309 localized_strings.SetString(L"headingNoPlugs",
285 l10n_util::GetString(IDS_ABOUT_PLUGINS_HEADING_NOPLUGS)); 310 l10n_util::GetString(IDS_ABOUT_PLUGINS_HEADING_NOPLUGS));
286 localized_strings.SetString(L"filename", 311 localized_strings.SetString(L"filename",
(...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after
630 AboutSource* about_source = static_cast<AboutSource*>(source_); 655 AboutSource* about_source = static_cast<AboutSource*>(source_);
631 about_source->FinishDataRequest(template_html, request_id_); 656 about_source->FinishDataRequest(template_html, request_id_);
632 } 657 }
633 658
634 // static 659 // static
635 void BrowserAboutHandler::AboutMemory(AboutSource* source, int request_id) { 660 void BrowserAboutHandler::AboutMemory(AboutSource* source, int request_id) {
636 // The AboutMemoryHandler cleans itself up. 661 // The AboutMemoryHandler cleans itself up.
637 new AboutMemoryHandler(source, request_id); 662 new AboutMemoryHandler(source, request_id);
638 } 663 }
639 664
OLDNEW
« no previous file with comments | « chrome/browser/browser_about_handler.h ('k') | chrome/browser/browser_resources.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698