diff options
author | benwells@chromium.org <benwells@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-02-21 14:30:25 +0000 |
---|---|---|
committer | benwells@chromium.org <benwells@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-02-21 14:30:25 +0000 |
commit | 7cccda1dbff37f3740ca5c5e06e4898db83e7722 (patch) | |
tree | 6bccd830ba0fc3f2fdf395fff1e2b0e44d19fb6d /apps | |
parent | 81f89e978e8d99c44027be184e48d3c86a498e4b (diff) | |
download | chromium_src-7cccda1dbff37f3740ca5c5e06e4898db83e7722.zip chromium_src-7cccda1dbff37f3740ca5c5e06e4898db83e7722.tar.gz chromium_src-7cccda1dbff37f3740ca5c5e06e4898db83e7722.tar.bz2 |
Add frame color option to packaged app windows.
If app windows are created with a frame color option, that color is used
for the frame. If no color is supplied a native style look is used
instead. This is currently implemented on linux aura and windows only.
This change also removes the --apps-use-native-frame flag on windows.
BUG=339558
Review URL: https://codereview.chromium.org/166443004
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@252548 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'apps')
-rw-r--r-- | apps/app_window.cc | 3 | ||||
-rw-r--r-- | apps/app_window.h | 3 | ||||
-rw-r--r-- | apps/ui/native_app_window.h | 5 | ||||
-rw-r--r-- | apps/ui/views/app_window_frame_view.cc | 7 | ||||
-rw-r--r-- | apps/ui/views/app_window_frame_view.h | 2 |
5 files changed, 18 insertions, 2 deletions
diff --git a/apps/app_window.cc b/apps/app_window.cc index 99198b0..1f0c945 100644 --- a/apps/app_window.cc +++ b/apps/app_window.cc @@ -123,6 +123,7 @@ void AppWindow::SizeConstraints::set_maximum_size(const gfx::Size& max_size) { AppWindow::CreateParams::CreateParams() : window_type(AppWindow::WINDOW_TYPE_DEFAULT), frame(AppWindow::FRAME_CHROME), + has_frame_color(false), transparent_background(false), bounds(INT_MIN, INT_MIN, 0, 0), creator_process_id(0), @@ -610,6 +611,8 @@ void AppWindow::GetSerializedState(base::DictionaryValue* properties) const { boundsValue->SetInteger("width", bounds.width()); boundsValue->SetInteger("height", bounds.height()); properties->Set("bounds", boundsValue.release()); + properties->SetBoolean("hasFrameColor", native_app_window_->HasFrameColor()); + properties->SetInteger("frameColor", native_app_window_->FrameColor()); const SizeConstraints& constraints = size_constraints(); gfx::Size min_size = constraints.GetMinimumSize(); diff --git a/apps/app_window.h b/apps/app_window.h index 46933c9..9551539 100644 --- a/apps/app_window.h +++ b/apps/app_window.h @@ -157,6 +157,9 @@ class AppWindow : public content::NotificationObserver, WindowType window_type; Frame frame; + + bool has_frame_color; + SkColor frame_color; bool transparent_background; // Only supported on ash. // Specify the initial content bounds of the window (excluding any window diff --git a/apps/ui/native_app_window.h b/apps/ui/native_app_window.h index 1668916..fe32f53 100644 --- a/apps/ui/native_app_window.h +++ b/apps/ui/native_app_window.h @@ -7,6 +7,7 @@ #include "apps/app_window.h" #include "components/web_modal/web_contents_modal_dialog_host.h" +#include "third_party/skia/include/core/SkColor.h" #include "ui/base/base_window.h" #include "ui/gfx/insets.h" @@ -57,6 +58,10 @@ class NativeAppWindow : public ui::BaseWindow, // chrome.app.window.create with the option 'frame' set to 'none'. virtual bool IsFrameless() const = 0; + // Returns information about the window's frame. + virtual bool HasFrameColor() const = 0; + virtual SkColor FrameColor() const = 0; + // Returns the difference between the window bounds (including titlebar and // borders) and the content bounds, if any. virtual gfx::Insets GetFrameInsets() const = 0; diff --git a/apps/ui/views/app_window_frame_view.cc b/apps/ui/views/app_window_frame_view.cc index a8c11c3..d981ee7 100644 --- a/apps/ui/views/app_window_frame_view.cc +++ b/apps/ui/views/app_window_frame_view.cc @@ -51,11 +51,13 @@ AppWindowFrameView::AppWindowFrameView(NativeAppWindow* window) AppWindowFrameView::~AppWindowFrameView() {} void AppWindowFrameView::Init(views::Widget* frame, + const SkColor& frame_color, int resize_inside_bounds_size, int resize_outside_bounds_size, int resize_outside_scale_for_touch, int resize_area_corner_size) { frame_ = frame; + frame_color_ = frame_color; resize_inside_bounds_size_ = resize_inside_bounds_size; resize_outside_bounds_size_ = resize_outside_bounds_size; resize_area_corner_size_ = resize_area_corner_size; @@ -156,11 +158,12 @@ int AppWindowFrameView::NonClientHitTest(const gfx::Point& point) { return HTCLIENT; gfx::Rect expanded_bounds = bounds(); - if (resize_outside_bounds_size_) + if (resize_outside_bounds_size_) { expanded_bounds.Inset(gfx::Insets(-resize_outside_bounds_size_, -resize_outside_bounds_size_, -resize_outside_bounds_size_, -resize_outside_bounds_size_)); + } // Points outside the (possibly expanded) bounds can be discarded. if (!expanded_bounds.Contains(point)) return HTNOWHERE; @@ -297,7 +300,7 @@ void AppWindowFrameView::OnPaint(gfx::Canvas* canvas) { SkPaint paint; paint.setAntiAlias(false); paint.setStyle(SkPaint::kFill_Style); - paint.setColor(SK_ColorWHITE); + paint.setColor(frame_color_); gfx::Path path; path.moveTo(0, 0); path.lineTo(width(), 0); diff --git a/apps/ui/views/app_window_frame_view.h b/apps/ui/views/app_window_frame_view.h index 77c3859..2be6161 100644 --- a/apps/ui/views/app_window_frame_view.h +++ b/apps/ui/views/app_window_frame_view.h @@ -44,6 +44,7 @@ class AppWindowFrameView : public views::NonClientFrameView, // which a click is interpreted as a resize for the inner and outer border of // the window and the lower-right corner resize handle. void Init(views::Widget* frame, + const SkColor& frame_color, int resize_inside_bounds_size, int resize_outside_bounds_size, int resize_outside_scale_for_touch, @@ -75,6 +76,7 @@ class AppWindowFrameView : public views::NonClientFrameView, NativeAppWindow* window_; views::Widget* frame_; + SkColor frame_color_; views::ImageButton* close_button_; views::ImageButton* maximize_button_; views::ImageButton* restore_button_; |