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

Side by Side Diff: chrome/browser/chromeos/login/helper.cc

Issue 24175004: Remove dependency on ui::ScaleFactor from ui/gfx (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/helper.h" 5 #include "chrome/browser/chromeos/login/helper.h"
6 6
7 #include "ash/shell.h" 7 #include "ash/shell.h"
8 #include "base/strings/utf_string_conversions.h" 8 #include "base/strings/utf_string_conversions.h"
9 #include "chromeos/network/network_handler.h" 9 #include "chromeos/network/network_handler.h"
10 #include "chromeos/network/network_state.h" 10 #include "chromeos/network/network_state.h"
11 #include "chromeos/network/network_state_handler.h" 11 #include "chromeos/network/network_state_handler.h"
12 #include "chromeos/network/shill_property_util.h" 12 #include "chromeos/network/shill_property_util.h"
13 #include "grit/generated_resources.h" 13 #include "grit/generated_resources.h"
14 #include "grit/theme_resources.h" 14 #include "grit/theme_resources.h"
15 #include "third_party/cros_system_api/dbus/service_constants.h" 15 #include "third_party/cros_system_api/dbus/service_constants.h"
16 #include "ui/base/l10n/l10n_util.h" 16 #include "ui/base/l10n/l10n_util.h"
17 #include "ui/base/resource/resource_bundle.h" 17 #include "ui/base/resource/resource_bundle.h"
18 #include "ui/gfx/image/image_skia.h"
18 #include "ui/gfx/screen.h" 19 #include "ui/gfx/screen.h"
19 20
20 namespace chromeos { 21 namespace chromeos {
21 22
22 gfx::Rect CalculateScreenBounds(const gfx::Size& size) { 23 gfx::Rect CalculateScreenBounds(const gfx::Size& size) {
23 gfx::Rect bounds(ash::Shell::GetScreen()->GetPrimaryDisplay().bounds()); 24 gfx::Rect bounds(ash::Shell::GetScreen()->GetPrimaryDisplay().bounds());
24 if (!size.IsEmpty()) { 25 if (!size.IsEmpty()) {
25 int horizontal_diff = bounds.width() - size.width(); 26 int horizontal_diff = bounds.width() - size.width();
26 int vertical_diff = bounds.height() - size.height(); 27 int vertical_diff = bounds.height() - size.height();
27 bounds.Inset(horizontal_diff / 2, vertical_diff / 2); 28 bounds.Inset(horizontal_diff / 2, vertical_diff / 2);
28 } 29 }
29 return bounds; 30 return bounds;
30 } 31 }
31 32
32 int GetCurrentUserImageSize() { 33 int GetCurrentUserImageSize() {
33 // The biggest size that the profile picture is displayed at is currently 34 // The biggest size that the profile picture is displayed at is currently
34 // 220px, used for the big preview on OOBE and Change Picture options page. 35 // 220px, used for the big preview on OOBE and Change Picture options page.
35 static const int kBaseUserImageSize = 220; 36 static const int kBaseUserImageSize = 220;
36 float scale_factor = gfx::Display::GetForcedDeviceScaleFactor(); 37 float scale_factor = gfx::Display::GetForcedDeviceScaleFactor();
37 if (scale_factor > 1.0f) 38 if (scale_factor > 1.0f)
38 return static_cast<int>(scale_factor * kBaseUserImageSize); 39 return static_cast<int>(scale_factor * kBaseUserImageSize);
39 return kBaseUserImageSize * 40 return kBaseUserImageSize * gfx::ImageSkia::GetMaxSupportedScale();
40 ui::GetScaleFactorScale(ui::GetMaxScaleFactor());
41 } 41 }
42 42
43 namespace login { 43 namespace login {
44 44
45 NetworkStateHelper::NetworkStateHelper() {} 45 NetworkStateHelper::NetworkStateHelper() {}
46 NetworkStateHelper::~NetworkStateHelper() {} 46 NetworkStateHelper::~NetworkStateHelper() {}
47 47
48 string16 NetworkStateHelper::GetCurrentNetworkName() const { 48 string16 NetworkStateHelper::GetCurrentNetworkName() const {
49 NetworkStateHandler* nsh = NetworkHandler::Get()->network_state_handler(); 49 NetworkStateHandler* nsh = NetworkHandler::Get()->network_state_handler();
50 const NetworkState* network = 50 const NetworkState* network =
(...skipping 23 matching lines...) Expand all
74 bool NetworkStateHelper::IsConnecting() const { 74 bool NetworkStateHelper::IsConnecting() const {
75 chromeos::NetworkStateHandler* nsh = 75 chromeos::NetworkStateHandler* nsh =
76 chromeos::NetworkHandler::Get()->network_state_handler(); 76 chromeos::NetworkHandler::Get()->network_state_handler();
77 return nsh->ConnectingNetworkByType( 77 return nsh->ConnectingNetworkByType(
78 chromeos::NetworkTypePattern::Default()) != NULL; 78 chromeos::NetworkTypePattern::Default()) != NULL;
79 } 79 }
80 80
81 } // namespace login 81 } // namespace login
82 82
83 } // namespace chromeos 83 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698