summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorbenwells@chromium.org <benwells@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-05-01 10:38:36 +0000
committerbenwells@chromium.org <benwells@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-05-01 10:38:36 +0000
commit09f494a31ff3ea1acc6b0d7a4beec52c139e436c (patch)
tree5f48e4fdfdc91caa2a091417e41c8d2263432d0e /apps
parentd3c0222f2c0663456e86543313fc0420ee7416d6 (diff)
downloadchromium_src-09f494a31ff3ea1acc6b0d7a4beec52c139e436c.zip
chromium_src-09f494a31ff3ea1acc6b0d7a4beec52c139e436c.tar.gz
chromium_src-09f494a31ff3ea1acc6b0d7a4beec52c139e436c.tar.bz2
Support active / inactive frame colors for app window frames.
This adds two new options to the FrameOptions field, activeColor and inactiveColor. These cannot be set if color is also set. BUG=339558 Review URL: https://codereview.chromium.org/203913008 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@267505 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'apps')
-rw-r--r--apps/app_window.cc12
-rw-r--r--apps/app_window.h3
-rw-r--r--apps/ui/native_app_window.h3
-rw-r--r--apps/ui/views/app_window_frame_view.cc15
-rw-r--r--apps/ui/views/app_window_frame_view.h6
-rw-r--r--apps/ui/views/native_app_window_views.cc8
-rw-r--r--apps/ui/views/native_app_window_views.h3
7 files changed, 36 insertions, 14 deletions
diff --git a/apps/app_window.cc b/apps/app_window.cc
index efe31d2..cf20eea 100644
--- a/apps/app_window.cc
+++ b/apps/app_window.cc
@@ -709,7 +709,17 @@ void AppWindow::GetSerializedState(base::DictionaryValue* properties) const {
properties->SetBoolean("maximized", native_app_window_->IsMaximized());
properties->SetBoolean("alwaysOnTop", IsAlwaysOnTop());
properties->SetBoolean("hasFrameColor", native_app_window_->HasFrameColor());
- properties->SetInteger("frameColor", native_app_window_->FrameColor());
+
+ // These properties are undocumented and are to enable testing. Alpha is
+ // removed to
+ // make the values easier to check.
+ SkColor transparent_white = ~SK_ColorBLACK;
+ properties->SetInteger(
+ "activeFrameColor",
+ native_app_window_->ActiveFrameColor() & transparent_white);
+ properties->SetInteger(
+ "inactiveFrameColor",
+ native_app_window_->InactiveFrameColor() & transparent_white);
gfx::Rect content_bounds = GetClientBounds();
gfx::Size content_min_size = native_app_window_->GetContentMinimumSize();
diff --git a/apps/app_window.h b/apps/app_window.h
index cb9bf17..aecd250 100644
--- a/apps/app_window.h
+++ b/apps/app_window.h
@@ -142,7 +142,8 @@ class AppWindow : public content::NotificationObserver,
Frame frame;
bool has_frame_color;
- SkColor frame_color;
+ SkColor active_frame_color;
+ SkColor inactive_frame_color;
bool transparent_background; // Only supported on ash.
// The initial content/inner bounds specification (excluding any window
diff --git a/apps/ui/native_app_window.h b/apps/ui/native_app_window.h
index ba033a1..cde4c1d 100644
--- a/apps/ui/native_app_window.h
+++ b/apps/ui/native_app_window.h
@@ -60,7 +60,8 @@ class NativeAppWindow : public ui::BaseWindow,
// Returns information about the window's frame.
virtual bool HasFrameColor() const = 0;
- virtual SkColor FrameColor() const = 0;
+ virtual SkColor ActiveFrameColor() const = 0;
+ virtual SkColor InactiveFrameColor() const = 0;
// Returns the difference between the window bounds (including titlebar and
// borders) and the content bounds, if any.
diff --git a/apps/ui/views/app_window_frame_view.cc b/apps/ui/views/app_window_frame_view.cc
index 6a14e1f..db4d52b 100644
--- a/apps/ui/views/app_window_frame_view.cc
+++ b/apps/ui/views/app_window_frame_view.cc
@@ -39,11 +39,13 @@ const char AppWindowFrameView::kViewClassName[] =
AppWindowFrameView::AppWindowFrameView(views::Widget* widget,
NativeAppWindow* window,
bool draw_frame,
- const SkColor& frame_color)
+ const SkColor& active_frame_color,
+ const SkColor& inactive_frame_color)
: widget_(widget),
window_(window),
draw_frame_(draw_frame),
- frame_color_(frame_color),
+ active_frame_color_(active_frame_color),
+ inactive_frame_color_(inactive_frame_color),
close_button_(NULL),
maximize_button_(NULL),
restore_button_(NULL),
@@ -232,8 +234,6 @@ void AppWindowFrameView::GetWindowMask(const gfx::Size& size,
// We got nothing to say about no window mask.
}
-// views::View implementation.
-
gfx::Size AppWindowFrameView::GetPreferredSize() {
gfx::Size pref = widget_->client_view()->GetPreferredSize();
gfx::Rect bounds(0, 0, pref.width(), pref.height());
@@ -308,7 +308,10 @@ void AppWindowFrameView::OnPaint(gfx::Canvas* canvas) {
SkPaint paint;
paint.setAntiAlias(false);
paint.setStyle(SkPaint::kFill_Style);
- paint.setColor(frame_color_);
+ if (widget_->IsActive())
+ paint.setColor(active_frame_color_);
+ else
+ paint.setColor(inactive_frame_color_);
gfx::Path path;
path.moveTo(0, 0);
path.lineTo(width(), 0);
@@ -350,8 +353,6 @@ gfx::Size AppWindowFrameView::GetMaximumSize() {
return max_size;
}
-// views::ButtonListener implementation.
-
void AppWindowFrameView::ButtonPressed(views::Button* sender,
const ui::Event& event) {
DCHECK(draw_frame_);
diff --git a/apps/ui/views/app_window_frame_view.h b/apps/ui/views/app_window_frame_view.h
index 5f15431..a0fa71d 100644
--- a/apps/ui/views/app_window_frame_view.h
+++ b/apps/ui/views/app_window_frame_view.h
@@ -51,7 +51,8 @@ class AppWindowFrameView : public views::NonClientFrameView,
AppWindowFrameView(views::Widget* widget,
NativeAppWindow* window,
bool draw_frame,
- const SkColor& frame_color);
+ const SkColor& active_frame_color,
+ const SkColor& inactive_frame_color);
virtual ~AppWindowFrameView();
void Init();
@@ -90,7 +91,8 @@ class AppWindowFrameView : public views::NonClientFrameView,
views::Widget* widget_;
NativeAppWindow* window_;
bool draw_frame_;
- SkColor frame_color_;
+ SkColor active_frame_color_;
+ SkColor inactive_frame_color_;
views::ImageButton* close_button_;
views::ImageButton* maximize_button_;
views::ImageButton* restore_button_;
diff --git a/apps/ui/views/native_app_window_views.cc b/apps/ui/views/native_app_window_views.cc
index 304b1cf..04e7d9f 100644
--- a/apps/ui/views/native_app_window_views.cc
+++ b/apps/ui/views/native_app_window_views.cc
@@ -363,7 +363,13 @@ bool NativeAppWindowViews::IsFrameless() const { return frameless_; }
bool NativeAppWindowViews::HasFrameColor() const { return false; }
-SkColor NativeAppWindowViews::FrameColor() const { return SK_ColorBLACK; }
+SkColor NativeAppWindowViews::ActiveFrameColor() const {
+ return SK_ColorBLACK;
+}
+
+SkColor NativeAppWindowViews::InactiveFrameColor() const {
+ return SK_ColorBLACK;
+}
gfx::Insets NativeAppWindowViews::GetFrameInsets() const {
if (frameless_)
diff --git a/apps/ui/views/native_app_window_views.h b/apps/ui/views/native_app_window_views.h
index 47f4ba1..696cb2f 100644
--- a/apps/ui/views/native_app_window_views.h
+++ b/apps/ui/views/native_app_window_views.h
@@ -146,7 +146,8 @@ class NativeAppWindowViews : public NativeAppWindow,
const content::NativeWebKeyboardEvent& event) OVERRIDE;
virtual bool IsFrameless() const OVERRIDE;
virtual bool HasFrameColor() const OVERRIDE;
- virtual SkColor FrameColor() const OVERRIDE;
+ virtual SkColor ActiveFrameColor() const OVERRIDE;
+ virtual SkColor InactiveFrameColor() const OVERRIDE;
virtual gfx::Insets GetFrameInsets() const OVERRIDE;
virtual void HideWithApp() OVERRIDE;
virtual void ShowWithApp() OVERRIDE;