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

Side by Side Diff: chrome/browser/chromeos/file_manager/mounted_disk_monitor.cc

Issue 240343004: chromeos: Update IdleActionImminent and SuspendDone handling (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: merge Created 6 years, 8 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 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/file_manager/mounted_disk_monitor.h" 5 #include "chrome/browser/chromeos/file_manager/mounted_disk_monitor.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/location.h" 8 #include "base/location.h"
9 #include "base/message_loop/message_loop_proxy.h" 9 #include "base/message_loop/message_loop_proxy.h"
10 #include "chromeos/dbus/power_manager_client.h" 10 #include "chromeos/dbus/power_manager_client.h"
(...skipping 26 matching lines...) Expand all
37 } 37 }
38 38
39 MountedDiskMonitor::~MountedDiskMonitor() { 39 MountedDiskMonitor::~MountedDiskMonitor() {
40 disk_mount_manager_->RemoveObserver(this); 40 disk_mount_manager_->RemoveObserver(this);
41 power_manager_client_->RemoveObserver(this); 41 power_manager_client_->RemoveObserver(this);
42 } 42 }
43 43
44 void MountedDiskMonitor::SuspendImminent() { 44 void MountedDiskMonitor::SuspendImminent() {
45 // Flip the resuming flag while suspending, so it is possible to detect 45 // Flip the resuming flag while suspending, so it is possible to detect
46 // resuming as soon as possible after the lid is open. Note, that mount 46 // resuming as soon as possible after the lid is open. Note, that mount
47 // events may occur before the SystemResumed method is called. 47 // events may occur before the SuspendDone method is called.
48 is_resuming_ = true; 48 is_resuming_ = true;
49 weak_factory_.InvalidateWeakPtrs(); 49 weak_factory_.InvalidateWeakPtrs();
50 } 50 }
51 51
52 void MountedDiskMonitor::SystemResumed( 52 void MountedDiskMonitor::SuspendDone(
53 const base::TimeDelta& sleep_duration) { 53 const base::TimeDelta& sleep_duration) {
54 // Undo any previous resets. Release the resuming flag after a fixed timeout. 54 // Undo any previous resets. Release the resuming flag after a fixed timeout.
55 weak_factory_.InvalidateWeakPtrs(); 55 weak_factory_.InvalidateWeakPtrs();
56 base::MessageLoopProxy::current()->PostDelayedTask( 56 base::MessageLoopProxy::current()->PostDelayedTask(
57 FROM_HERE, 57 FROM_HERE,
58 base::Bind(&MountedDiskMonitor::Reset, 58 base::Bind(&MountedDiskMonitor::Reset,
59 weak_factory_.GetWeakPtr()), 59 weak_factory_.GetWeakPtr()),
60 resuming_time_span_); 60 resuming_time_span_);
61 } 61 }
62 62
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 chromeos::FormatError error_code, 110 chromeos::FormatError error_code,
111 const std::string& device_path) { 111 const std::string& device_path) {
112 } 112 }
113 113
114 void MountedDiskMonitor::Reset() { 114 void MountedDiskMonitor::Reset() {
115 unmounted_while_resuming_.clear(); 115 unmounted_while_resuming_.clear();
116 is_resuming_ = false; 116 is_resuming_ = false;
117 } 117 }
118 118
119 } // namespace file_manager 119 } // namespace file_manager
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698