Chromium Code Reviews| 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/browser/browser_main.h" | 5 #include "chrome/browser/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 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 121 #if defined(OS_POSIX) && !defined(OS_MACOSX) | 121 #if defined(OS_POSIX) && !defined(OS_MACOSX) |
| 122 #include <dbus/dbus-glib.h> | 122 #include <dbus/dbus-glib.h> |
| 123 #include "chrome/browser/browser_main_gtk.h" | 123 #include "chrome/browser/browser_main_gtk.h" |
| 124 #include "chrome/browser/ui/gtk/gtk_util.h" | 124 #include "chrome/browser/ui/gtk/gtk_util.h" |
| 125 #endif | 125 #endif |
| 126 | 126 |
| 127 #if defined(OS_CHROMEOS) | 127 #if defined(OS_CHROMEOS) |
| 128 #include "chrome/browser/chromeos/boot_times_loader.h" | 128 #include "chrome/browser/chromeos/boot_times_loader.h" |
| 129 #include "chrome/browser/chromeos/brightness_observer.h" | 129 #include "chrome/browser/chromeos/brightness_observer.h" |
| 130 #include "chrome/browser/chromeos/system_key_event_listener.h" | 130 #include "chrome/browser/chromeos/system_key_event_listener.h" |
| 131 #include "chrome/browser/chromeos/webproxy_task.h" | |
| 131 #include "chrome/browser/oom_priority_manager.h" | 132 #include "chrome/browser/oom_priority_manager.h" |
| 132 #endif | 133 #endif |
| 133 | 134 |
| 134 // TODO(port): several win-only methods have been pulled out of this, but | 135 // TODO(port): several win-only methods have been pulled out of this, but |
| 135 // BrowserMain() as a whole needs to be broken apart so that it's usable by | 136 // BrowserMain() as a whole needs to be broken apart so that it's usable by |
| 136 // other platforms. For now, it's just a stub. This is a serious work in | 137 // other platforms. For now, it's just a stub. This is a serious work in |
| 137 // progress and should not be taken as an indication of a real refactoring. | 138 // progress and should not be taken as an indication of a real refactoring. |
| 138 | 139 |
| 139 #if defined(OS_WIN) | 140 #if defined(OS_WIN) |
| 140 #include <commctrl.h> | 141 #include <commctrl.h> |
| (...skipping 493 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 634 | 635 |
| 635 // Creates key child threads. We need to do this explicitly since | 636 // Creates key child threads. We need to do this explicitly since |
| 636 // BrowserThread::PostTask silently deletes a posted task if the target message | 637 // BrowserThread::PostTask silently deletes a posted task if the target message |
| 637 // loop isn't created. | 638 // loop isn't created. |
| 638 void CreateChildThreads(BrowserProcessImpl* process) { | 639 void CreateChildThreads(BrowserProcessImpl* process) { |
| 639 process->db_thread(); | 640 process->db_thread(); |
| 640 process->file_thread(); | 641 process->file_thread(); |
| 641 process->process_launcher_thread(); | 642 process->process_launcher_thread(); |
| 642 process->cache_thread(); | 643 process->cache_thread(); |
| 643 process->io_thread(); | 644 process->io_thread(); |
| 645 #if defined(OS_CHROMEOS) | |
| 646 process->webproxy_thread(); | |
| 647 #endif | |
| 644 // Create watchdog thread after creating all other threads because it will | 648 // Create watchdog thread after creating all other threads because it will |
| 645 // watch the other threads and they must be running. | 649 // watch the other threads and they must be running. |
| 646 process->watchdog_thread(); | 650 process->watchdog_thread(); |
| 647 } | 651 } |
| 648 | 652 |
| 649 // Returns the new local state object, guaranteed non-NULL. | 653 // Returns the new local state object, guaranteed non-NULL. |
| 650 PrefService* InitializeLocalState(const CommandLine& parsed_command_line, | 654 PrefService* InitializeLocalState(const CommandLine& parsed_command_line, |
| 651 bool is_first_run) { | 655 bool is_first_run) { |
| 652 FilePath local_state_path; | 656 FilePath local_state_path; |
| 653 PathService::Get(chrome::FILE_LOCAL_STATE, &local_state_path); | 657 PathService::Get(chrome::FILE_LOCAL_STATE, &local_state_path); |
| (...skipping 809 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1463 | 1467 |
| 1464 PrefService* user_prefs = profile->GetPrefs(); | 1468 PrefService* user_prefs = profile->GetPrefs(); |
| 1465 DCHECK(user_prefs); | 1469 DCHECK(user_prefs); |
| 1466 | 1470 |
| 1467 // Tests should be able to tune login manager before showing it. | 1471 // Tests should be able to tune login manager before showing it. |
| 1468 // Thus only show login manager in normal (non-testing) mode. | 1472 // Thus only show login manager in normal (non-testing) mode. |
| 1469 if (!parameters.ui_task) { | 1473 if (!parameters.ui_task) { |
| 1470 OptionallyRunChromeOSLoginManager(parsed_command_line); | 1474 OptionallyRunChromeOSLoginManager(parsed_command_line); |
| 1471 } | 1475 } |
| 1472 | 1476 |
| 1477 #if defined(OS_CHROMEOS) | |
| 1478 // We delay launching websocket to TCP proxy because we do not want to | |
|
zel
2011/04/07 16:54:12
can we make this launch when API is being used for
Denis Lagno
2011/04/07 17:48:22
it is possible but in this case I need to either m
Denis Lagno
2011/04/11 23:21:27
launching webproxy is on demand now.
Idle webproxy
| |
| 1479 // increase startup time accidentally. | |
| 1480 const int kWebProxyDelayMs = 5000; | |
| 1481 // TODO(dilmah): remove webproxy thread, instead implement the same | |
| 1482 // functionality via hooks into websocket layer. | |
| 1483 g_browser_process->webproxy_thread()->message_loop()->PostDelayedTask( | |
| 1484 FROM_HERE, new chromeos::WebproxyTask(), kWebProxyDelayMs); | |
| 1485 #endif | |
| 1486 | |
| 1473 #if !defined(OS_MACOSX) | 1487 #if !defined(OS_MACOSX) |
| 1474 // Importing other browser settings is done in a browser-like process | 1488 // Importing other browser settings is done in a browser-like process |
| 1475 // that exits when this task has finished. | 1489 // that exits when this task has finished. |
| 1476 // TODO(port): Port the Mac's IPC-based implementation to other platforms to | 1490 // TODO(port): Port the Mac's IPC-based implementation to other platforms to |
| 1477 // replace this implementation. http://crbug.com/22142 | 1491 // replace this implementation. http://crbug.com/22142 |
| 1478 if (parsed_command_line.HasSwitch(switches::kImport) || | 1492 if (parsed_command_line.HasSwitch(switches::kImport) || |
| 1479 parsed_command_line.HasSwitch(switches::kImportFromFile)) { | 1493 parsed_command_line.HasSwitch(switches::kImportFromFile)) { |
| 1480 return FirstRun::ImportNow(profile, parsed_command_line); | 1494 return FirstRun::ImportNow(profile, parsed_command_line); |
| 1481 } | 1495 } |
| 1482 #endif | 1496 #endif |
| (...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1875 #if defined(OS_CHROMEOS) | 1889 #if defined(OS_CHROMEOS) |
| 1876 // To be precise, logout (browser shutdown) is not yet done, but the | 1890 // To be precise, logout (browser shutdown) is not yet done, but the |
| 1877 // remaining work is negligible, hence we say LogoutDone here. | 1891 // remaining work is negligible, hence we say LogoutDone here. |
| 1878 chromeos::BootTimesLoader::Get()->AddLogoutTimeMarker("LogoutDone", | 1892 chromeos::BootTimesLoader::Get()->AddLogoutTimeMarker("LogoutDone", |
| 1879 false); | 1893 false); |
| 1880 chromeos::BootTimesLoader::Get()->WriteLogoutTimes(); | 1894 chromeos::BootTimesLoader::Get()->WriteLogoutTimes(); |
| 1881 #endif | 1895 #endif |
| 1882 TRACE_EVENT_END("BrowserMain", 0, 0); | 1896 TRACE_EVENT_END("BrowserMain", 0, 0); |
| 1883 return result_code; | 1897 return result_code; |
| 1884 } | 1898 } |
| OLD | NEW |