| 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 "build/build_config.h" | 5 #include "build/build_config.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/field_trial.h" | 10 #include "base/field_trial.h" |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 137 | 137 |
| 138 #if defined(OS_WIN) || defined(OS_LINUX) | 138 #if defined(OS_WIN) || defined(OS_LINUX) |
| 139 // The net module doesn't have access to this HTML or the strings that need to | 139 // The net module doesn't have access to this HTML or the strings that need to |
| 140 // be localized. The Chrome locale will never change while we're running, so | 140 // be localized. The Chrome locale will never change while we're running, so |
| 141 // it's safe to have a static string that we always return a pointer into. | 141 // it's safe to have a static string that we always return a pointer into. |
| 142 // This allows us to have the ResourceProvider return a pointer into the actual | 142 // This allows us to have the ResourceProvider return a pointer into the actual |
| 143 // resource (via a StringPiece), instead of always copying resources. | 143 // resource (via a StringPiece), instead of always copying resources. |
| 144 struct LazyDirectoryListerCacher { | 144 struct LazyDirectoryListerCacher { |
| 145 LazyDirectoryListerCacher() { | 145 LazyDirectoryListerCacher() { |
| 146 DictionaryValue value; | 146 DictionaryValue value; |
| 147 value.SetString(L"header", | 147 value.SetString( |
| 148 l10n_util::GetString(IDS_DIRECTORY_LISTING_HEADER)); | 148 ASCIIToUTF16("header"), |
| 149 value.SetString(L"parentDirText", | 149 WideToUTF16Hack(l10n_util::GetString(IDS_DIRECTORY_LISTING_HEADER))); |
| 150 l10n_util::GetString(IDS_DIRECTORY_LISTING_PARENT)); | 150 value.SetString( |
| 151 value.SetString(L"headerName", | 151 ASCIIToUTF16("parentDirText"), |
| 152 l10n_util::GetString(IDS_DIRECTORY_LISTING_NAME)); | 152 WideToUTF16Hack(l10n_util::GetString(IDS_DIRECTORY_LISTING_PARENT))); |
| 153 value.SetString(L"headerSize", | 153 value.SetString( |
| 154 l10n_util::GetString(IDS_DIRECTORY_LISTING_SIZE)); | 154 ASCIIToUTF16("headerName"), |
| 155 value.SetString(L"headerDateModified", | 155 WideToUTF16Hack(l10n_util::GetString(IDS_DIRECTORY_LISTING_NAME))); |
| 156 l10n_util::GetString(IDS_DIRECTORY_LISTING_DATE_MODIFIED)); | 156 value.SetString( |
| 157 ASCIIToUTF16("headerSize"), |
| 158 WideToUTF16Hack(l10n_util::GetString(IDS_DIRECTORY_LISTING_SIZE))); |
| 159 value.SetString( |
| 160 ASCIIToUTF16("headerDateModified"), |
| 161 WideToUTF16Hack( |
| 162 l10n_util::GetString(IDS_DIRECTORY_LISTING_DATE_MODIFIED))); |
| 157 html_data = jstemplate_builder::GetTemplateHtml( | 163 html_data = jstemplate_builder::GetTemplateHtml( |
| 158 ResourceBundle::GetSharedInstance().GetRawDataResource( | 164 ResourceBundle::GetSharedInstance().GetRawDataResource( |
| 159 IDR_DIR_HEADER_HTML), | 165 IDR_DIR_HEADER_HTML), |
| 160 &value, | 166 &value, |
| 161 "t"); | 167 "t"); |
| 162 } | 168 } |
| 163 | 169 |
| 164 std::string html_data; | 170 std::string html_data; |
| 165 }; | 171 }; |
| 166 | 172 |
| (...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 501 if (parsed_command_line.HasSwitch(switches::kSdchFilter)) { | 507 if (parsed_command_line.HasSwitch(switches::kSdchFilter)) { |
| 502 switch_domain = | 508 switch_domain = |
| 503 WideToASCII(parsed_command_line.GetSwitchValue(switches::kSdchFilter)); | 509 WideToASCII(parsed_command_line.GetSwitchValue(switches::kSdchFilter)); |
| 504 } | 510 } |
| 505 sdch_manager.EnableSdchSupport(switch_domain); | 511 sdch_manager.EnableSdchSupport(switch_domain); |
| 506 #endif | 512 #endif |
| 507 | 513 |
| 508 MetricsService* metrics = NULL; | 514 MetricsService* metrics = NULL; |
| 509 if (!parsed_command_line.HasSwitch(switches::kDisableMetrics)) { | 515 if (!parsed_command_line.HasSwitch(switches::kDisableMetrics)) { |
| 510 if (parsed_command_line.HasSwitch(switches::kMetricsRecordingOnly)) { | 516 if (parsed_command_line.HasSwitch(switches::kMetricsRecordingOnly)) { |
| 511 local_state->transient()->SetBoolean(prefs::kMetricsReportingEnabled, | 517 local_state->transient()->SetBoolean( |
| 512 false); | 518 WideToUTF16Hack(prefs::kMetricsReportingEnabled), false); |
| 513 } | 519 } |
| 514 metrics = browser_process->metrics_service(); | 520 metrics = browser_process->metrics_service(); |
| 515 DCHECK(metrics); | 521 DCHECK(metrics); |
| 516 | 522 |
| 517 // If we're testing then we don't care what the user preference is, we turn | 523 // If we're testing then we don't care what the user preference is, we turn |
| 518 // on recording, but not reporting, otherwise tests fail. | 524 // on recording, but not reporting, otherwise tests fail. |
| 519 if (parsed_command_line.HasSwitch(switches::kMetricsRecordingOnly)) { | 525 if (parsed_command_line.HasSwitch(switches::kMetricsRecordingOnly)) { |
| 520 metrics->StartRecordingOnly(); | 526 metrics->StartRecordingOnly(); |
| 521 } else { | 527 } else { |
| 522 // If the user permits metrics reporting with the checkbox in the | 528 // If the user permits metrics reporting with the checkbox in the |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 565 if (metrics) | 571 if (metrics) |
| 566 metrics->Stop(); | 572 metrics->Stop(); |
| 567 | 573 |
| 568 // browser_shutdown takes care of deleting browser_process, so we need to | 574 // browser_shutdown takes care of deleting browser_process, so we need to |
| 569 // release it. | 575 // release it. |
| 570 browser_process.release(); | 576 browser_process.release(); |
| 571 browser_shutdown::Shutdown(); | 577 browser_shutdown::Shutdown(); |
| 572 | 578 |
| 573 return result_code; | 579 return result_code; |
| 574 } | 580 } |
| OLD | NEW |