OLD | NEW |
---|---|
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 #ifndef CHROME_BROWSER_UI_CONSTRAINED_WINDOW_H_ | 5 #ifndef CHROME_BROWSER_UI_CONSTRAINED_WINDOW_H_ |
6 #define CHROME_BROWSER_UI_CONSTRAINED_WINDOW_H_ | 6 #define CHROME_BROWSER_UI_CONSTRAINED_WINDOW_H_ |
7 | 7 |
8 #include "build/build_config.h" | 8 #include "build/build_config.h" |
9 #include "third_party/skia/include/core/SkColor.h" | 9 #include "third_party/skia/include/core/SkColor.h" |
10 #include "ui/base/resource/resource_bundle.h" | 10 #include "ui/base/resource/resource_bundle.h" |
11 #include "ui/gfx/native_widget_types.h" | 11 #include "ui/gfx/native_widget_types.h" |
12 | 12 |
13 /////////////////////////////////////////////////////////////////////////////// | 13 /////////////////////////////////////////////////////////////////////////////// |
14 // ConstrainedWindow | 14 // ConstrainedWindow |
15 // | 15 // |
16 // This interface represents a window that is constrained to a | 16 // This interface represents a window that is constrained to a |
17 // WebContentsView's bounds. | 17 // WebContentsView's bounds. |
18 // | 18 // |
19 class ConstrainedWindow { | 19 class ConstrainedWindow { |
20 public: | 20 public: |
21 static const int kVerticalPadding = 14; // top/bottom padding. | 21 // The kTitleTopPadding is the padding between the top of the window and the |
Ben Goodger (Google)
2012/10/10 16:11:54
I would tend to put all of this in a file separate
please use gerrit instead
2012/10/10 19:12:58
Kenmoore@ has asked to use regular padding without
| |
22 static const int kHorizontalPadding = 17; // left/right padding. | 22 // title. The goal is to have 20px between the top of the window and the |
23 static const int kRowPadding = 20; // Vertical margin between dialog rows. | 23 // x-height of the message. |
24 static const int kBorderRadius = 2; // Border radius for dialog corners. | 24 // |
25 // The kVerticalPadding is the default padding beetween the buttons on the | |
26 // bottom of the window and the bottom border. | |
27 // | |
28 // The kHorizontalPadding is the default padding between the left size of the | |
29 // window and the contents; and between the right side of the window and the | |
30 // contents. | |
31 // | |
32 // The kRowPadding is the default padding between the window title and the | |
33 // message below. The goal is to have 20px between the base of the title and | |
34 // the x-height of the message. | |
35 // | |
36 // ______________________________________________________________________ | |
37 // | ^ ^ | |
38 // | | | | |
39 // | |--kTitleTopPadding | | |
40 // | kHorizontalPadding | | | |
41 // | | _________v_ |--20px | |
42 // |<--------->|____ ____| | | |
43 // | | | _ | | |
44 // | | | |_| _ _ | | |
45 // | | | _ _| |_ | | ____ _v__ _ _ _ _ x-height | |
46 // | | | | | |_ _| | | | _ | | | | |
47 // | | | | | | |_ | | | __| | [] | | |
48 // | |_| |_| |___| |_| |____| | __| _ _ _ _ baseline | |
49 // | _ _ _ _ _ _ _^_ _ _ _ _ _ _ |_| | |
50 // | ^ | | |
51 // | kRowPadding--| | | |
52 // | _ v |--20px | |
53 // | || || | | |
54 // | || || _ _ _ _v _ _ _ _ _ _ x-height | |
55 // | | \/ ||_ |_ |_ _|| ||_ | |
56 // | ||\/|||_ _| _||_||_||_ _ _ _ _ baseline | |
57 // | _| | |
58 // | |
59 static const int kTitleTopPadding = 15; | |
60 static const int kVerticalPadding = 20; | |
61 static const int kHorizontalPadding = 20; | |
62 static const int kRowPadding = 15; | |
Peter Kasting
2012/10/09 19:31:10
How can these values be guaranteed to be correct a
please use gerrit instead
2012/10/10 19:12:58
The author of the mocks (kenmoore@) has asked us t
| |
63 | |
64 // Border radius for dialog corners. | |
65 static const int kBorderRadius = 2; | |
66 | |
67 // This is the padding to use on the top and right sides of the "x" close | |
68 // button in order for the button to appear 10px from the top border and 10px | |
69 // from the right border. This padding is 4px because the image for the "x" | |
70 // close button has an invisible 6px border. | |
Peter Kasting
2012/10/09 19:31:10
Is this border so the button will have a larger hi
please use gerrit instead
2012/10/10 19:12:58
The border is so the button has a larger hit area.
| |
71 // | |
72 // _______________________________________________ | |
73 // ^ | | |
74 // 4px | | |
75 // v | | |
76 // ___________________ | | |
77 // | ^ | | | |
78 // | 6px | | | |
79 // | v | | | |
80 // | X < 6px > | < 4px > | | |
81 // | | | | |
82 // | | | | |
83 // |___________________| | | |
84 // | | |
85 // | |
86 static const int kCloseButtonPadding = 4; | |
25 | 87 |
26 // Font style for dialog text. | 88 // Font style for dialog text. |
27 static const ui::ResourceBundle::FontStyle kTextFontStyle = | 89 static const ui::ResourceBundle::FontStyle kTextFontStyle = |
28 ui::ResourceBundle::BaseFont; | 90 ui::ResourceBundle::BaseFont; |
29 // Font style for bold dialog text. | 91 // Font style for bold dialog text. |
30 static const ui::ResourceBundle::FontStyle kBoldTextFontStyle = | 92 static const ui::ResourceBundle::FontStyle kBoldTextFontStyle = |
31 ui::ResourceBundle::BoldFont; | 93 ui::ResourceBundle::BoldFont; |
32 // Font style for dialog title. | 94 // Font style for dialog title. |
33 static const ui::ResourceBundle::FontStyle kTitleFontStyle = | 95 static const ui::ResourceBundle::FontStyle kTitleFontStyle = |
34 ui::ResourceBundle::MediumFont; | 96 ui::ResourceBundle::MediumFont; |
(...skipping 21 matching lines...) Expand all Loading... | |
56 virtual bool CanShowConstrainedWindow(); | 118 virtual bool CanShowConstrainedWindow(); |
57 | 119 |
58 // Returns the native window of the constrained window. | 120 // Returns the native window of the constrained window. |
59 virtual gfx::NativeWindow GetNativeWindow(); | 121 virtual gfx::NativeWindow GetNativeWindow(); |
60 | 122 |
61 protected: | 123 protected: |
62 virtual ~ConstrainedWindow() {} | 124 virtual ~ConstrainedWindow() {} |
63 }; | 125 }; |
64 | 126 |
65 #endif // CHROME_BROWSER_UI_CONSTRAINED_WINDOW_H_ | 127 #endif // CHROME_BROWSER_UI_CONSTRAINED_WINDOW_H_ |
OLD | NEW |