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

Side by Side Diff: chrome/browser/signin/easy_unlock_service_regular.cc

Issue 2270553002: Move ash::DisplayInfo to ui (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebased Created 4 years, 3 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/signin/easy_unlock_service_regular.h" 5 #include "chrome/browser/signin/easy_unlock_service_regular.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include <utility> 9 #include <utility>
10 10
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 #include "components/signin/core/browser/signin_manager.h" 48 #include "components/signin/core/browser/signin_manager.h"
49 #include "components/translate/core/browser/translate_download_manager.h" 49 #include "components/translate/core/browser/translate_download_manager.h"
50 #include "components/version_info/version_info.h" 50 #include "components/version_info/version_info.h"
51 #include "content/public/browser/browser_thread.h" 51 #include "content/public/browser/browser_thread.h"
52 #include "extensions/browser/event_router.h" 52 #include "extensions/browser/event_router.h"
53 #include "extensions/common/constants.h" 53 #include "extensions/common/constants.h"
54 #include "google_apis/gaia/gaia_auth_util.h" 54 #include "google_apis/gaia/gaia_auth_util.h"
55 55
56 #if defined(OS_CHROMEOS) 56 #if defined(OS_CHROMEOS)
57 #include "apps/app_lifetime_monitor_factory.h" 57 #include "apps/app_lifetime_monitor_factory.h"
58 #include "ash/common/display/display_info.h"
59 #include "ash/display/display_manager.h" 58 #include "ash/display/display_manager.h"
60 #include "ash/shell.h" 59 #include "ash/shell.h"
61 #include "base/linux_util.h" 60 #include "base/linux_util.h"
62 #include "base/threading/thread_task_runner_handle.h" 61 #include "base/threading/thread_task_runner_handle.h"
63 #include "chrome/browser/chromeos/login/easy_unlock/easy_unlock_key_manager.h" 62 #include "chrome/browser/chromeos/login/easy_unlock/easy_unlock_key_manager.h"
64 #include "chrome/browser/chromeos/login/easy_unlock/easy_unlock_reauth.h" 63 #include "chrome/browser/chromeos/login/easy_unlock/easy_unlock_reauth.h"
65 #include "chrome/browser/chromeos/login/session/user_session_manager.h" 64 #include "chrome/browser/chromeos/login/session/user_session_manager.h"
66 #include "chrome/browser/chromeos/profiles/profile_helper.h" 65 #include "chrome/browser/chromeos/profiles/profile_helper.h"
67 #include "components/user_manager/user_manager.h" 66 #include "components/user_manager/user_manager.h"
67 #include "ui/display/manager/managed_display_info.h"
68 #endif 68 #endif
69 69
70 namespace { 70 namespace {
71 71
72 // Key name of the local device permit record dictonary in kEasyUnlockPairing. 72 // Key name of the local device permit record dictonary in kEasyUnlockPairing.
73 const char kKeyPermitAccess[] = "permitAccess"; 73 const char kKeyPermitAccess[] = "permitAccess";
74 74
75 // Key name of the remote device list in kEasyUnlockPairing. 75 // Key name of the remote device list in kEasyUnlockPairing.
76 const char kKeyDevices[] = "devices"; 76 const char kKeyDevices[] = "devices";
77 77
(...skipping 544 matching lines...) Expand 10 before | Expand all | Expand 10 after
622 device_info.set_device_os_version_code(software_version_code); 622 device_info.set_device_os_version_code(software_version_code);
623 623
624 // There may not be a Shell instance in tests. 624 // There may not be a Shell instance in tests.
625 if (!ash::Shell::HasInstance()) 625 if (!ash::Shell::HasInstance())
626 return device_info; 626 return device_info;
627 627
628 ash::DisplayManager* display_manager = 628 ash::DisplayManager* display_manager =
629 ash::Shell::GetInstance()->display_manager(); 629 ash::Shell::GetInstance()->display_manager();
630 int64_t primary_display_id = 630 int64_t primary_display_id =
631 display_manager->GetPrimaryDisplayCandidate().id(); 631 display_manager->GetPrimaryDisplayCandidate().id();
632 ash::DisplayInfo display_info = 632 display::ManagedDisplayInfo display_info =
633 display_manager->GetDisplayInfo(primary_display_id); 633 display_manager->GetDisplayInfo(primary_display_id);
634 gfx::Rect bounds = display_info.bounds_in_native(); 634 gfx::Rect bounds = display_info.bounds_in_native();
635 635
636 // TODO(tengs): This is a heuristic to deterimine the DPI of the display, as 636 // TODO(tengs): This is a heuristic to deterimine the DPI of the display, as
637 // there is no convenient way of getting this information right now. 637 // there is no convenient way of getting this information right now.
638 const double dpi = display_info.device_scale_factor() > 1.0f ? 239.0f : 96.0f; 638 const double dpi = display_info.device_scale_factor() > 1.0f ? 239.0f : 96.0f;
639 double width_in_inches = (bounds.width() - bounds.x()) / dpi; 639 double width_in_inches = (bounds.width() - bounds.x()) / dpi;
640 double height_in_inches = (bounds.height() - bounds.y()) / dpi; 640 double height_in_inches = (bounds.height() - bounds.y()) / dpi;
641 double diagonal_in_inches = sqrt(width_in_inches * width_in_inches + 641 double diagonal_in_inches = sqrt(width_in_inches * width_in_inches +
642 height_in_inches * height_in_inches); 642 height_in_inches * height_in_inches);
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
681 PA_LOG(INFO) << "Refresh token not yet available, " 681 PA_LOG(INFO) << "Refresh token not yet available, "
682 << "waiting before starting CryptAuth managers"; 682 << "waiting before starting CryptAuth managers";
683 token_service->AddObserver(this); 683 token_service->AddObserver(this);
684 } 684 }
685 685
686 device_manager_->AddObserver(this); 686 device_manager_->AddObserver(this);
687 enrollment_manager_->Start(); 687 enrollment_manager_->Start();
688 device_manager_->Start(); 688 device_manager_->Start();
689 } 689 }
690 #endif 690 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698