summaryrefslogtreecommitdiffstats
path: root/views
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
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')
-rw-r--r--views/controls/native/native_view_host.cc10
-rw-r--r--views/controls/tabbed_pane/tabbed_pane.h4
-rw-r--r--views/window/custom_frame_view.cc15
-rw-r--r--views/window/custom_frame_view.h5
-rw-r--r--views/window/window_delegate.h5
5 files changed, 35 insertions, 4 deletions
diff --git a/views/controls/native/native_view_host.cc b/views/controls/native/native_view_host.cc
index bf6dd7f..91f34c1 100644
--- a/views/controls/native/native_view_host.cc
+++ b/views/controls/native/native_view_host.cc
@@ -113,6 +113,16 @@ void NativeViewHost::Layout() {
}
void NativeViewHost::Paint(gfx::Canvas* canvas) {
+ // Paint background if there is one. NativeViewHost needs to paint
+ // a background when it is hosted in a TabbedPane. For Gtk implementation,
+ // NativeTabbedPaneGtk uses a WidgetGtk as page container and because
+ // WidgetGtk hook "expose" with its root view's paint, we need to
+ // fill the content. Otherwise, the tab page's background is not properly
+ // cleared. For Windows case, it appears okay to not paint background because
+ // we don't have a container window in-between. However if you want to use
+ // customized background, then this becomes necessary.
+ PaintBackground(canvas);
+
// The area behind our window is black, so during a fast resize (where our
// content doesn't draw over the full size of our native view, and the native
// view background color doesn't show up), we need to cover that blackness
diff --git a/views/controls/tabbed_pane/tabbed_pane.h b/views/controls/tabbed_pane/tabbed_pane.h
index abbb9fa..2fe503e 100644
--- a/views/controls/tabbed_pane/tabbed_pane.h
+++ b/views/controls/tabbed_pane/tabbed_pane.h
@@ -73,6 +73,10 @@ class TabbedPane : public View {
virtual void PaintFocusBorder(gfx::Canvas* canvas);
virtual bool GetAccessibleRole(AccessibilityTypes::Role* role);
+ NativeTabbedPaneWrapper* native_wrapper() const {
+ return native_tabbed_pane_;
+ }
+
protected:
// The object that actually implements the tabbed-pane.
// Protected for tests access.
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);
}
diff --git a/views/window/custom_frame_view.h b/views/window/custom_frame_view.h
index 5bb01a8..814a7a8 100644
--- a/views/window/custom_frame_view.h
+++ b/views/window/custom_frame_view.h
@@ -79,6 +79,10 @@ class CustomFrameView : public NonClientFrameView,
// there was one).
gfx::Rect IconBounds() const;
+ // Returns true if the client edge should be drawn. This is true if
+ // the window delegate wants a client edge and we are not maxmized.
+ bool ShouldShowClientEdge() const;
+
// Paint various sub-components of this view.
void PaintRestoredFrameBorder(gfx::Canvas* canvas);
void PaintMaximizedFrameBorder(gfx::Canvas* canvas);
@@ -103,6 +107,7 @@ class CustomFrameView : public NonClientFrameView,
ImageButton* minimize_button_;
ImageButton* window_icon_;
bool should_show_minmax_buttons_;
+ bool should_show_client_edge_;
// The window that owns this view.
Window* frame_;
diff --git a/views/window/window_delegate.h b/views/window/window_delegate.h
index a5a3e24..91491b9 100644
--- a/views/window/window_delegate.h
+++ b/views/window/window_delegate.h
@@ -68,6 +68,11 @@ class WindowDelegate {
return true;
}
+ // Returns true if the window's client view wants a client edge.
+ virtual bool ShouldShowClientEdge() const {
+ return true;
+ }
+
// Returns the app icon for the window. On Windows, this is the ICON_BIG used
// in Alt-Tab list and Win7's taskbar.
virtual SkBitmap GetWindowAppIcon();