OLD | NEW |
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/browser/chrome_browser_main.h" | 5 #include "chrome/browser/chrome_browser_main.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 536 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
547 namespace chrome_browser { | 547 namespace chrome_browser { |
548 // This error message is not localized because we failed to load the | 548 // This error message is not localized because we failed to load the |
549 // localization data files. | 549 // localization data files. |
550 const char kMissingLocaleDataTitle[] = "Missing File Error"; | 550 const char kMissingLocaleDataTitle[] = "Missing File Error"; |
551 const char kMissingLocaleDataMessage[] = | 551 const char kMissingLocaleDataMessage[] = |
552 "Unable to find locale data files. Please reinstall."; | 552 "Unable to find locale data files. Please reinstall."; |
553 } // namespace chrome_browser | 553 } // namespace chrome_browser |
554 | 554 |
555 // BrowserMainParts ------------------------------------------------------------ | 555 // BrowserMainParts ------------------------------------------------------------ |
556 | 556 |
| 557 // static |
| 558 bool ChromeBrowserMainParts::disable_enforcing_cookie_policies_for_tests_ = |
| 559 false; |
| 560 |
557 ChromeBrowserMainParts::ChromeBrowserMainParts( | 561 ChromeBrowserMainParts::ChromeBrowserMainParts( |
558 const content::MainFunctionParams& parameters) | 562 const content::MainFunctionParams& parameters) |
559 : parameters_(parameters), | 563 : parameters_(parameters), |
560 parsed_command_line_(parameters.command_line), | 564 parsed_command_line_(parameters.command_line), |
561 result_code_(content::RESULT_CODE_NORMAL_EXIT), | 565 result_code_(content::RESULT_CODE_NORMAL_EXIT), |
562 startup_watcher_(new StartupTimeBomb()), | 566 startup_watcher_(new StartupTimeBomb()), |
563 shutdown_watcher_(new ShutdownWatcherHelper()), | 567 shutdown_watcher_(new ShutdownWatcherHelper()), |
564 record_search_engine_(false), | 568 record_search_engine_(false), |
565 translate_manager_(NULL), | 569 translate_manager_(NULL), |
566 profile_(NULL), | 570 profile_(NULL), |
567 run_message_loop_(true), | 571 run_message_loop_(true), |
568 notify_result_(ProcessSingleton::PROCESS_NONE), | 572 notify_result_(ProcessSingleton::PROCESS_NONE), |
569 is_first_run_(false), | 573 is_first_run_(false), |
570 first_run_ui_bypass_(false), | 574 first_run_ui_bypass_(false), |
571 local_state_(NULL), | 575 local_state_(NULL), |
572 restart_last_session_(false) { | 576 restart_last_session_(false) { |
573 // If we're running tests (ui_task is non-null). | 577 // If we're running tests (ui_task is non-null). |
574 if (parameters.ui_task) | 578 if (parameters.ui_task) |
575 browser_defaults::enable_help_app = false; | 579 browser_defaults::enable_help_app = false; |
| 580 |
| 581 // Chrome disallows cookies by default. All code paths that want to use |
| 582 // cookies need to go through one of Chrome's URLRequestContexts which have |
| 583 // a ChromeNetworkDelegate attached that selectively allows cookies again. |
| 584 if (!disable_enforcing_cookie_policies_for_tests_) |
| 585 net::URLRequest::SetDefaultCookiePolicyToBlock(); |
576 } | 586 } |
577 | 587 |
578 ChromeBrowserMainParts::~ChromeBrowserMainParts() { | 588 ChromeBrowserMainParts::~ChromeBrowserMainParts() { |
579 for (int i = static_cast<int>(chrome_extra_parts_.size())-1; i >= 0; --i) | 589 for (int i = static_cast<int>(chrome_extra_parts_.size())-1; i >= 0; --i) |
580 delete chrome_extra_parts_[i]; | 590 delete chrome_extra_parts_[i]; |
581 chrome_extra_parts_.clear(); | 591 chrome_extra_parts_.clear(); |
582 } | 592 } |
583 | 593 |
584 // This will be called after the command-line has been mutated by about:flags | 594 // This will be called after the command-line has been mutated by about:flags |
585 void ChromeBrowserMainParts::SetupMetricsAndFieldTrials() { | 595 void ChromeBrowserMainParts::SetupMetricsAndFieldTrials() { |
(...skipping 1426 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2012 if (base::win::GetVersion() <= base::win::VERSION_XP) | 2022 if (base::win::GetVersion() <= base::win::VERSION_XP) |
2013 uma_name += "_XP"; | 2023 uma_name += "_XP"; |
2014 | 2024 |
2015 uma_name += "_PreRead_"; | 2025 uma_name += "_PreRead_"; |
2016 uma_name += pre_read_percentage; | 2026 uma_name += pre_read_percentage; |
2017 AddPreReadHistogramTime(uma_name.c_str(), time); | 2027 AddPreReadHistogramTime(uma_name.c_str(), time); |
2018 } | 2028 } |
2019 #endif | 2029 #endif |
2020 #endif | 2030 #endif |
2021 } | 2031 } |
OLD | NEW |