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

Side by Side Diff: ui/gfx/monitor.cc

Issue 10388036: Adds the option of aligning the launcher to the left or right. There (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix compile Created 8 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 | Annotate | Revision Log
« no previous file with comments | « ui/gfx/monitor.h ('k') | ui/views/view_model_utils.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "ui/gfx/monitor.h" 5 #include "ui/gfx/monitor.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/string_number_conversions.h" 9 #include "base/string_number_conversions.h"
10 #include "base/stringprintf.h" 10 #include "base/stringprintf.h"
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 work_area_(bounds), 51 work_area_(bounds),
52 device_scale_factor_(GetDefaultDeviceScaleFactor()) { 52 device_scale_factor_(GetDefaultDeviceScaleFactor()) {
53 #if defined(USE_AURA) 53 #if defined(USE_AURA)
54 SetScaleAndBounds(device_scale_factor_, bounds); 54 SetScaleAndBounds(device_scale_factor_, bounds);
55 #endif 55 #endif
56 } 56 }
57 57
58 Monitor::~Monitor() { 58 Monitor::~Monitor() {
59 } 59 }
60 60
61 Insets Monitor::GetWorkAreaInsets() const {
62 return gfx::Insets(work_area_.y() - bounds_.y(),
63 work_area_.x() - bounds_.x(),
64 bounds_.bottom() - work_area_.bottom(),
65 bounds_.right() - work_area_.right());
66 }
67
61 void Monitor::SetScaleAndBounds( 68 void Monitor::SetScaleAndBounds(
62 float device_scale_factor, 69 float device_scale_factor,
63 const gfx::Rect& bounds_in_pixel) { 70 const gfx::Rect& bounds_in_pixel) {
64 Insets insets = bounds_.InsetsFrom(work_area_); 71 Insets insets = bounds_.InsetsFrom(work_area_);
65 device_scale_factor_ = device_scale_factor; 72 device_scale_factor_ = device_scale_factor;
66 #if defined(USE_AURA) 73 #if defined(USE_AURA)
67 bounds_in_pixel_ = bounds_in_pixel; 74 bounds_in_pixel_ = bounds_in_pixel;
68 #endif 75 #endif
69 // TODO(oshima): For m19, work area/monitor bounds that chrome/webapps sees 76 // TODO(oshima): For m19, work area/monitor bounds that chrome/webapps sees
70 // has (0, 0) origin because it's simpler and enough. Fix this when 77 // has (0, 0) origin because it's simpler and enough. Fix this when
(...skipping 28 matching lines...) Expand all
99 106
100 std::string Monitor::ToString() const { 107 std::string Monitor::ToString() const {
101 return base::StringPrintf("Monitor[%d] bounds=%s, workarea=%s, scale=%f", 108 return base::StringPrintf("Monitor[%d] bounds=%s, workarea=%s, scale=%f",
102 id_, 109 id_,
103 bounds_.ToString().c_str(), 110 bounds_.ToString().c_str(),
104 work_area_.ToString().c_str(), 111 work_area_.ToString().c_str(),
105 device_scale_factor_); 112 device_scale_factor_);
106 } 113 }
107 114
108 } // namespace gfx 115 } // namespace gfx
OLDNEW
« no previous file with comments | « ui/gfx/monitor.h ('k') | ui/views/view_model_utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698