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

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: Rebase 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
« no previous file with comments | « chrome/browser/ui/views/apps/native_app_window_views.h ('k') | chrome/common/extensions/api/app_window.idl » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 e465d1f5aff353b6f0ca90cd952c81184c2aa00d..eb886b4bfd28f34561445757d0944852dd877a88 100644
--- a/chrome/browser/ui/views/apps/native_app_window_views.cc
+++ b/chrome/browser/ui/views/apps/native_app_window_views.cc
@@ -211,6 +211,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());
@@ -232,7 +234,7 @@ void NativeAppWindowViews::Init(apps::AppWindow* app_window,
window_->AddObserver(this);
#if defined(OS_WIN)
- if (ShouldUseChromeStyleFrame() &&
+ if (ShouldUseNativeFrame() &&
chrome::GetHostDesktopTypeForNativeWindow(window_->GetNativeWindow()) !=
chrome::HOST_DESKTOP_TYPE_ASH) {
InstallEasyResizeTargeterOnContainer();
@@ -255,7 +257,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.
@@ -376,17 +378,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 {
+ return !frameless_ & !has_frame_color_;
}
void NativeAppWindowViews::InstallEasyResizeTargeterOnContainer() const {
@@ -415,6 +408,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,
@@ -638,7 +632,7 @@ bool NativeAppWindowViews::CanMaximize() const {
}
base::string16 NativeAppWindowViews::GetWindowTitle() const {
- return app_window_->GetTitle();
+ return base::string16();
}
bool NativeAppWindowViews::ShouldShowWindowTitle() const {
@@ -730,7 +724,7 @@ views::NonClientFrameView* NativeAppWindowViews::CreateNonClientFrameView(
}
}
#endif
- if (ShouldUseChromeStyleFrame())
+ if (!ShouldUseNativeFrame())
return CreateAppWindowFrameView();
return views::WidgetDelegateView::CreateNonClientFrameView(widget);
}
@@ -972,6 +966,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();
« no previous file with comments | « chrome/browser/ui/views/apps/native_app_window_views.h ('k') | chrome/common/extensions/api/app_window.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698