OLD | NEW |
1 // Copyright (c) 2011 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/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" |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 #include "net/base/network_change_notifier.h" | 55 #include "net/base/network_change_notifier.h" |
56 #include "net/url_request/url_request.h" | 56 #include "net/url_request/url_request.h" |
57 #include "ui/base/l10n/l10n_util.h" | 57 #include "ui/base/l10n/l10n_util.h" |
58 | 58 |
59 #if defined(TOOLKIT_USES_GTK) | 59 #if defined(TOOLKIT_USES_GTK) |
60 #include <gtk/gtk.h> | 60 #include <gtk/gtk.h> |
61 #endif | 61 #endif |
62 | 62 |
63 #if defined(USE_AURA) | 63 #if defined(USE_AURA) |
64 #include "chrome/browser/chromeos/legacy_window_manager/initial_browser_window_o
bserver.h" | 64 #include "chrome/browser/chromeos/legacy_window_manager/initial_browser_window_o
bserver.h" |
| 65 #include "chrome/browser/chromeos/power/power_button_controller_delegate_chromeo
s.h" |
| 66 #include "chrome/browser/chromeos/power/power_button_observer.h" |
65 #endif | 67 #endif |
66 | 68 |
67 class MessageLoopObserver : public MessageLoopForUI::Observer { | 69 class MessageLoopObserver : public MessageLoopForUI::Observer { |
68 #if defined(USE_AURA) | 70 #if defined(USE_AURA) |
69 virtual base::EventStatus WillProcessEvent( | 71 virtual base::EventStatus WillProcessEvent( |
70 const base::NativeEvent& event) OVERRIDE { | 72 const base::NativeEvent& event) OVERRIDE { |
71 return base::EVENT_CONTINUE; | 73 return base::EVENT_CONTINUE; |
72 } | 74 } |
73 | 75 |
74 virtual void DidProcessEvent( | 76 virtual void DidProcessEvent( |
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
388 // Initialize the Chrome OS bluetooth subsystem. | 390 // Initialize the Chrome OS bluetooth subsystem. |
389 // We defer this to PreMainMessageLoopRun because we don't want to check the | 391 // We defer this to PreMainMessageLoopRun because we don't want to check the |
390 // parsed command line until after about_flags::ConvertFlagsToSwitches has | 392 // parsed command line until after about_flags::ConvertFlagsToSwitches has |
391 // been called. | 393 // been called. |
392 // TODO(vlaviano): Move this back to PostMainMessageLoopStart when we remove | 394 // TODO(vlaviano): Move this back to PostMainMessageLoopStart when we remove |
393 // the --enable-bluetooth flag. | 395 // the --enable-bluetooth flag. |
394 if (parsed_command_line().HasSwitch(switches::kEnableBluetooth)) { | 396 if (parsed_command_line().HasSwitch(switches::kEnableBluetooth)) { |
395 chromeos::BluetoothManager::Initialize(); | 397 chromeos::BluetoothManager::Initialize(); |
396 } | 398 } |
397 | 399 |
| 400 #if defined(USE_AURA) |
| 401 // This is dependent on the ash::Shell singleton already having been |
| 402 // initialized. |
| 403 power_button_observer_.reset(new chromeos::PowerButtonObserver); |
| 404 chromeos::DBusThreadManager::Get()->GetPowerManagerClient()->AddObserver( |
| 405 power_button_observer_.get()); |
| 406 #endif |
| 407 |
398 ChromeBrowserMainPartsLinux::PostBrowserStart(); | 408 ChromeBrowserMainPartsLinux::PostBrowserStart(); |
399 } | 409 } |
400 | 410 |
401 void ChromeBrowserMainPartsChromeos::PostMainMessageLoopStart() { | 411 void ChromeBrowserMainPartsChromeos::PostMainMessageLoopStart() { |
402 MessageLoopForUI* message_loop = MessageLoopForUI::current(); | 412 MessageLoopForUI* message_loop = MessageLoopForUI::current(); |
403 message_loop->AddObserver(g_message_loop_observer.Pointer()); | 413 message_loop->AddObserver(g_message_loop_observer.Pointer()); |
404 | 414 |
405 // Initialize DBusThreadManager for the browser. This must be done after | 415 // Initialize DBusThreadManager for the browser. This must be done after |
406 // the main message loop is started, as it uses the message loop. | 416 // the main message loop is started, as it uses the message loop. |
407 chromeos::DBusThreadManager::Initialize(); | 417 chromeos::DBusThreadManager::Initialize(); |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
491 // Singletons are finally destroyed in AtExitManager. | 501 // Singletons are finally destroyed in AtExitManager. |
492 chromeos::XInputHierarchyChangedEventListener::GetInstance()->Stop(); | 502 chromeos::XInputHierarchyChangedEventListener::GetInstance()->Stop(); |
493 | 503 |
494 // chromeos::SystemKeyEventListener::Shutdown() is always safe to call, | 504 // chromeos::SystemKeyEventListener::Shutdown() is always safe to call, |
495 // even if Initialize() wasn't called. | 505 // even if Initialize() wasn't called. |
496 chromeos::SystemKeyEventListener::Shutdown(); | 506 chromeos::SystemKeyEventListener::Shutdown(); |
497 chromeos::AudioHandler::Shutdown(); | 507 chromeos::AudioHandler::Shutdown(); |
498 | 508 |
499 ChromeBrowserMainPartsLinux::PostMainMessageLoopRun(); | 509 ChromeBrowserMainPartsLinux::PostMainMessageLoopRun(); |
500 } | 510 } |
OLD | NEW |