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

Side by Side Diff: chrome/browser/chromeos/power/renderer_freezer.cc

Issue 2859363003: cros: Initial structure for views-based lock. (Closed)
Patch Set: Address comments Created 3 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/power/renderer_freezer.h" 5 #include "chrome/browser/chromeos/power/renderer_freezer.h"
6 6
7 #include <string> 7 #include <string>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 141
142 void RendererFreezer::OnScreenLockStateChanged(chromeos::ScreenLocker* locker, 142 void RendererFreezer::OnScreenLockStateChanged(chromeos::ScreenLocker* locker,
143 bool is_locked) { 143 bool is_locked) {
144 // The ScreenLocker class sends NOTIFICATION_SCREEN_LOCK_STATE_CHANGED when 144 // The ScreenLocker class sends NOTIFICATION_SCREEN_LOCK_STATE_CHANGED when
145 // the lock screen becomes ready, resulting in this code running synchronously 145 // the lock screen becomes ready, resulting in this code running synchronously
146 // to mark the screen locker renderer to remain unfrozen during a suspend 146 // to mark the screen locker renderer to remain unfrozen during a suspend
147 // request. Since this happens before the PowerManagerClient calls 147 // request. Since this happens before the PowerManagerClient calls
148 // RendererFreezer::SuspendImminent(), it is guaranteed that the screen locker 148 // RendererFreezer::SuspendImminent(), it is guaranteed that the screen locker
149 // renderer will not be frozen at any point. 149 // renderer will not be frozen at any point.
150 if (is_locked) { 150 if (is_locked) {
151 delegate_->SetShouldFreezeRenderer( 151 delegate_->SetShouldFreezeRenderer(locker->delegate()
152 locker->web_ui()->GetWebContents()->GetRenderProcessHost()->GetHandle(), 152 ->GetWebContents()
153 false); 153 ->GetRenderProcessHost()
154 ->GetHandle(),
155 false);
154 } 156 }
155 } 157 }
156 158
157 void RendererFreezer::OnRenderProcessCreated(content::RenderProcessHost* rph) { 159 void RendererFreezer::OnRenderProcessCreated(content::RenderProcessHost* rph) {
158 const int rph_id = rph->GetID(); 160 const int rph_id = rph->GetID();
159 161
160 if (gcm_extension_processes_.find(rph_id) != gcm_extension_processes_.end()) { 162 if (gcm_extension_processes_.find(rph_id) != gcm_extension_processes_.end()) {
161 LOG(ERROR) << "Received duplicate notifications about the creation of a " 163 LOG(ERROR) << "Received duplicate notifications about the creation of a "
162 << "RenderProcessHost with id " << rph_id; 164 << "RenderProcessHost with id " << rph_id;
163 return; 165 return;
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 rph->AddObserver(this); 199 rph->AddObserver(this);
198 return; 200 return;
199 } 201 }
200 202
201 // We didn't find an extension in this RenderProcessHost that is using GCM so 203 // We didn't find an extension in this RenderProcessHost that is using GCM so
202 // we can go ahead and freeze it on suspend. 204 // we can go ahead and freeze it on suspend.
203 delegate_->SetShouldFreezeRenderer(rph->GetHandle(), true); 205 delegate_->SetShouldFreezeRenderer(rph->GetHandle(), true);
204 } 206 }
205 207
206 } // namespace chromeos 208 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698