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 #if defined(TOOLKIT_GTK) | 7 #if defined(TOOLKIT_GTK) |
8 #include <gtk/gtk.h> | 8 #include <gtk/gtk.h> |
9 #endif | 9 #endif |
10 | 10 |
(...skipping 690 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
701 // deletions. We need this new instance because, the old instance created | 701 // deletions. We need this new instance because, the old instance created |
702 // in ChromeMain() got destructed when the function returned. | 702 // in ChromeMain() got destructed when the function returned. |
703 base::AtExitManager exit_manager; | 703 base::AtExitManager exit_manager; |
704 upgrade_util::RelaunchChromeBrowserWithNewCommandLineIfNeeded(); | 704 upgrade_util::RelaunchChromeBrowserWithNewCommandLineIfNeeded(); |
705 } | 705 } |
706 #endif | 706 #endif |
707 | 707 |
708 // content::BrowserMainParts implementation ------------------------------------ | 708 // content::BrowserMainParts implementation ------------------------------------ |
709 | 709 |
710 void ChromeBrowserMainParts::PreEarlyInitialization() { | 710 void ChromeBrowserMainParts::PreEarlyInitialization() { |
| 711 #if defined(USE_X11) |
| 712 SetBrowserX11ErrorHandlersPreEarlyInitialization(); |
| 713 #endif |
711 TRACE_EVENT0("startup", "ChromeBrowserMainParts::PreEarlyInitialization"); | 714 TRACE_EVENT0("startup", "ChromeBrowserMainParts::PreEarlyInitialization"); |
712 for (size_t i = 0; i < chrome_extra_parts_.size(); ++i) | 715 for (size_t i = 0; i < chrome_extra_parts_.size(); ++i) |
713 chrome_extra_parts_[i]->PreEarlyInitialization(); | 716 chrome_extra_parts_[i]->PreEarlyInitialization(); |
714 } | 717 } |
715 | 718 |
716 void ChromeBrowserMainParts::PostEarlyInitialization() { | 719 void ChromeBrowserMainParts::PostEarlyInitialization() { |
717 TRACE_EVENT0("startup", "ChromeBrowserMainParts::PostEarlyInitialization"); | 720 TRACE_EVENT0("startup", "ChromeBrowserMainParts::PostEarlyInitialization"); |
718 for (size_t i = 0; i < chrome_extra_parts_.size(); ++i) | 721 for (size_t i = 0; i < chrome_extra_parts_.size(); ++i) |
719 chrome_extra_parts_[i]->PostEarlyInitialization(); | 722 chrome_extra_parts_[i]->PostEarlyInitialization(); |
720 } | 723 } |
721 | 724 |
722 void ChromeBrowserMainParts::ToolkitInitialized() { | 725 void ChromeBrowserMainParts::ToolkitInitialized() { |
723 TRACE_EVENT0("startup", "ChromeBrowserMainParts::ToolkitInitialized"); | 726 TRACE_EVENT0("startup", "ChromeBrowserMainParts::ToolkitInitialized"); |
724 for (size_t i = 0; i < chrome_extra_parts_.size(); ++i) | 727 for (size_t i = 0; i < chrome_extra_parts_.size(); ++i) |
725 chrome_extra_parts_[i]->ToolkitInitialized(); | 728 chrome_extra_parts_[i]->ToolkitInitialized(); |
726 } | 729 } |
727 | 730 |
728 void ChromeBrowserMainParts::PreMainMessageLoopStart() { | 731 void ChromeBrowserMainParts::PreMainMessageLoopStart() { |
729 TRACE_EVENT0("startup", "ChromeBrowserMainParts::PreMainMessageLoopStart"); | 732 TRACE_EVENT0("startup", "ChromeBrowserMainParts::PreMainMessageLoopStart"); |
730 for (size_t i = 0; i < chrome_extra_parts_.size(); ++i) | 733 for (size_t i = 0; i < chrome_extra_parts_.size(); ++i) |
731 chrome_extra_parts_[i]->PreMainMessageLoopStart(); | 734 chrome_extra_parts_[i]->PreMainMessageLoopStart(); |
732 } | 735 } |
733 | 736 |
734 void ChromeBrowserMainParts::PostMainMessageLoopStart() { | 737 void ChromeBrowserMainParts::PostMainMessageLoopStart() { |
735 TRACE_EVENT0("startup", "ChromeBrowserMainParts::PostMainMessageLoopStart"); | 738 TRACE_EVENT0("startup", "ChromeBrowserMainParts::PostMainMessageLoopStart"); |
736 for (size_t i = 0; i < chrome_extra_parts_.size(); ++i) | 739 for (size_t i = 0; i < chrome_extra_parts_.size(); ++i) |
737 chrome_extra_parts_[i]->PostMainMessageLoopStart(); | 740 chrome_extra_parts_[i]->PostMainMessageLoopStart(); |
| 741 #if defined(USE_X11) |
| 742 SetBrowserX11ErrorHandlersPostMainMessageLoopStart(); |
| 743 #endif |
738 } | 744 } |
739 | 745 |
740 int ChromeBrowserMainParts::PreCreateThreads() { | 746 int ChromeBrowserMainParts::PreCreateThreads() { |
741 TRACE_EVENT0("startup", "ChromeBrowserMainParts::PreCreateThreads"); | 747 TRACE_EVENT0("startup", "ChromeBrowserMainParts::PreCreateThreads"); |
742 result_code_ = PreCreateThreadsImpl(); | 748 result_code_ = PreCreateThreadsImpl(); |
743 // These members must be initialized before returning from this function. | 749 // These members must be initialized before returning from this function. |
744 DCHECK(master_prefs_.get()); | 750 DCHECK(master_prefs_.get()); |
745 #if !defined(OS_ANDROID) | 751 #if !defined(OS_ANDROID) |
746 DCHECK(browser_creator_.get()); | 752 DCHECK(browser_creator_.get()); |
747 #endif | 753 #endif |
(...skipping 446 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1194 "opening a new window in the existing process. Aborting " | 1200 "opening a new window in the existing process. Aborting " |
1195 "now to avoid profile corruption."; | 1201 "now to avoid profile corruption."; |
1196 return chrome::RESULT_CODE_PROFILE_IN_USE; | 1202 return chrome::RESULT_CODE_PROFILE_IN_USE; |
1197 | 1203 |
1198 default: | 1204 default: |
1199 NOTREACHED(); | 1205 NOTREACHED(); |
1200 } | 1206 } |
1201 } | 1207 } |
1202 #endif // !defined(OS_ANDROID) | 1208 #endif // !defined(OS_ANDROID) |
1203 | 1209 |
1204 #if defined(USE_X11) | |
1205 SetBrowserX11ErrorHandlers(); | |
1206 #endif | |
1207 | |
1208 // Desktop construction occurs here, (required before profile creation). | 1210 // Desktop construction occurs here, (required before profile creation). |
1209 PreProfileInit(); | 1211 PreProfileInit(); |
1210 | 1212 |
1211 std::string try_chrome = | 1213 std::string try_chrome = |
1212 parsed_command_line().GetSwitchValueASCII(switches::kTryChromeAgain); | 1214 parsed_command_line().GetSwitchValueASCII(switches::kTryChromeAgain); |
1213 if (!try_chrome.empty()) { | 1215 if (!try_chrome.empty()) { |
1214 #if defined(OS_WIN) | 1216 #if defined(OS_WIN) |
1215 // Setup.exe has determined that we need to run a retention experiment | 1217 // Setup.exe has determined that we need to run a retention experiment |
1216 // and has lauched chrome to show the experiment UI. It is guaranteed that | 1218 // and has lauched chrome to show the experiment UI. It is guaranteed that |
1217 // no other Chrome is currently running as the process singleton was | 1219 // no other Chrome is currently running as the process singleton was |
(...skipping 553 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1771 if (base::win::GetVersion() <= base::win::VERSION_XP) | 1773 if (base::win::GetVersion() <= base::win::VERSION_XP) |
1772 uma_name += "_XP"; | 1774 uma_name += "_XP"; |
1773 | 1775 |
1774 uma_name += "_PreRead_"; | 1776 uma_name += "_PreRead_"; |
1775 uma_name += pre_read_percentage; | 1777 uma_name += pre_read_percentage; |
1776 AddPreReadHistogramTime(uma_name.c_str(), time); | 1778 AddPreReadHistogramTime(uma_name.c_str(), time); |
1777 } | 1779 } |
1778 #endif | 1780 #endif |
1779 #endif | 1781 #endif |
1780 } | 1782 } |
OLD | NEW |