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

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

Issue 1923943003: Add logging to remote commands (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove unused include Created 4 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
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 #include <utility> 8 #include <utility>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 // already performed the initial upload, because we want the initial upload 115 // already performed the initial upload, because we want the initial upload
116 // to happen immediately on startup and not get cancelled by settings changes. 116 // to happen immediately on startup and not get cancelled by settings changes.
117 if (!last_upload_.is_null()) 117 if (!last_upload_.is_null())
118 ScheduleNextStatusUpload(); 118 ScheduleNextStatusUpload();
119 } 119 }
120 120
121 bool StatusUploader::IsSessionDataUploadAllowed() { 121 bool StatusUploader::IsSessionDataUploadAllowed() {
122 // Check if we're in an auto-launched kiosk session. 122 // Check if we're in an auto-launched kiosk session.
123 std::unique_ptr<DeviceLocalAccount> account = 123 std::unique_ptr<DeviceLocalAccount> account =
124 collector_->GetAutoLaunchedKioskSessionInfo(); 124 collector_->GetAutoLaunchedKioskSessionInfo();
125 if (!account) 125 if (!account) {
126 LOG(WARNING) << "Not a kiosk session, data upload is not allowed.";
126 return false; 127 return false;
128 }
127 129
128 // Check if there has been any user input. 130 // Check if there has been any user input.
129 if (!ui::UserActivityDetector::Get()->last_activity_time().is_null()) 131 base::TimeTicks last_activity_time =
132 ui::UserActivityDetector::Get()->last_activity_time();
133 std::string last_activity_name =
134 ui::UserActivityDetector::Get()->last_activity_name();
135 if (!last_activity_time.is_null()) {
136 LOG(WARNING) << "User input " << last_activity_name << " detected "
137 << (base::TimeTicks::Now() - last_activity_time)
138 << " ago, data upload is not allowed.";
Andrew T Wilson (Slow) 2016/05/04 14:43:22 Can we also show how soon after boot the input hap
Marton Hunyady 2016/05/09 13:48:15 Done.
130 return false; 139 return false;
140 }
131 141
132 // Screenshot is allowed as long as we have not captured media. 142 // Screenshot is allowed as long as we have not captured media.
133 return !has_captured_media_; 143 if (has_captured_media_) {
144 LOG(WARNING) << "Media has been captured, data upload is not allowed.";
145 return false;
146 } else {
147 return true;
148 }
134 } 149 }
135 150
136 void StatusUploader::OnRequestUpdate(int render_process_id, 151 void StatusUploader::OnRequestUpdate(int render_process_id,
137 int render_frame_id, 152 int render_frame_id,
138 content::MediaStreamType stream_type, 153 content::MediaStreamType stream_type,
139 const content::MediaRequestState state) { 154 const content::MediaRequestState state) {
140 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); 155 DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
141 // If a video or audio capture stream is opened, set a flag so we disallow 156 // If a video or audio capture stream is opened, set a flag so we disallow
142 // upload of potentially sensitive data. 157 // upload of potentially sensitive data.
143 if (state == content::MEDIA_REQUEST_STATE_OPENING && 158 if (state == content::MEDIA_REQUEST_STATE_OPENING &&
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 196
182 // If the upload was successful, tell the collector so it can clear its cache 197 // If the upload was successful, tell the collector so it can clear its cache
183 // of pending items. 198 // of pending items.
184 if (success) 199 if (success)
185 collector_->OnSubmittedSuccessfully(); 200 collector_->OnSubmittedSuccessfully();
186 201
187 ScheduleNextStatusUpload(); 202 ScheduleNextStatusUpload();
188 } 203 }
189 204
190 } // namespace policy 205 } // namespace policy
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698