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/chromeos/chrome_browser_main_chromeos.h" | 5 #include "chrome/browser/chromeos/chrome_browser_main_chromeos.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/callback.h" | 8 #include "base/callback.h" |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
| 11 #include "base/message_loop.h" | 11 #include "base/message_loop.h" |
| 12 #include "chrome/browser/chromeos/boot_times_loader.h" | 12 #include "chrome/browser/chromeos/boot_times_loader.h" |
| 13 #include "chrome/browser/chromeos/brightness_observer.h" | |
| 13 #include "chrome/browser/chromeos/cros/cros_library.h" | 14 #include "chrome/browser/chromeos/cros/cros_library.h" |
| 15 #include "chrome/browser/chromeos/cros/power_library.h" | |
| 14 #include "chrome/browser/chromeos/dbus/dbus_thread_manager.h" | 16 #include "chrome/browser/chromeos/dbus/dbus_thread_manager.h" |
| 15 #include "chrome/browser/chromeos/net/cros_network_change_notifier_factory.h" | 17 #include "chrome/browser/chromeos/net/cros_network_change_notifier_factory.h" |
| 16 #include "chrome/browser/chromeos/system/statistics_provider.h" | 18 #include "chrome/browser/chromeos/system/statistics_provider.h" |
| 17 #include "chrome/browser/defaults.h" | 19 #include "chrome/browser/defaults.h" |
| 18 #include "chrome/common/chrome_switches.h" | 20 #include "chrome/common/chrome_switches.h" |
| 19 #include "content/common/main_function_params.h" | 21 #include "content/common/main_function_params.h" |
| 20 #include "net/base/network_change_notifier.h" | 22 #include "net/base/network_change_notifier.h" |
| 21 | 23 |
| 22 #if defined(TOOLKIT_USES_GTK) | 24 #if defined(TOOLKIT_USES_GTK) |
| 23 #include <gtk/gtk.h> | 25 #include <gtk/gtk.h> |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 64 }; | 66 }; |
| 65 | 67 |
| 66 static base::LazyInstance<MessageLoopObserver> g_message_loop_observer( | 68 static base::LazyInstance<MessageLoopObserver> g_message_loop_observer( |
| 67 base::LINKER_INITIALIZED); | 69 base::LINKER_INITIALIZED); |
| 68 | 70 |
| 69 ChromeBrowserMainPartsChromeos::ChromeBrowserMainPartsChromeos( | 71 ChromeBrowserMainPartsChromeos::ChromeBrowserMainPartsChromeos( |
| 70 const MainFunctionParams& parameters) | 72 const MainFunctionParams& parameters) |
| 71 : ChromeBrowserMainPartsGtk(parameters) { | 73 : ChromeBrowserMainPartsGtk(parameters) { |
| 72 } | 74 } |
| 73 | 75 |
| 74 ChromeBrowserMainPartsChromeos::~ChromeBrowserMainPartsChromeos() { | 76 ChromeBrowserMainPartsChromeos::~ChromeBrowserMainPartsChromeos() { |
|
satorux1
2011/10/14 05:56:28
Just like http://codereview.chromium.org/8271010/,
Simon Que
2011/10/18 19:23:06
Done.
| |
| 75 chromeos::DBusThreadManager::Shutdown(); | 77 chromeos::DBusThreadManager::Shutdown(); |
| 76 | 78 |
| 77 if (!parameters().ui_task && chromeos::CrosLibrary::Get()) | 79 if (!parameters().ui_task && chromeos::CrosLibrary::Get()) |
| 78 chromeos::CrosLibrary::Shutdown(); | 80 chromeos::CrosLibrary::Shutdown(); |
| 79 | 81 |
| 80 // To be precise, logout (browser shutdown) is not yet done, but the | 82 // To be precise, logout (browser shutdown) is not yet done, but the |
| 81 // remaining work is negligible, hence we say LogoutDone here. | 83 // remaining work is negligible, hence we say LogoutDone here. |
| 82 chromeos::BootTimesLoader::Get()->AddLogoutTimeMarker("LogoutDone", | 84 chromeos::BootTimesLoader::Get()->AddLogoutTimeMarker("LogoutDone", |
| 83 false); | 85 false); |
| 84 chromeos::BootTimesLoader::Get()->WriteLogoutTimes(); | 86 chromeos::BootTimesLoader::Get()->WriteLogoutTimes(); |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 118 } | 120 } |
| 119 | 121 |
| 120 void ChromeBrowserMainPartsChromeos::PostMainMessageLoopStart() { | 122 void ChromeBrowserMainPartsChromeos::PostMainMessageLoopStart() { |
| 121 ChromeBrowserMainPartsPosix::PostMainMessageLoopStart(); | 123 ChromeBrowserMainPartsPosix::PostMainMessageLoopStart(); |
| 122 MessageLoopForUI* message_loop = MessageLoopForUI::current(); | 124 MessageLoopForUI* message_loop = MessageLoopForUI::current(); |
| 123 message_loop->AddObserver(g_message_loop_observer.Pointer()); | 125 message_loop->AddObserver(g_message_loop_observer.Pointer()); |
| 124 | 126 |
| 125 // Initialize DBusThreadManager for the browser. This must be done after | 127 // Initialize DBusThreadManager for the browser. This must be done after |
| 126 // the main message loop is started, as it uses the message loop. | 128 // the main message loop is started, as it uses the message loop. |
| 127 chromeos::DBusThreadManager::Initialize(); | 129 chromeos::DBusThreadManager::Initialize(); |
| 130 | |
| 131 // Initialize the brightness observer so that we'll display an onscreen | |
| 132 // indication of brightness changes during login. | |
| 133 static chromeos::BrightnessObserver* brightness_observer = | |
| 134 new chromeos::BrightnessObserver(); | |
| 135 chromeos::DBusThreadManager::Get()->power_manager_client()->AddObserver( | |
| 136 brightness_observer); | |
|
satorux1
2011/10/14 05:56:28
Sorry, I just submitted a patch to clean this up:
Simon Que
2011/10/18 19:23:06
Done.
| |
| 137 | |
| 138 // Probe for power supply status. | |
| 139 static chromeos::PowerManagerClient::Observer* power_lib = | |
|
satorux1
2011/10/14 05:56:28
Please remove static.
Simon Que
2011/10/18 19:23:06
Done.
| |
| 140 chromeos::CrosLibrary::Get()->GetPowerLibrary(); | |
| 141 chromeos::DBusThreadManager::Get()->power_manager_client()-> | |
| 142 AddObserver(power_lib); | |
| 128 } | 143 } |
| OLD | NEW |