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

Side by Side Diff: mash/wm/frame/header_painter_util.cc

Issue 2029883002: Moves mash/wm into ash/mus (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@remove_static_assert
Patch Set: move comment Created 4 years, 6 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
« no previous file with comments | « mash/wm/frame/header_painter_util.h ('k') | mash/wm/frame/move_event_handler.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "mash/wm/frame/header_painter_util.h"
6
7 #include <algorithm>
8
9 #include "ui/gfx/font_list.h"
10 #include "ui/gfx/geometry/rect.h"
11 #include "ui/views/view.h"
12 #include "ui/views/widget/widget.h"
13
14 namespace {
15
16 // Radius of the header's top corners when the window is restored.
17 const int kTopCornerRadiusWhenRestored = 2;
18
19 // Distance between left edge of the window and the leftmost view.
20 const int kLeftViewXInset = 9;
21
22 // Space between the title text and the caption buttons.
23 const int kTitleCaptionButtonSpacing = 5;
24
25 // Space between window icon and title text.
26 const int kTitleIconOffsetX = 5;
27
28 // Space between window edge and title text, when there is no icon.
29 const int kTitleNoIconOffsetX = 8;
30
31 // In the pre-Ash era the web content area had a frame along the left edge, so
32 // user-generated theme images for the new tab page assume they are shifted
33 // right relative to the header. Now that we have removed the left edge frame
34 // we need to copy the theme image for the window header from a few pixels
35 // inset to preserve alignment with the NTP image, or else we'll break a bunch
36 // of existing themes. We do something similar on OS X for the same reason.
37 const int kThemeFrameImageInsetX = 5;
38
39 } // namespace
40
41 namespace mash {
42 namespace wm {
43
44 // static
45 int HeaderPainterUtil::GetTopCornerRadiusWhenRestored() {
46 return kTopCornerRadiusWhenRestored;
47 }
48
49 // static
50 int HeaderPainterUtil::GetLeftViewXInset() {
51 return kLeftViewXInset;
52 }
53
54 // static
55 int HeaderPainterUtil::GetThemeBackgroundXInset() {
56 return kThemeFrameImageInsetX;
57 }
58
59 // static
60 gfx::Rect HeaderPainterUtil::GetTitleBounds(
61 const views::View* left_view,
62 const views::View* right_view,
63 const gfx::FontList& title_font_list) {
64 int x = left_view ? left_view->bounds().right() + kTitleIconOffsetX
65 : kTitleNoIconOffsetX;
66 int height = title_font_list.GetHeight();
67 // Floor when computing the center of |caption_button_container| and when
68 // computing the center of the text.
69 int y = std::max(0, (right_view->height() / 2) - (height / 2));
70 int width = std::max(0, right_view->x() - kTitleCaptionButtonSpacing - x);
71 return gfx::Rect(x, y, width, height);
72 }
73
74 // static
75 bool HeaderPainterUtil::CanAnimateActivation(views::Widget* widget) {
76 return true;
77 }
78
79 } // namespace wm
80 } // namespace mash
OLDNEW
« no previous file with comments | « mash/wm/frame/header_painter_util.h ('k') | mash/wm/frame/move_event_handler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698