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

Side by Side Diff: chrome/browser/chromeos/login/lock/screen_locker.cc

Issue 2771233002: Remove the wrapper functions content::RecordAction et al (Closed)
Patch Set: Rebased Created 3 years, 9 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/login/lock/screen_locker.h" 5 #include "chrome/browser/chromeos/login/lock/screen_locker.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "ash/common/wallpaper/wallpaper_controller.h" 10 #include "ash/common/wallpaper/wallpaper_controller.h"
11 #include "ash/common/wm/window_state.h" 11 #include "ash/common/wm/window_state.h"
12 #include "ash/common/wm/wm_event.h" 12 #include "ash/common/wm/wm_event.h"
13 #include "ash/common/wm_shell.h" 13 #include "ash/common/wm_shell.h"
14 #include "ash/shell.h" 14 #include "ash/shell.h"
15 #include "ash/wm/lock_state_controller.h" 15 #include "ash/wm/lock_state_controller.h"
16 #include "ash/wm/window_state_aura.h" 16 #include "ash/wm/window_state_aura.h"
17 #include "ash/wm/window_util.h" 17 #include "ash/wm/window_util.h"
18 #include "base/bind.h" 18 #include "base/bind.h"
19 #include "base/command_line.h" 19 #include "base/command_line.h"
20 #include "base/lazy_instance.h" 20 #include "base/lazy_instance.h"
21 #include "base/location.h" 21 #include "base/location.h"
22 #include "base/macros.h" 22 #include "base/macros.h"
23 #include "base/memory/weak_ptr.h" 23 #include "base/memory/weak_ptr.h"
24 #include "base/message_loop/message_loop.h" 24 #include "base/message_loop/message_loop.h"
25 #include "base/metrics/histogram_macros.h" 25 #include "base/metrics/histogram_macros.h"
26 #include "base/metrics/user_metrics.h"
26 #include "base/single_thread_task_runner.h" 27 #include "base/single_thread_task_runner.h"
27 #include "base/strings/string_number_conversions.h" 28 #include "base/strings/string_number_conversions.h"
28 #include "base/strings/string_util.h" 29 #include "base/strings/string_util.h"
29 #include "base/threading/thread_task_runner_handle.h" 30 #include "base/threading/thread_task_runner_handle.h"
30 #include "chrome/browser/chrome_notification_types.h" 31 #include "chrome/browser/chrome_notification_types.h"
31 #include "chrome/browser/chromeos/accessibility/accessibility_manager.h" 32 #include "chrome/browser/chromeos/accessibility/accessibility_manager.h"
32 #include "chrome/browser/chromeos/login/lock/webui_screen_locker.h" 33 #include "chrome/browser/chromeos/login/lock/webui_screen_locker.h"
33 #include "chrome/browser/chromeos/login/quick_unlock/quick_unlock_factory.h" 34 #include "chrome/browser/chromeos/login/quick_unlock/quick_unlock_factory.h"
34 #include "chrome/browser/chromeos/login/quick_unlock/quick_unlock_storage.h" 35 #include "chrome/browser/chromeos/login/quick_unlock/quick_unlock_storage.h"
35 #include "chrome/browser/chromeos/login/session/user_session_manager.h" 36 #include "chrome/browser/chromeos/login/session/user_session_manager.h"
(...skipping 15 matching lines...) Expand all
51 #include "chromeos/login/auth/authenticator.h" 52 #include "chromeos/login/auth/authenticator.h"
52 #include "chromeos/login/auth/extended_authenticator.h" 53 #include "chromeos/login/auth/extended_authenticator.h"
53 #include "chromeos/network/portal_detector/network_portal_detector.h" 54 #include "chromeos/network/portal_detector/network_portal_detector.h"
54 #include "components/session_manager/core/session_manager.h" 55 #include "components/session_manager/core/session_manager.h"
55 #include "components/signin/core/browser/signin_manager.h" 56 #include "components/signin/core/browser/signin_manager.h"
56 #include "components/user_manager/user_manager.h" 57 #include "components/user_manager/user_manager.h"
57 #include "components/user_manager/user_type.h" 58 #include "components/user_manager/user_type.h"
58 #include "content/public/browser/browser_thread.h" 59 #include "content/public/browser/browser_thread.h"
59 #include "content/public/browser/notification_service.h" 60 #include "content/public/browser/notification_service.h"
60 #include "content/public/browser/url_data_source.h" 61 #include "content/public/browser/url_data_source.h"
61 #include "content/public/browser/user_metrics.h"
62 #include "content/public/browser/web_contents.h" 62 #include "content/public/browser/web_contents.h"
63 #include "content/public/browser/web_ui.h" 63 #include "content/public/browser/web_ui.h"
64 #include "media/audio/sounds/sounds_manager.h" 64 #include "media/audio/sounds/sounds_manager.h"
65 #include "ui/base/resource/resource_bundle.h" 65 #include "ui/base/resource/resource_bundle.h"
66 #include "ui/gfx/image/image.h" 66 #include "ui/gfx/image/image.h"
67 #include "url/gurl.h" 67 #include "url/gurl.h"
68 68
69 using base::UserMetricsAction; 69 using base::UserMetricsAction;
70 using content::BrowserThread; 70 using content::BrowserThread;
71 71
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 179
180 // Ownership of |icon_image_source| is passed. 180 // Ownership of |icon_image_source| is passed.
181 screenlock_icon_provider_.reset(new ScreenlockIconProvider); 181 screenlock_icon_provider_.reset(new ScreenlockIconProvider);
182 ScreenlockIconSource* screenlock_icon_source = 182 ScreenlockIconSource* screenlock_icon_source =
183 new ScreenlockIconSource(screenlock_icon_provider_->AsWeakPtr()); 183 new ScreenlockIconSource(screenlock_icon_provider_->AsWeakPtr());
184 content::URLDataSource::Add(web_ui()->GetWebContents()->GetBrowserContext(), 184 content::URLDataSource::Add(web_ui()->GetWebContents()->GetBrowserContext(),
185 screenlock_icon_source); 185 screenlock_icon_source);
186 } 186 }
187 187
188 void ScreenLocker::OnAuthFailure(const AuthFailure& error) { 188 void ScreenLocker::OnAuthFailure(const AuthFailure& error) {
189 content::RecordAction(UserMetricsAction("ScreenLocker_OnLoginFailure")); 189 base::RecordAction(UserMetricsAction("ScreenLocker_OnLoginFailure"));
190 if (authentication_start_time_.is_null()) { 190 if (authentication_start_time_.is_null()) {
191 LOG(ERROR) << "Start time is not set at authentication failure"; 191 LOG(ERROR) << "Start time is not set at authentication failure";
192 } else { 192 } else {
193 base::TimeDelta delta = base::Time::Now() - authentication_start_time_; 193 base::TimeDelta delta = base::Time::Now() - authentication_start_time_;
194 VLOG(1) << "Authentication failure: " << delta.InSecondsF() << " second(s)"; 194 VLOG(1) << "Authentication failure: " << delta.InSecondsF() << " second(s)";
195 UMA_HISTOGRAM_TIMES("ScreenLocker.AuthenticationFailureTime", delta); 195 UMA_HISTOGRAM_TIMES("ScreenLocker.AuthenticationFailureTime", delta);
196 } 196 }
197 197
198 UMA_HISTOGRAM_ENUMERATION( 198 UMA_HISTOGRAM_ENUMERATION(
199 "ScreenLocker.AuthenticationFailure", 199 "ScreenLocker.AuthenticationFailure",
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
355 } 355 }
356 return nullptr; 356 return nullptr;
357 } 357 }
358 358
359 void ScreenLocker::ClearErrors() { 359 void ScreenLocker::ClearErrors() {
360 web_ui()->ClearErrors(); 360 web_ui()->ClearErrors();
361 } 361 }
362 362
363 void ScreenLocker::Signout() { 363 void ScreenLocker::Signout() {
364 web_ui()->ClearErrors(); 364 web_ui()->ClearErrors();
365 content::RecordAction(UserMetricsAction("ScreenLocker_Signout")); 365 base::RecordAction(UserMetricsAction("ScreenLocker_Signout"));
366 // We expect that this call will not wait for any user input. 366 // We expect that this call will not wait for any user input.
367 // If it changes at some point, we will need to force exit. 367 // If it changes at some point, we will need to force exit.
368 chrome::AttemptUserExit(); 368 chrome::AttemptUserExit();
369 369
370 // Don't hide yet the locker because the chrome screen may become visible 370 // Don't hide yet the locker because the chrome screen may become visible
371 // briefly. 371 // briefly.
372 } 372 }
373 373
374 void ScreenLocker::EnableInput() { 374 void ScreenLocker::EnableInput() {
375 web_ui()->SetInputEnabled(true); 375 web_ui()->SetInputEnabled(true);
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
422 // the sign-in steps. See crbug.com/112225 and crbug.com/110933. 422 // the sign-in steps. See crbug.com/112225 and crbug.com/110933.
423 VLOG(1) << "Calling session manager's StopSession D-Bus method"; 423 VLOG(1) << "Calling session manager's StopSession D-Bus method";
424 DBusThreadManager::Get()->GetSessionManagerClient()->StopSession(); 424 DBusThreadManager::Get()->GetSessionManagerClient()->StopSession();
425 } 425 }
426 // Close captive portal window and clear signin profile. 426 // Close captive portal window and clear signin profile.
427 network_portal_detector::GetInstance()->OnLockScreenRequest(); 427 network_portal_detector::GetInstance()->OnLockScreenRequest();
428 } 428 }
429 429
430 // static 430 // static
431 void ScreenLocker::Show() { 431 void ScreenLocker::Show() {
432 content::RecordAction(UserMetricsAction("ScreenLocker_Show")); 432 base::RecordAction(UserMetricsAction("ScreenLocker_Show"));
433 DCHECK(base::MessageLoopForUI::IsCurrent()); 433 DCHECK(base::MessageLoopForUI::IsCurrent());
434 434
435 // Check whether the currently logged in user is a guest account and if so, 435 // Check whether the currently logged in user is a guest account and if so,
436 // refuse to lock the screen (crosbug.com/23764). 436 // refuse to lock the screen (crosbug.com/23764).
437 if (user_manager::UserManager::Get()->IsLoggedInAsGuest()) { 437 if (user_manager::UserManager::Get()->IsLoggedInAsGuest()) {
438 VLOG(1) << "Refusing to lock screen for guest account"; 438 VLOG(1) << "Refusing to lock screen for guest account";
439 return; 439 return;
440 } 440 }
441 441
442 // If the active window is fullscreen, exit fullscreen to avoid the web page 442 // If the active window is fullscreen, exit fullscreen to avoid the web page
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
567 567
568 bool ScreenLocker::IsUserLoggedIn(const AccountId& account_id) const { 568 bool ScreenLocker::IsUserLoggedIn(const AccountId& account_id) const {
569 for (user_manager::User* user : users_) { 569 for (user_manager::User* user : users_) {
570 if (user->GetAccountId() == account_id) 570 if (user->GetAccountId() == account_id)
571 return true; 571 return true;
572 } 572 }
573 return false; 573 return false;
574 } 574 }
575 575
576 } // namespace chromeos 576 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/login/existing_user_controller.cc ('k') | chrome/browser/chromeos/login/signin/auth_sync_observer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698