summaryrefslogtreecommitdiffstats
path: root/views/window/custom_frame_view.cc
diff options
context:
space:
mode:
authorxiyuan@chromium.org <xiyuan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-04-21 17:47:01 +0000
committerxiyuan@chromium.org <xiyuan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-04-21 17:47:01 +0000
commitb96f34ad357b1639f382c3764d9426efec4b2a52 (patch)
tree5b81b22737f0fac98bb260c886f67d4a809b71c0 /views/window/custom_frame_view.cc
parent145c762733827644c5e871c4357f6760f9a1a21e (diff)
downloadchromium_src-b96f34ad357b1639f382c3764d9426efec4b2a52.zip
chromium_src-b96f34ad357b1639f382c3764d9426efec4b2a52.tar.gz
chromium_src-b96f34ad357b1639f382c3764d9426efec4b2a52.tar.bz2
Polish ChromeOS options dialog:
- Add a chromeos OptionsWindowView that hosts options pages in a ChromeWindow so that it has a frame; This piece of code is based on Chrome's OptionsWindowView. Ideally, we should use Chrome's options view but we still missing underlying controls such as Tree and Table. - Use last active browser window as options dialog's parent; This makes optiosn dialog transient for the browser window and window manager will no longer treat it as top-level window and will not move and resize it; - If user switches to a new browser window and invokes options dialog again, close the existing one and re-opens it for the current browser window. This is currently supported by window manager; - Update CustomerFrameView and WindowDelegate to make client edge optionaly; Options dialog has no client area padding and does not have a client edge per UI mock; - Make NativeViewHost respects its background. This solves the problem that tab pane background is not properly cleared when hosting a native GtkVBox pane in TabbedPane; BUG=<http://crosbug.com/1885> TEST=Verify ChromeOS settings dialog looks like the mocks in http://www.chromium.org/chromium-os/user-experience/settings Review URL: http://codereview.chromium.org/1672003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@45204 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'views/window/custom_frame_view.cc')
-rw-r--r--views/window/custom_frame_view.cc15
1 files changed, 11 insertions, 4 deletions
diff --git a/views/window/custom_frame_view.cc b/views/window/custom_frame_view.cc
index 8bdb3c4..e67a5c2 100644
--- a/views/window/custom_frame_view.cc
+++ b/views/window/custom_frame_view.cc
@@ -70,6 +70,7 @@ CustomFrameView::CustomFrameView(Window* frame)
ALLOW_THIS_IN_INITIALIZER_LIST(minimize_button_(new ImageButton(this))),
window_icon_(NULL),
should_show_minmax_buttons_(false),
+ should_show_client_edge_(false),
frame_(frame) {
InitClass();
@@ -112,6 +113,7 @@ CustomFrameView::CustomFrameView(Window* frame)
views::WindowDelegate* d = frame_->GetDelegate();
should_show_minmax_buttons_ = d->CanMaximize();
+ should_show_client_edge_ = d->ShouldShowClientEdge();
if (d->ShouldShowWindowIcon()) {
window_icon_ = new ImageButton(this);
@@ -212,7 +214,7 @@ void CustomFrameView::Paint(gfx::Canvas* canvas) {
else
PaintRestoredFrameBorder(canvas);
PaintTitleBar(canvas);
- if (!frame_->IsMaximized())
+ if (ShouldShowClientEdge())
PaintRestoredClientEdge(canvas);
}
@@ -253,7 +255,7 @@ int CustomFrameView::FrameBorderThickness() const {
int CustomFrameView::NonClientBorderThickness() const {
// In maximized mode, we don't show a client edge.
return FrameBorderThickness() +
- (frame_->IsMaximized() ? 0 : kClientEdgeThickness);
+ (ShouldShowClientEdge() ? kClientEdgeThickness : 0);
}
int CustomFrameView::NonClientTopBorderHeight() const {
@@ -270,7 +272,7 @@ int CustomFrameView::CaptionButtonY() const {
int CustomFrameView::TitlebarBottomThickness() const {
return kTitlebarTopAndBottomEdgeThickness +
- (frame_->IsMaximized() ? 0 : kClientEdgeThickness);
+ (ShouldShowClientEdge() ? kClientEdgeThickness : 0);
}
int CustomFrameView::IconSize() const {
@@ -283,6 +285,10 @@ int CustomFrameView::IconSize() const {
#endif
}
+bool CustomFrameView::ShouldShowClientEdge() const {
+ return should_show_client_edge_ && !frame_->IsMaximized();
+}
+
gfx::Rect CustomFrameView::IconBounds() const {
int size = IconSize();
int frame_thickness = FrameBorderThickness();
@@ -390,7 +396,8 @@ void CustomFrameView::PaintMaximizedFrameBorder(gfx::Canvas* canvas) {
// The bottom of the titlebar actually comes from the top of the Client Edge
// graphic, with the actual client edge clipped off the bottom.
SkBitmap* titlebar_bottom = rb.GetBitmapNamed(IDR_APP_TOP_CENTER);
- int edge_height = titlebar_bottom->height() - kClientEdgeThickness;
+ int edge_height = titlebar_bottom->height() -
+ ShouldShowClientEdge() ? kClientEdgeThickness : 0;
canvas->TileImageInt(*titlebar_bottom, 0,
frame_->GetClientView()->y() - edge_height, width(), edge_height);
}