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

Side by Side Diff: ash/wm/frame_painter.cc

Issue 9817025: Ash: Use right edge of screen to scroll maximized windows (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 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 | Annotate | Revision Log
« no previous file with comments | « ash/wm/frame_painter.h ('k') | ash/wm/window_util.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 "ash/wm/frame_painter.h" 5 #include "ash/wm/frame_painter.h"
6 6
7 #include "base/logging.h" // DCHECK 7 #include "base/logging.h" // DCHECK
8 #include "grit/ui_resources.h" 8 #include "grit/ui_resources.h"
9 #include "third_party/skia/include/core/SkCanvas.h" 9 #include "third_party/skia/include/core/SkCanvas.h"
10 #include "third_party/skia/include/core/SkColor.h" 10 #include "third_party/skia/include/core/SkColor.h"
11 #include "third_party/skia/include/core/SkPaint.h" 11 #include "third_party/skia/include/core/SkPaint.h"
12 #include "third_party/skia/include/core/SkPath.h" 12 #include "third_party/skia/include/core/SkPath.h"
13 #include "third_party/skia/include/core/SkShader.h" 13 #include "third_party/skia/include/core/SkShader.h"
14 #include "ui/aura/window.h" 14 #include "ui/aura/window.h"
15 #include "ui/base/hit_test.h" 15 #include "ui/base/hit_test.h"
16 #include "ui/base/resource/resource_bundle.h" 16 #include "ui/base/resource/resource_bundle.h"
17 #include "ui/base/theme_provider.h" 17 #include "ui/base/theme_provider.h"
18 #include "ui/gfx/canvas.h" 18 #include "ui/gfx/canvas.h"
19 #include "ui/gfx/font.h" 19 #include "ui/gfx/font.h"
20 #include "ui/gfx/image/image.h" 20 #include "ui/gfx/image/image.h"
21 #include "ui/views/controls/button/image_button.h" 21 #include "ui/views/controls/button/image_button.h"
22 #include "ui/views/widget/widget.h" 22 #include "ui/views/widget/widget.h"
23 #include "ui/views/widget/widget_delegate.h" 23 #include "ui/views/widget/widget_delegate.h"
24 24
25 namespace { 25 namespace {
26 // TODO(jamescook): Border is specified to be a single pixel overlapping 26 // TODO(jamescook): Border is specified to be a single pixel overlapping
27 // the web content and may need to be built into the shadow layers instead. 27 // the web content and may need to be built into the shadow layers instead.
28 const int kBorderThickness = 0; 28 const int kBorderThickness = 0;
29 // Ash windows do not have a traditional visible window frame. Window content
30 // extends to the edge of the window. We consider a small region outside the
31 // window bounds and an even smaller region overlapping the window to be the
32 // "non-client" area and use it for resizing.
33 const int kResizeOutsideBoundsSize = 6;
34 const int kResizeInsideBoundsSize = 1;
35 // In the window corners, the resize areas don't actually expand bigger, but the 29 // In the window corners, the resize areas don't actually expand bigger, but the
36 // 16 px at the end of each edge triggers diagonal resizing. 30 // 16 px at the end of each edge triggers diagonal resizing.
37 const int kResizeAreaCornerSize = 16; 31 const int kResizeAreaCornerSize = 16;
38 // Space between left edge of window and popup window icon. 32 // Space between left edge of window and popup window icon.
39 const int kIconOffsetX = 4; 33 const int kIconOffsetX = 4;
40 // Space between top of window and popup window icon. 34 // Space between top of window and popup window icon.
41 const int kIconOffsetY = 6; 35 const int kIconOffsetY = 6;
42 // Height and width of window icon. 36 // Height and width of window icon.
43 const int kIconSize = 16; 37 const int kIconSize = 16;
44 // Space between the title text and the caption buttons. 38 // Space between the title text and the caption buttons.
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 // back. This is cheaper than pushing/popping the entire canvas state. 95 // back. This is cheaper than pushing/popping the entire canvas state.
102 canvas->sk_canvas()->translate(SkIntToScalar(-bitmap_offset_x), 0); 96 canvas->sk_canvas()->translate(SkIntToScalar(-bitmap_offset_x), 0);
103 canvas->sk_canvas()->drawPath(path, paint); 97 canvas->sk_canvas()->drawPath(path, paint);
104 canvas->sk_canvas()->translate(SkIntToScalar(bitmap_offset_x), 0); 98 canvas->sk_canvas()->translate(SkIntToScalar(bitmap_offset_x), 0);
105 99
106 } 100 }
107 } // namespace 101 } // namespace
108 102
109 namespace ash { 103 namespace ash {
110 104
105 // static
106 const int FramePainter::kResizeOutsideBoundsSize = 6;
107 const int FramePainter::kResizeInsideBoundsSize = 1;
108
111 /////////////////////////////////////////////////////////////////////////////// 109 ///////////////////////////////////////////////////////////////////////////////
112 // FramePainter, public: 110 // FramePainter, public:
113 111
114 FramePainter::FramePainter() 112 FramePainter::FramePainter()
115 : frame_(NULL), 113 : frame_(NULL),
116 window_icon_(NULL), 114 window_icon_(NULL),
117 maximize_button_(NULL), 115 maximize_button_(NULL),
118 close_button_(NULL), 116 close_button_(NULL),
119 button_separator_(NULL), 117 button_separator_(NULL),
120 top_left_corner_(NULL), 118 top_left_corner_(NULL),
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after
392 theme_provider->GetBitmapNamed(pushed_bitmap_id)); 390 theme_provider->GetBitmapNamed(pushed_bitmap_id));
393 } 391 }
394 392
395 int FramePainter::GetTitleOffsetX() const { 393 int FramePainter::GetTitleOffsetX() const {
396 return window_icon_ ? 394 return window_icon_ ?
397 window_icon_->bounds().right() + kTitleIconOffsetX : 395 window_icon_->bounds().right() + kTitleIconOffsetX :
398 kTitleNoIconOffsetX; 396 kTitleNoIconOffsetX;
399 } 397 }
400 398
401 } // namespace ash 399 } // namespace ash
OLDNEW
« no previous file with comments | « ash/wm/frame_painter.h ('k') | ash/wm/window_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698