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

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

Issue 2814012: Split part of about_handler into chrome/common to break the browser-renderer ... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: with unit test Created 10 years, 6 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 | « no previous file | chrome/browser/browser_about_handler_unittest.cc » ('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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 <string> 8 #include <string>
8 #include <vector> 9 #include <vector>
9 10
10 #include "app/l10n_util.h" 11 #include "app/l10n_util.h"
11 #include "app/resource_bundle.h" 12 #include "app/resource_bundle.h"
12 #include "base/callback.h" 13 #include "base/callback.h"
13 #include "base/file_version_info.h" 14 #include "base/file_version_info.h"
14 #include "base/histogram.h" 15 #include "base/histogram.h"
15 #include "base/i18n/number_formatting.h" 16 #include "base/i18n/number_formatting.h"
16 #include "base/path_service.h" 17 #include "base/path_service.h"
(...skipping 13 matching lines...) Expand all
30 #include "chrome/browser/memory_details.h" 31 #include "chrome/browser/memory_details.h"
31 #include "chrome/browser/metrics/histogram_synchronizer.h" 32 #include "chrome/browser/metrics/histogram_synchronizer.h"
32 #include "chrome/browser/net/dns_global.h" 33 #include "chrome/browser/net/dns_global.h"
33 #include "chrome/browser/platform_util.h" 34 #include "chrome/browser/platform_util.h"
34 #include "chrome/browser/pref_service.h" 35 #include "chrome/browser/pref_service.h"
35 #include "chrome/browser/profile.h" 36 #include "chrome/browser/profile.h"
36 #include "chrome/browser/profile_manager.h" 37 #include "chrome/browser/profile_manager.h"
37 #include "chrome/browser/renderer_host/render_process_host.h" 38 #include "chrome/browser/renderer_host/render_process_host.h"
38 #include "chrome/browser/renderer_host/render_view_host.h" 39 #include "chrome/browser/renderer_host/render_view_host.h"
39 #include "chrome/browser/sync/profile_sync_service.h" 40 #include "chrome/browser/sync/profile_sync_service.h"
41 #include "chrome/common/about_handler.h"
40 #include "chrome/common/chrome_paths.h" 42 #include "chrome/common/chrome_paths.h"
41 #include "chrome/common/jstemplate_builder.h" 43 #include "chrome/common/jstemplate_builder.h"
42 #include "chrome/common/pref_names.h" 44 #include "chrome/common/pref_names.h"
43 #include "chrome/common/render_messages.h" 45 #include "chrome/common/render_messages.h"
44 #include "chrome/common/url_constants.h" 46 #include "chrome/common/url_constants.h"
45 #include "chrome/renderer/about_handler.h"
46 #include "googleurl/src/gurl.h" 47 #include "googleurl/src/gurl.h"
47 #include "grit/browser_resources.h" 48 #include "grit/browser_resources.h"
48 #include "grit/chromium_strings.h" 49 #include "grit/chromium_strings.h"
49 #include "grit/generated_resources.h" 50 #include "grit/generated_resources.h"
50 #include "grit/locale_settings.h" 51 #include "grit/locale_settings.h"
51 #include "webkit/glue/webkit_glue.h" 52 #include "webkit/glue/webkit_glue.h"
52 #ifdef CHROME_V8 53 #ifdef CHROME_V8
53 #include "v8/include/v8.h" 54 #include "v8/include/v8.h"
54 #endif 55 #endif
55 56
56 #if defined(OS_CHROMEOS)
57 #include "chrome/browser/chromeos/cros/syslogs_library.h"
58 #include "chrome/browser/chromeos/cros/cros_library.h"
59 #endif
60
61 #if defined(OS_WIN) 57 #if defined(OS_WIN)
62 #include "chrome/browser/views/about_ipc_dialog.h" 58 #include "chrome/browser/views/about_ipc_dialog.h"
63 #include "chrome/browser/views/about_network_dialog.h" 59 #include "chrome/browser/views/about_network_dialog.h"
64 #elif defined(OS_CHROMEOS) 60 #elif defined(OS_CHROMEOS)
65 #include "chrome/browser/chromeos/cros/cros_library.h" 61 #include "chrome/browser/chromeos/cros/cros_library.h"
66 #include "chrome/browser/chromeos/cros/network_library.h" 62 #include "chrome/browser/chromeos/cros/network_library.h"
63 #include "chrome/browser/chromeos/cros/syslogs_library.h"
67 #include "chrome/browser/chromeos/version_loader.h" 64 #include "chrome/browser/chromeos/version_loader.h"
68 #elif defined(OS_MACOSX) 65 #elif defined(OS_MACOSX)
69 #include "chrome/browser/cocoa/about_ipc_dialog.h" 66 #include "chrome/browser/cocoa/about_ipc_dialog.h"
70 #endif 67 #endif
71 68
72 #if defined(USE_TCMALLOC) 69 #if defined(USE_TCMALLOC)
73 #include "third_party/tcmalloc/chromium/src/google/malloc_extension.h" 70 #include "third_party/tcmalloc/chromium/src/google/malloc_extension.h"
74 #endif 71 #endif
75 72
76 using sync_api::SyncManager; 73 using sync_api::SyncManager;
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 // Where the results are fed to. 190 // Where the results are fed to.
194 scoped_refptr<AboutSource> source_; 191 scoped_refptr<AboutSource> source_;
195 192
196 // ID identifying the request. 193 // ID identifying the request.
197 int request_id_; 194 int request_id_;
198 195
199 // Handles asynchronously loading the version. 196 // Handles asynchronously loading the version.
200 chromeos::VersionLoader loader_; 197 chromeos::VersionLoader loader_;
201 198
202 // Used to request the version. 199 // Used to request the version.
203 CancelableRequestConsumer consumer_; 200 CancelableRequestConsumer consumer_;
204 201
205 DISALLOW_COPY_AND_ASSIGN(ChromeOSAboutVersionHandler); 202 DISALLOW_COPY_AND_ASSIGN(ChromeOSAboutVersionHandler);
206 }; 203 };
207 #endif 204 #endif
208 205
209 // Individual about handlers --------------------------------------------------- 206 // Individual about handlers ---------------------------------------------------
210 207
211 #if defined(OS_CHROMEOS) 208 #if defined(OS_CHROMEOS)
212 std::string AboutNetwork(const std::string& query) { 209 std::string AboutNetwork(const std::string& query) {
213 int refresh; 210 int refresh;
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
361 timers = new ListValue(); 358 timers = new ListValue();
362 root.Set(L"timers", timers); 359 root.Set(L"timers", timers);
363 } 360 }
364 361
365 // NOTE: Counters start at index 1. 362 // NOTE: Counters start at index 1.
366 for (int index = 1; index <= table->GetMaxCounters(); index++) { 363 for (int index = 1; index <= table->GetMaxCounters(); index++) {
367 // Get the counter's full name 364 // Get the counter's full name
368 std::string full_name = table->GetRowName(index); 365 std::string full_name = table->GetRowName(index);
369 if (full_name.length() == 0) 366 if (full_name.length() == 0)
370 break; 367 break;
371 DCHECK(full_name[1] == ':'); 368 DCHECK_EQ(':', full_name[1]);
372 char counter_type = full_name[0]; 369 char counter_type = full_name[0];
373 std::string name = full_name.substr(2); 370 std::string name = full_name.substr(2);
374 371
375 // JSON doesn't allow '.' in names. 372 // JSON doesn't allow '.' in names.
376 size_t pos; 373 size_t pos;
377 while ((pos = name.find(".")) != std::string::npos) 374 while ((pos = name.find(".")) != std::string::npos)
378 name.replace(pos, 1, ":"); 375 name.replace(pos, 1, ":");
379 376
380 // Try to see if this name already exists. 377 // Try to see if this name already exists.
381 DictionaryValue* counter = NULL; 378 DictionaryValue* counter = NULL;
(...skipping 607 matching lines...) Expand 10 before | Expand all | Expand 10 after
989 // Handle URL to crash the browser process. 986 // Handle URL to crash the browser process.
990 if (LowerCaseEqualsASCII(url->spec(), chrome::kAboutBrowserCrash)) { 987 if (LowerCaseEqualsASCII(url->spec(), chrome::kAboutBrowserCrash)) {
991 // Induce an intentional crash in the browser process. 988 // Induce an intentional crash in the browser process.
992 int* bad_pointer = NULL; 989 int* bad_pointer = NULL;
993 *bad_pointer = 42; 990 *bad_pointer = 42;
994 return true; 991 return true;
995 } 992 }
996 993
997 // There are a few about: URLs that we hand over to the renderer. If the 994 // There are a few about: URLs that we hand over to the renderer. If the
998 // renderer wants them, don't do any rewriting. 995 // renderer wants them, don't do any rewriting.
999 if (AboutHandler::WillHandle(*url)) 996 if (chrome_about_handler::WillHandle(*url))
1000 return false; 997 return false;
1001 998
1002 // Anything else requires our special handler, make sure its initialized. 999 // Anything else requires our special handler, make sure its initialized.
1003 // We only need to register the AboutSource once and it is kept globally. 1000 // We only need to register the AboutSource once and it is kept globally.
1004 // There is currently no way to remove a data source. 1001 // There is currently no way to remove a data source.
1005 static bool initialized = false; 1002 static bool initialized = false;
1006 if (!initialized) { 1003 if (!initialized) {
1007 about_source = new AboutSource(); 1004 about_source = new AboutSource();
1008 initialized = true; 1005 initialized = true;
1009 } 1006 }
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
1044 // Run the dialog. This will re-use the existing one if it's already up. 1041 // Run the dialog. This will re-use the existing one if it's already up.
1045 AboutIPCDialog::RunDialog(); 1042 AboutIPCDialog::RunDialog();
1046 return true; 1043 return true;
1047 } 1044 }
1048 #endif 1045 #endif
1049 1046
1050 #endif // OFFICIAL_BUILD 1047 #endif // OFFICIAL_BUILD
1051 1048
1052 return false; 1049 return false;
1053 } 1050 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/browser_about_handler_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698