Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1224)

Side by Side Diff: chrome/browser/chromeos/chrome_browser_main_chromeos.cc

Issue 589723003: Enable dark_resume_always workaround if the wake-on-packets flag is set (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 #if defined(USE_X11) 125 #if defined(USE_X11)
126 #include "chrome/browser/chromeos/device_uma.h" 126 #include "chrome/browser/chromeos/device_uma.h"
127 #include "chrome/browser/chromeos/events/system_key_event_listener.h" 127 #include "chrome/browser/chromeos/events/system_key_event_listener.h"
128 #include "chrome/browser/chromeos/events/xinput_hierarchy_changed_event_listener .h" 128 #include "chrome/browser/chromeos/events/xinput_hierarchy_changed_event_listener .h"
129 #endif 129 #endif
130 130
131 namespace chromeos { 131 namespace chromeos {
132 132
133 namespace { 133 namespace {
134 134
135 // TODO(chirantan): These are used by a temporary workaround for lucid sleep and
136 // should be removed once the proper implementation is ready (crbug.com/414949).
137 const char kDarkResumeAlwaysFile[] = "/sys/power/dark_resume_always";
138 const char kEnableDarkResumeAlways[] = "1";
139
135 void ChromeOSVersionCallback(const std::string& version) { 140 void ChromeOSVersionCallback(const std::string& version) {
136 base::SetLinuxDistro(std::string("CrOS ") + version); 141 base::SetLinuxDistro(std::string("CrOS ") + version);
137 } 142 }
138 143
139 bool ShouldAutoLaunchKioskApp(const base::CommandLine& command_line) { 144 bool ShouldAutoLaunchKioskApp(const base::CommandLine& command_line) {
140 KioskAppManager* app_manager = KioskAppManager::Get(); 145 KioskAppManager* app_manager = KioskAppManager::Get();
141 return command_line.HasSwitch(switches::kLoginManager) && 146 return command_line.HasSwitch(switches::kLoginManager) &&
142 !command_line.HasSwitch(switches::kForceLoginManagerInTests) && 147 !command_line.HasSwitch(switches::kForceLoginManagerInTests) &&
143 app_manager->IsAutoLaunchEnabled() && 148 app_manager->IsAutoLaunchEnabled() &&
144 KioskAppLaunchError::Get() == KioskAppLaunchError::NONE; 149 KioskAppLaunchError::Get() == KioskAppLaunchError::NONE;
(...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after
559 retail_mode_power_save_blocker_ = content::PowerSaveBlocker::Create( 564 retail_mode_power_save_blocker_ = content::PowerSaveBlocker::Create(
560 content::PowerSaveBlocker::kPowerSaveBlockPreventDisplaySleep, 565 content::PowerSaveBlocker::kPowerSaveBlockPreventDisplaySleep,
561 "Retail mode"); 566 "Retail mode");
562 } 567 }
563 568
564 peripheral_battery_observer_.reset(new PeripheralBatteryObserver()); 569 peripheral_battery_observer_.reset(new PeripheralBatteryObserver());
565 570
566 renderer_freezer_.reset( 571 renderer_freezer_.reset(
567 new RendererFreezer(scoped_ptr<RendererFreezer::Delegate>( 572 new RendererFreezer(scoped_ptr<RendererFreezer::Delegate>(
568 new FreezerCgroupProcessManager()))); 573 new FreezerCgroupProcessManager())));
569 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kWakeOnPackets)) 574 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kWakeOnPackets)) {
570 light_bar_.reset(new LightBar()); 575 light_bar_.reset(new LightBar());
571 576
577 // Until the kernel can properly detect the wakeup source, we need to use a
578 // hack to tell the kernel to always enter dark resume. Chrome can then
579 // detect any user activity and have the power manager transition out of
580 // dark resume into regular resume. We don't care if the write succeeds or
581 // not because most devices will not have this file.
582 //
583 // TODO(chirantan): Remove this once we can properly detect the wakeup
584 // source (crbug.com/414949).
585 base::WriteFile(base::FilePath(kDarkResumeAlwaysFile),
Daniel Erat 2014/09/21 14:49:31 can you put this somewhere else instead of chrome_
586 kEnableDarkResumeAlways,
587 strlen(kEnableDarkResumeAlways));
588 }
589
572 g_browser_process->platform_part()->InitializeAutomaticRebootManager(); 590 g_browser_process->platform_part()->InitializeAutomaticRebootManager();
573 591
574 // This observer cannot be created earlier because it requires the shell to be 592 // This observer cannot be created earlier because it requires the shell to be
575 // available. 593 // available.
576 idle_action_warning_observer_.reset(new IdleActionWarningObserver()); 594 idle_action_warning_observer_.reset(new IdleActionWarningObserver());
577 595
578 ChromeBrowserMainPartsLinux::PostProfileInit(); 596 ChromeBrowserMainPartsLinux::PostProfileInit();
579 } 597 }
580 598
581 void ChromeBrowserMainPartsChromeos::PreBrowserStart() { 599 void ChromeBrowserMainPartsChromeos::PreBrowserStart() {
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
766 // Destroy DBus services immediately after threads are stopped. 784 // Destroy DBus services immediately after threads are stopped.
767 dbus_services_.reset(); 785 dbus_services_.reset();
768 786
769 ChromeBrowserMainPartsLinux::PostDestroyThreads(); 787 ChromeBrowserMainPartsLinux::PostDestroyThreads();
770 788
771 // Destroy DeviceSettingsService after g_browser_process. 789 // Destroy DeviceSettingsService after g_browser_process.
772 DeviceSettingsService::Shutdown(); 790 DeviceSettingsService::Shutdown();
773 } 791 }
774 792
775 } // namespace chromeos 793 } // namespace chromeos
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698