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

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

Issue 2429033003: cros: Cleanup lock screen and OOBE C++ backing code. (Closed)
Patch Set: Address comments Created 4 years, 2 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"
11 #include "base/logging.h" 11 #include "base/logging.h"
12 #include "base/message_loop/message_loop.h" 12 #include "base/message_loop/message_loop.h"
13 #include "base/process/process_handle.h" 13 #include "base/process/process_handle.h"
14 #include "chrome/browser/chrome_notification_types.h" 14 #include "chrome/browser/chrome_notification_types.h"
15 #include "chrome/browser/chromeos/login/lock/screen_locker.h" 15 #include "chrome/browser/chromeos/login/lock/screen_locker.h"
16 #include "chrome/browser/chromeos/login/lock/screen_locker_delegate.h" 16 #include "chrome/browser/chromeos/login/lock/webui_screen_locker.h"
17 #include "chromeos/dbus/dbus_thread_manager.h" 17 #include "chromeos/dbus/dbus_thread_manager.h"
18 #include "content/public/browser/notification_details.h" 18 #include "content/public/browser/notification_details.h"
19 #include "content/public/browser/notification_service.h" 19 #include "content/public/browser/notification_service.h"
20 #include "content/public/browser/notification_source.h" 20 #include "content/public/browser/notification_source.h"
21 #include "content/public/browser/notification_types.h" 21 #include "content/public/browser/notification_types.h"
22 #include "content/public/browser/render_process_host.h" 22 #include "content/public/browser/render_process_host.h"
23 #include "content/public/browser/web_contents.h" 23 #include "content/public/browser/web_contents.h"
24 #include "content/public/browser/web_ui.h" 24 #include "content/public/browser/web_ui.h"
25 #include "extensions/browser/extension_registry.h" 25 #include "extensions/browser/extension_registry.h"
26 #include "extensions/browser/notification_types.h" 26 #include "extensions/browser/notification_types.h"
(...skipping 114 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(locker->delegate() 151 delegate_->SetShouldFreezeRenderer(
152 ->GetAssociatedWebUI() 152 locker->web_ui()->GetWebContents()->GetRenderProcessHost()->GetHandle(),
153 ->GetWebContents() 153 false);
154 ->GetRenderProcessHost()
155 ->GetHandle(),
156 false);
157 } 154 }
158 } 155 }
159 156
160 void RendererFreezer::OnRenderProcessCreated(content::RenderProcessHost* rph) { 157 void RendererFreezer::OnRenderProcessCreated(content::RenderProcessHost* rph) {
161 const int rph_id = rph->GetID(); 158 const int rph_id = rph->GetID();
162 159
163 if (gcm_extension_processes_.find(rph_id) != gcm_extension_processes_.end()) { 160 if (gcm_extension_processes_.find(rph_id) != gcm_extension_processes_.end()) {
164 LOG(ERROR) << "Received duplicate notifications about the creation of a " 161 LOG(ERROR) << "Received duplicate notifications about the creation of a "
165 << "RenderProcessHost with id " << rph_id; 162 << "RenderProcessHost with id " << rph_id;
166 return; 163 return;
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 rph->AddObserver(this); 197 rph->AddObserver(this);
201 return; 198 return;
202 } 199 }
203 200
204 // We didn't find an extension in this RenderProcessHost that is using GCM so 201 // We didn't find an extension in this RenderProcessHost that is using GCM so
205 // we can go ahead and freeze it on suspend. 202 // we can go ahead and freeze it on suspend.
206 delegate_->SetShouldFreezeRenderer(rph->GetHandle(), true); 203 delegate_->SetShouldFreezeRenderer(rph->GetHandle(), true);
207 } 204 }
208 205
209 } // namespace chromeos 206 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/login/ui/webui_login_view.cc ('k') | chrome/browser/chromeos/shutdown_policy_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698