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

Side by Side Diff: chrome/browser/chromeos/policy/status_uploader.cc

Issue 1135413002: Disable screenshot uploading if there has been user input. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Self-review Created 5 years, 7 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 | « chrome/browser/chromeos/policy/status_uploader.h ('k') | 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) 2015 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2015 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/policy/status_uploader.h" 5 #include "chrome/browser/chromeos/policy/status_uploader.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
11 #include "base/location.h" 11 #include "base/location.h"
12 #include "base/sequenced_task_runner.h" 12 #include "base/sequenced_task_runner.h"
13 #include "chrome/browser/chromeos/policy/device_local_account.h"
13 #include "chrome/browser/chromeos/policy/device_status_collector.h" 14 #include "chrome/browser/chromeos/policy/device_status_collector.h"
14 #include "chromeos/settings/cros_settings_names.h" 15 #include "chromeos/settings/cros_settings_names.h"
15 #include "chromeos/settings/cros_settings_provider.h" 16 #include "chromeos/settings/cros_settings_provider.h"
16 #include "components/policy/core/common/cloud/cloud_policy_client.h" 17 #include "components/policy/core/common/cloud/cloud_policy_client.h"
17 #include "components/policy/core/common/cloud/device_management_service.h" 18 #include "components/policy/core/common/cloud/device_management_service.h"
19 #include "ui/base/user_activity/user_activity_detector.h"
18 20
19 namespace { 21 namespace {
20 const int kMinUploadDelayMs = 60 * 1000; // 60 seconds 22 const int kMinUploadDelayMs = 60 * 1000; // 60 seconds
21 } // namespace 23 } // namespace
22 24
23 namespace policy { 25 namespace policy {
24 26
25 const int64 StatusUploader::kDefaultUploadDelayMs = 27 const int64 StatusUploader::kDefaultUploadDelayMs =
26 3 * 60 * 60 * 1000; // 3 hours 28 3 * 60 * 60 * 1000; // 3 hours
27 29
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 std::max(kMinUploadDelayMs, frequency)); 98 std::max(kMinUploadDelayMs, frequency));
97 } 99 }
98 100
99 // Schedule a new upload with the new frequency - only do this if we've 101 // Schedule a new upload with the new frequency - only do this if we've
100 // already performed the initial upload, because we want the initial upload 102 // already performed the initial upload, because we want the initial upload
101 // to happen immediately on startup and not get cancelled by settings changes. 103 // to happen immediately on startup and not get cancelled by settings changes.
102 if (!last_upload_.is_null()) 104 if (!last_upload_.is_null())
103 ScheduleNextStatusUpload(); 105 ScheduleNextStatusUpload();
104 } 106 }
105 107
108 bool StatusUploader::IsSessionDataUploadAllowed() {
109 // Check if we're in an auto-launched kiosk session.
110 scoped_ptr<DeviceLocalAccount> account =
111 collector_->GetAutoLaunchedKioskSessionInfo();
112 if (!account)
113 return false;
114
115 // Check if there has been any user input.
116 if (!ui::UserActivityDetector::Get()->last_activity_time().is_null())
117 return false;
118
119 // TODO(atwilson): Check if we've captured any audio/video data
120 // (http://crbug.com/487261).
121 return true;
122 }
123
106 void StatusUploader::UploadStatus() { 124 void StatusUploader::UploadStatus() {
107 enterprise_management::DeviceStatusReportRequest device_status; 125 enterprise_management::DeviceStatusReportRequest device_status;
108 bool have_device_status = collector_->GetDeviceStatus(&device_status); 126 bool have_device_status = collector_->GetDeviceStatus(&device_status);
109 enterprise_management::SessionStatusReportRequest session_status; 127 enterprise_management::SessionStatusReportRequest session_status;
110 bool have_session_status = collector_->GetDeviceSessionStatus( 128 bool have_session_status = collector_->GetDeviceSessionStatus(
111 &session_status); 129 &session_status);
112 if (!have_device_status && !have_session_status) { 130 if (!have_device_status && !have_session_status) {
113 // Don't have any status to upload - just set our timer for next time. 131 // Don't have any status to upload - just set our timer for next time.
114 last_upload_ = base::Time::NowFromSystemTime(); 132 last_upload_ = base::Time::NowFromSystemTime();
115 ScheduleNextStatusUpload(); 133 ScheduleNextStatusUpload();
(...skipping 16 matching lines...) Expand all
132 150
133 // If the upload was successful, tell the collector so it can clear its cache 151 // If the upload was successful, tell the collector so it can clear its cache
134 // of pending items. 152 // of pending items.
135 if (success) 153 if (success)
136 collector_->OnSubmittedSuccessfully(); 154 collector_->OnSubmittedSuccessfully();
137 155
138 ScheduleNextStatusUpload(); 156 ScheduleNextStatusUpload();
139 } 157 }
140 158
141 } // namespace policy 159 } // namespace policy
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/policy/status_uploader.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698