OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/common/chrome_content_client.h" | 5 #include "chrome/common/chrome_content_client.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
9 #include "base/path_service.h" | 9 #include "base/path_service.h" |
10 #include "base/process_util.h" | 10 #include "base/process_util.h" |
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
293 // swapped out renderers. | 293 // swapped out renderers. |
294 switch (msg.type()) { | 294 switch (msg.type()) { |
295 case ChromeViewHostMsg_Snapshot::ID: | 295 case ChromeViewHostMsg_Snapshot::ID: |
296 return true; | 296 return true; |
297 default: | 297 default: |
298 break; | 298 break; |
299 } | 299 } |
300 return false; | 300 return false; |
301 } | 301 } |
302 | 302 |
303 std::string ChromeContentClient::GetUserAgent(bool mimic_windows) const { | 303 std::string ChromeContentClient::GetUserAgent(bool* overriding) const { |
304 chrome::VersionInfo version_info; | 304 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kUserAgent)) { |
305 std::string product("Chrome/"); | 305 *overriding = true; |
306 product += version_info.is_valid() ? version_info.Version() : "0.0.0.0"; | 306 return CommandLine::ForCurrentProcess()->GetSwitchValueASCII( |
307 | 307 switches::kUserAgent); |
308 return webkit_glue::BuildUserAgentHelper(mimic_windows, product); | 308 } else { |
| 309 *overriding = false; |
| 310 chrome::VersionInfo version_info; |
| 311 std::string product("Chrome/"); |
| 312 product += version_info.is_valid() ? version_info.Version() : "0.0.0.0"; |
| 313 return webkit_glue::BuildUserAgentFromProduct(product); |
| 314 } |
309 } | 315 } |
310 | 316 |
311 string16 ChromeContentClient::GetLocalizedString(int message_id) const { | 317 string16 ChromeContentClient::GetLocalizedString(int message_id) const { |
312 return l10n_util::GetStringUTF16(message_id); | 318 return l10n_util::GetStringUTF16(message_id); |
313 } | 319 } |
314 | 320 |
315 base::StringPiece ChromeContentClient::GetDataResource(int resource_id) const { | 321 base::StringPiece ChromeContentClient::GetDataResource(int resource_id) const { |
316 return ResourceBundle::GetSharedInstance().GetRawDataResource(resource_id); | 322 return ResourceBundle::GetSharedInstance().GetRawDataResource(resource_id); |
317 } | 323 } |
318 | 324 |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
370 policy->SetJobLevel(sandbox::JOB_UNPROTECTED, 0); | 376 policy->SetJobLevel(sandbox::JOB_UNPROTECTED, 0); |
371 policy->SetTokenLevel( | 377 policy->SetTokenLevel( |
372 sandbox::USER_UNPROTECTED, sandbox::USER_UNPROTECTED); | 378 sandbox::USER_UNPROTECTED, sandbox::USER_UNPROTECTED); |
373 } | 379 } |
374 | 380 |
375 return true; | 381 return true; |
376 } | 382 } |
377 #endif | 383 #endif |
378 | 384 |
379 } // namespace chrome | 385 } // namespace chrome |
OLD | NEW |