OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "ash/ash_switches.h" | 10 #include "ash/ash_switches.h" |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 #include "chromeos/audio/cras_audio_handler.h" | 89 #include "chromeos/audio/cras_audio_handler.h" |
90 #include "chromeos/cert_loader.h" | 90 #include "chromeos/cert_loader.h" |
91 #include "chromeos/chromeos_paths.h" | 91 #include "chromeos/chromeos_paths.h" |
92 #include "chromeos/chromeos_switches.h" | 92 #include "chromeos/chromeos_switches.h" |
93 #include "chromeos/cryptohome/async_method_caller.h" | 93 #include "chromeos/cryptohome/async_method_caller.h" |
94 #include "chromeos/cryptohome/homedir_methods.h" | 94 #include "chromeos/cryptohome/homedir_methods.h" |
95 #include "chromeos/cryptohome/system_salt_getter.h" | 95 #include "chromeos/cryptohome/system_salt_getter.h" |
96 #include "chromeos/dbus/dbus_thread_manager.h" | 96 #include "chromeos/dbus/dbus_thread_manager.h" |
97 #include "chromeos/dbus/power_policy_controller.h" | 97 #include "chromeos/dbus/power_policy_controller.h" |
98 #include "chromeos/dbus/session_manager_client.h" | 98 #include "chromeos/dbus/session_manager_client.h" |
| 99 #include "chromeos/dbus/shill_manager_client.h" |
99 #include "chromeos/disks/disk_mount_manager.h" | 100 #include "chromeos/disks/disk_mount_manager.h" |
100 #include "chromeos/ime/ime_keyboard.h" | 101 #include "chromeos/ime/ime_keyboard.h" |
101 #include "chromeos/ime/input_method_manager.h" | 102 #include "chromeos/ime/input_method_manager.h" |
102 #include "chromeos/login/login_state.h" | 103 #include "chromeos/login/login_state.h" |
103 #include "chromeos/network/network_change_notifier_chromeos.h" | 104 #include "chromeos/network/network_change_notifier_chromeos.h" |
104 #include "chromeos/network/network_change_notifier_factory_chromeos.h" | 105 #include "chromeos/network/network_change_notifier_factory_chromeos.h" |
105 #include "chromeos/network/network_handler.h" | 106 #include "chromeos/network/network_handler.h" |
106 #include "chromeos/system/statistics_provider.h" | 107 #include "chromeos/system/statistics_provider.h" |
107 #include "chromeos/tpm_token_loader.h" | 108 #include "chromeos/tpm_token_loader.h" |
| 109 #include "components/gcm_driver/default_gcm_app_handler.h" |
108 #include "components/metrics/metrics_service.h" | 110 #include "components/metrics/metrics_service.h" |
109 #include "content/public/browser/browser_thread.h" | 111 #include "content/public/browser/browser_thread.h" |
110 #include "content/public/browser/notification_service.h" | 112 #include "content/public/browser/notification_service.h" |
111 #include "content/public/browser/power_save_blocker.h" | 113 #include "content/public/browser/power_save_blocker.h" |
112 #include "content/public/common/main_function_params.h" | 114 #include "content/public/common/main_function_params.h" |
113 #include "grit/platform_locale_settings.h" | 115 #include "grit/platform_locale_settings.h" |
114 #include "media/audio/sounds/sounds_manager.h" | 116 #include "media/audio/sounds/sounds_manager.h" |
115 #include "net/base/network_change_notifier.h" | 117 #include "net/base/network_change_notifier.h" |
116 #include "net/url_request/url_request.h" | 118 #include "net/url_request/url_request.h" |
117 #include "net/url_request/url_request_context_getter.h" | 119 #include "net/url_request/url_request_context_getter.h" |
(...skipping 625 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
743 // amount of time for the other services to start up before we start | 745 // amount of time for the other services to start up before we start |
744 // adjusting the oom priority. | 746 // adjusting the oom priority. |
745 g_browser_process->platform_part()->oom_priority_manager()->Start(); | 747 g_browser_process->platform_part()->oom_priority_manager()->Start(); |
746 | 748 |
747 if (ui::ShouldDefaultToNaturalScroll()) { | 749 if (ui::ShouldDefaultToNaturalScroll()) { |
748 CommandLine::ForCurrentProcess()->AppendSwitch( | 750 CommandLine::ForCurrentProcess()->AppendSwitch( |
749 chromeos::switches::kNaturalScrollDefault); | 751 chromeos::switches::kNaturalScrollDefault); |
750 system::InputDeviceSettings::Get()->SetTapToClick(true); | 752 system::InputDeviceSettings::Get()->SetTapToClick(true); |
751 } | 753 } |
752 | 754 |
| 755 // Register GCM connection callbacks. |
| 756 gcm::DefaultGCMAppHandler::RegisterConnectionCallbacks( |
| 757 ChromeBrowserMainPartsChromeos::OnGCMConnected, |
| 758 ChromeBrowserMainPartsChromeos::OnGCMDisconnected); |
| 759 |
753 ChromeBrowserMainPartsLinux::PreBrowserStart(); | 760 ChromeBrowserMainPartsLinux::PreBrowserStart(); |
754 } | 761 } |
755 | 762 |
| 763 // static |
| 764 void ChromeBrowserMainPartsChromeos::GCMErrorCallback( |
| 765 const std::string &error_name, |
| 766 const std::string &error) { |
| 767 LOG(ERROR) << "GCM callback error " << error_name << ": " << error; |
| 768 } |
| 769 |
| 770 // static |
| 771 void ChromeBrowserMainPartsChromeos::OnGCMConnected( |
| 772 const net::IPEndPoint& ip_endpoint) { |
| 773 const std::string ip_endpoint_string = ip_endpoint.ToString(); |
| 774 chromeos::DBusThreadManager::Get()-> |
| 775 GetShillManagerClient()-> |
| 776 AddWakeOnPacketConnection( |
| 777 ip_endpoint_string, |
| 778 base::Bind(&base::DoNothing), |
| 779 base::Bind(&ChromeBrowserMainPartsChromeos::GCMErrorCallback)); |
| 780 } |
| 781 |
| 782 void ChromeBrowserMainPartsChromeos::OnGCMDisconnected() { |
| 783 } |
| 784 |
756 void ChromeBrowserMainPartsChromeos::PostBrowserStart() { | 785 void ChromeBrowserMainPartsChromeos::PostBrowserStart() { |
757 // These are dependent on the ash::Shell singleton already having been | 786 // These are dependent on the ash::Shell singleton already having been |
758 // initialized. | 787 // initialized. |
759 power_button_observer_.reset(new PowerButtonObserver); | 788 power_button_observer_.reset(new PowerButtonObserver); |
760 data_promo_notification_.reset(new DataPromoNotification()), | 789 data_promo_notification_.reset(new DataPromoNotification()), |
761 keyboard_event_rewriters_->Init(); | 790 keyboard_event_rewriters_->Init(); |
762 | 791 |
763 ChromeBrowserMainPartsLinux::PostBrowserStart(); | 792 ChromeBrowserMainPartsLinux::PostBrowserStart(); |
764 } | 793 } |
765 | 794 |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
865 // Destroy DBus services immediately after threads are stopped. | 894 // Destroy DBus services immediately after threads are stopped. |
866 dbus_services_.reset(); | 895 dbus_services_.reset(); |
867 | 896 |
868 ChromeBrowserMainPartsLinux::PostDestroyThreads(); | 897 ChromeBrowserMainPartsLinux::PostDestroyThreads(); |
869 | 898 |
870 // Destroy DeviceSettingsService after g_browser_process. | 899 // Destroy DeviceSettingsService after g_browser_process. |
871 DeviceSettingsService::Shutdown(); | 900 DeviceSettingsService::Shutdown(); |
872 } | 901 } |
873 | 902 |
874 } // namespace chromeos | 903 } // namespace chromeos |
OLD | NEW |