Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1093)

Unified Diff: chrome/browser/ui/views/apps/native_app_window_views.cc

Issue 166443004: Add frame color option to packaged app windows. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/views/apps/native_app_window_views.cc
diff --git a/chrome/browser/ui/views/apps/native_app_window_views.cc b/chrome/browser/ui/views/apps/native_app_window_views.cc
index 47a8ec649863fdd31be1a049203976e4497cb269..34a6ec942e9427de45a48b7921b804adca3a2f4b 100644
--- a/chrome/browser/ui/views/apps/native_app_window_views.cc
+++ b/chrome/browser/ui/views/apps/native_app_window_views.cc
@@ -253,6 +253,8 @@ void NativeAppWindowViews::Init(apps::AppWindow* app_window,
const AppWindow::CreateParams& create_params) {
app_window_ = app_window;
frameless_ = create_params.frame == AppWindow::FRAME_NONE;
+ has_frame_color_ = create_params.has_frame_color;
+ frame_color_ = create_params.frame_color;
transparent_background_ = create_params.transparent_background;
resizable_ = create_params.resizable;
Observe(web_contents());
@@ -289,7 +291,7 @@ void NativeAppWindowViews::InitializeDefaultWindow(
views::Widget::InitParams init_params(views::Widget::InitParams::TYPE_WINDOW);
init_params.delegate = this;
- init_params.remove_standard_frame = ShouldUseChromeStyleFrame();
+ init_params.remove_standard_frame = !ShouldUseNativeFrame();
#if defined(OS_LINUX) && !defined(OS_CHROMEOS)
// On Linux, remove the standard frame. Instead, we will use CustomFrameView
// to draw a native-like frame.
@@ -453,17 +455,8 @@ void NativeAppWindowViews::InitializePanelWindow(
#endif
}
-bool NativeAppWindowViews::ShouldUseChromeStyleFrame() const {
- if (frameless_)
- return true;
-
-#if defined(OS_LINUX) && !defined(OS_CHROMEOS)
- // Linux always uses native style frames.
- return false;
-#endif
-
- return !CommandLine::ForCurrentProcess()->HasSwitch(
- switches::kAppsUseNativeFrame);
+bool NativeAppWindowViews::ShouldUseNativeFrame() const {
Matt Giuca 2014/02/18 06:03:18 I'm concerned that this will break the --apps-use-
benwells 2014/02/18 07:47:25 Good one, done.
Matt Giuca 2014/02/19 02:26:43 So, to confirm: you're happy for stable channel us
+ return !frameless_ & !has_frame_color_;
}
apps::AppWindowFrameView* NativeAppWindowViews::CreateAppWindowFrameView() {
@@ -484,6 +477,7 @@ apps::AppWindowFrameView* NativeAppWindowViews::CreateAppWindowFrameView() {
#endif
apps::AppWindowFrameView* frame_view = new apps::AppWindowFrameView(this);
frame_view->Init(window_,
+ frame_color_,
resize_inside_bounds_size,
resize_outside_bounds_size,
resize_outside_scale_for_touch,
@@ -707,7 +701,7 @@ bool NativeAppWindowViews::CanMaximize() const {
}
base::string16 NativeAppWindowViews::GetWindowTitle() const {
- return app_window_->GetTitle();
+ return base::string16();
}
bool NativeAppWindowViews::ShouldShowWindowTitle() const {
@@ -799,7 +793,7 @@ views::NonClientFrameView* NativeAppWindowViews::CreateNonClientFrameView(
}
}
#endif
- if (ShouldUseChromeStyleFrame())
+ if (!ShouldUseNativeFrame())
return CreateAppWindowFrameView();
return views::WidgetDelegateView::CreateNonClientFrameView(widget);
}
@@ -1041,6 +1035,10 @@ bool NativeAppWindowViews::IsFrameless() const {
return frameless_;
}
+bool NativeAppWindowViews::HasFrameColor() const { return has_frame_color_; }
+
+SkColor NativeAppWindowViews::FrameColor() const { return frame_color_; }
+
gfx::Insets NativeAppWindowViews::GetFrameInsets() const {
if (frameless_)
return gfx::Insets();

Powered by Google App Engine
This is Rietveld 408576698