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

Side by Side Diff: chrome/browser/ui/libgtk2ui/gtk2_ui.cc

Issue 1100763002: Inject CanAddURLToHistory into TopSitesImpl (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@prefs
Patch Set: Fix error introduced during rebase Created 5 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 (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/ui/libgtk2ui/gtk2_ui.h" 5 #include "chrome/browser/ui/libgtk2ui/gtk2_ui.h"
6 6
7 #include <math.h>
7 #include <set> 8 #include <set>
8 9
9 #include <pango/pango.h> 10 #include <pango/pango.h>
10 11
11 #include "base/command_line.h" 12 #include "base/command_line.h"
12 #include "base/debug/leak_annotations.h" 13 #include "base/debug/leak_annotations.h"
13 #include "base/environment.h" 14 #include "base/environment.h"
14 #include "base/i18n/rtl.h" 15 #include "base/i18n/rtl.h"
15 #include "base/logging.h" 16 #include "base/logging.h"
16 #include "base/nix/mime_util_xdg.h" 17 #include "base/nix/mime_util_xdg.h"
(...skipping 1403 matching lines...) Expand 10 before | Expand all | Expand 10 after
1420 } 1421 }
1421 1422
1422 void Gtk2UI::UpdateDeviceScaleFactor(float device_scale_factor) { 1423 void Gtk2UI::UpdateDeviceScaleFactor(float device_scale_factor) {
1423 device_scale_factor_ = device_scale_factor; 1424 device_scale_factor_ = device_scale_factor;
1424 GtkStyle* label_style = gtk_rc_get_style(fake_label_.get()); 1425 GtkStyle* label_style = gtk_rc_get_style(fake_label_.get());
1425 UpdateDefaultFont(label_style->font_desc); 1426 UpdateDefaultFont(label_style->font_desc);
1426 } 1427 }
1427 1428
1428 float Gtk2UI::GetDeviceScaleFactor() const { 1429 float Gtk2UI::GetDeviceScaleFactor() const {
1429 const int kCSSDefaultDPI = 96; 1430 const int kCSSDefaultDPI = 96;
1430 const float scale = GetDPI() / kCSSDefaultDPI; 1431 float scale = GetDPI() / kCSSDefaultDPI;
1431 return ui::GetScaleForScaleFactor(ui::GetSupportedScaleFactor(scale)); 1432 // Round to 2 decimals, e.g. to 1.33.
1433 return roundf(scale * 100) / 100;
1432 } 1434 }
1433 1435
1434 } // namespace libgtk2ui 1436 } // namespace libgtk2ui
1435 1437
1436 views::LinuxUI* BuildGtk2UI() { 1438 views::LinuxUI* BuildGtk2UI() {
1437 return new libgtk2ui::Gtk2UI; 1439 return new libgtk2ui::Gtk2UI;
1438 } 1440 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/exclusive_access/fullscreen_controller_state_unittest.cc ('k') | chrome/browser/ui/login/login_prompt.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698