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

Side by Side Diff: chrome/common/chrome_content_client.cc

Issue 491123004: Make sure that HttpRequestHeaders contains valid key-value pairs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: edit comment Created 6 years, 4 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/cpu.h" 8 #include "base/cpu.h"
9 #include "base/debug/crash_logging.h" 9 #include "base/debug/crash_logging.h"
10 #include "base/file_util.h" 10 #include "base/file_util.h"
(...skipping 16 matching lines...) Expand all
27 #include "chrome/grit/common_resources.h" 27 #include "chrome/grit/common_resources.h"
28 #include "components/dom_distiller/core/url_constants.h" 28 #include "components/dom_distiller/core/url_constants.h"
29 #include "components/nacl/common/nacl_process_type.h" 29 #include "components/nacl/common/nacl_process_type.h"
30 #include "content/public/common/content_constants.h" 30 #include "content/public/common/content_constants.h"
31 #include "content/public/common/content_switches.h" 31 #include "content/public/common/content_switches.h"
32 #include "content/public/common/pepper_plugin_info.h" 32 #include "content/public/common/pepper_plugin_info.h"
33 #include "content/public/common/url_constants.h" 33 #include "content/public/common/url_constants.h"
34 #include "content/public/common/user_agent.h" 34 #include "content/public/common/user_agent.h"
35 #include "extensions/common/constants.h" 35 #include "extensions/common/constants.h"
36 #include "gpu/config/gpu_info.h" 36 #include "gpu/config/gpu_info.h"
37 #include "net/http/http_util.h"
37 #include "ppapi/shared_impl/ppapi_permissions.h" 38 #include "ppapi/shared_impl/ppapi_permissions.h"
38 #include "ui/base/l10n/l10n_util.h" 39 #include "ui/base/l10n/l10n_util.h"
39 #include "ui/base/layout.h" 40 #include "ui/base/layout.h"
40 #include "ui/base/resource/resource_bundle.h" 41 #include "ui/base/resource/resource_bundle.h"
41 42
42 #include "flapper_version.h" // In SHARED_INTERMEDIATE_DIR. 43 #include "flapper_version.h" // In SHARED_INTERMEDIATE_DIR.
43 #include "widevine_cdm_version.h" // In SHARED_INTERMEDIATE_DIR. 44 #include "widevine_cdm_version.h" // In SHARED_INTERMEDIATE_DIR.
44 45
45 #if defined(OS_WIN) 46 #if defined(OS_WIN)
46 #include "base/win/registry.h" 47 #include "base/win/registry.h"
(...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after
411 std::string GetProduct() { 412 std::string GetProduct() {
412 chrome::VersionInfo version_info; 413 chrome::VersionInfo version_info;
413 return version_info.is_valid() ? 414 return version_info.is_valid() ?
414 version_info.ProductNameAndVersionForUserAgent() : std::string(); 415 version_info.ProductNameAndVersionForUserAgent() : std::string();
415 } 416 }
416 417
417 } // namespace 418 } // namespace
418 419
419 std::string GetUserAgent() { 420 std::string GetUserAgent() {
420 CommandLine* command_line = CommandLine::ForCurrentProcess(); 421 CommandLine* command_line = CommandLine::ForCurrentProcess();
421 if (command_line->HasSwitch(switches::kUserAgent)) 422 if (command_line->HasSwitch(switches::kUserAgent)) {
422 return command_line->GetSwitchValueASCII(switches::kUserAgent); 423 std::string ua = command_line->GetSwitchValueASCII(switches::kUserAgent);
424 if (net::HttpUtil::IsValidHeaderValue(ua))
425 return ua;
426 LOG(WARNING) << "Ignored invalid value for flag --" << switches::kUserAgent;
427 }
423 428
424 std::string product = GetProduct(); 429 std::string product = GetProduct();
425 #if defined(OS_ANDROID) 430 #if defined(OS_ANDROID)
426 if (command_line->HasSwitch(switches::kUseMobileUserAgent)) 431 if (command_line->HasSwitch(switches::kUseMobileUserAgent))
427 product += " Mobile"; 432 product += " Mobile";
428 #endif 433 #endif
429 return content::BuildUserAgentFromProduct(product); 434 return content::BuildUserAgentFromProduct(product);
430 } 435 }
431 436
432 void ChromeContentClient::SetActiveURL(const GURL& url) { 437 void ChromeContentClient::SetActiveURL(const GURL& url) {
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
527 int sandbox_type, 532 int sandbox_type,
528 int* sandbox_profile_resource_id) const { 533 int* sandbox_profile_resource_id) const {
529 DCHECK(sandbox_profile_resource_id); 534 DCHECK(sandbox_profile_resource_id);
530 if (sandbox_type == NACL_SANDBOX_TYPE_NACL_LOADER) { 535 if (sandbox_type == NACL_SANDBOX_TYPE_NACL_LOADER) {
531 *sandbox_profile_resource_id = IDR_NACL_SANDBOX_PROFILE; 536 *sandbox_profile_resource_id = IDR_NACL_SANDBOX_PROFILE;
532 return true; 537 return true;
533 } 538 }
534 return false; 539 return false;
535 } 540 }
536 #endif 541 #endif
OLDNEW
« no previous file with comments | « chrome/browser/extensions/api/web_request/web_request_api_helpers.cc ('k') | net/http/http_request_headers.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698