OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/ui/views/apps/native_app_window_views.h" | 5 #include "chrome/browser/ui/views/apps/native_app_window_views.h" |
6 | 6 |
7 #include "apps/shell_window.h" | 7 #include "apps/shell_window.h" |
8 #include "apps/ui/views/shell_window_frame_view.h" | 8 #include "apps/ui/views/shell_window_frame_view.h" |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
249 views::Widget* widget) {} | 249 views::Widget* widget) {} |
250 | 250 |
251 void NativeAppWindowViews::InitializeDefaultWindow( | 251 void NativeAppWindowViews::InitializeDefaultWindow( |
252 const ShellWindow::CreateParams& create_params) { | 252 const ShellWindow::CreateParams& create_params) { |
253 std::string app_name = | 253 std::string app_name = |
254 web_app::GenerateApplicationNameFromExtensionId(extension()->id()); | 254 web_app::GenerateApplicationNameFromExtensionId(extension()->id()); |
255 | 255 |
256 views::Widget::InitParams init_params(views::Widget::InitParams::TYPE_WINDOW); | 256 views::Widget::InitParams init_params(views::Widget::InitParams::TYPE_WINDOW); |
257 init_params.delegate = this; | 257 init_params.delegate = this; |
258 init_params.remove_standard_frame = ShouldUseChromeStyleFrame(); | 258 init_params.remove_standard_frame = ShouldUseChromeStyleFrame(); |
| 259 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) |
| 260 // If not using system title bars on Linux, remove the standard frame. |
| 261 // Instead, we will use CustomFrameView to draw a native-like frame. |
| 262 if (!CommandLine::ForCurrentProcess()->HasSwitch( |
| 263 switches::kUseSystemTitleBar)) { |
| 264 init_params.remove_standard_frame = true; |
| 265 } |
| 266 #endif |
259 init_params.use_system_default_icon = true; | 267 init_params.use_system_default_icon = true; |
260 // TODO(erg): Conceptually, these are toplevel windows, but we theoretically | 268 // TODO(erg): Conceptually, these are toplevel windows, but we theoretically |
261 // could plumb context through to here in some cases. | 269 // could plumb context through to here in some cases. |
262 init_params.top_level = true; | 270 init_params.top_level = true; |
263 if (create_params.transparent_background) | 271 if (create_params.transparent_background) |
264 init_params.opacity = views::Widget::InitParams::TRANSLUCENT_WINDOW; | 272 init_params.opacity = views::Widget::InitParams::TRANSLUCENT_WINDOW; |
265 init_params.keep_on_top = create_params.always_on_top; | 273 init_params.keep_on_top = create_params.always_on_top; |
266 gfx::Rect window_bounds = create_params.bounds; | 274 gfx::Rect window_bounds = create_params.bounds; |
267 bool position_specified = | 275 bool position_specified = |
268 window_bounds.x() != INT_MIN && window_bounds.y() != INT_MIN; | 276 window_bounds.x() != INT_MIN && window_bounds.y() != INT_MIN; |
(...skipping 518 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
787 new ash::ImmersiveFullscreenController()); | 795 new ash::ImmersiveFullscreenController()); |
788 custom_frame_view->InitImmersiveFullscreenControllerForView( | 796 custom_frame_view->InitImmersiveFullscreenControllerForView( |
789 immersive_fullscreen_controller_.get()); | 797 immersive_fullscreen_controller_.get()); |
790 } | 798 } |
791 #endif | 799 #endif |
792 custom_frame_view->GetHeaderView()->set_context_menu_controller(this); | 800 custom_frame_view->GetHeaderView()->set_context_menu_controller(this); |
793 return custom_frame_view; | 801 return custom_frame_view; |
794 } | 802 } |
795 } | 803 } |
796 #endif | 804 #endif |
| 805 |
| 806 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) |
| 807 // If using the system title bar, we need a ShellWindowFrameView instead of a |
| 808 // CustomFrameView. The ShellWindowFrameView will not draw its own frame. |
| 809 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kUseSystemTitleBar)) |
| 810 return CreateShellWindowFrameView(); |
| 811 #endif |
| 812 |
797 if (ShouldUseChromeStyleFrame()) | 813 if (ShouldUseChromeStyleFrame()) |
798 return CreateShellWindowFrameView(); | 814 return CreateShellWindowFrameView(); |
799 return views::WidgetDelegateView::CreateNonClientFrameView(widget); | 815 return views::WidgetDelegateView::CreateNonClientFrameView(widget); |
800 } | 816 } |
801 | 817 |
802 bool NativeAppWindowViews::WidgetHasHitTestMask() const { | 818 bool NativeAppWindowViews::WidgetHasHitTestMask() const { |
803 return shape_ != NULL; | 819 return shape_ != NULL; |
804 } | 820 } |
805 | 821 |
806 void NativeAppWindowViews::GetWidgetHitTestMask(gfx::Path* mask) const { | 822 void NativeAppWindowViews::GetWidgetHitTestMask(gfx::Path* mask) const { |
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1013 gfx::Rect client_bounds = gfx::Rect(1000, 1000); | 1029 gfx::Rect client_bounds = gfx::Rect(1000, 1000); |
1014 gfx::Rect window_bounds = | 1030 gfx::Rect window_bounds = |
1015 window_->non_client_view()->GetWindowBoundsForClientBounds( | 1031 window_->non_client_view()->GetWindowBoundsForClientBounds( |
1016 client_bounds); | 1032 client_bounds); |
1017 return window_bounds.InsetsFrom(client_bounds); | 1033 return window_bounds.InsetsFrom(client_bounds); |
1018 } | 1034 } |
1019 | 1035 |
1020 void NativeAppWindowViews::HideWithApp() {} | 1036 void NativeAppWindowViews::HideWithApp() {} |
1021 void NativeAppWindowViews::ShowWithApp() {} | 1037 void NativeAppWindowViews::ShowWithApp() {} |
1022 void NativeAppWindowViews::UpdateWindowMinMaxSize() {} | 1038 void NativeAppWindowViews::UpdateWindowMinMaxSize() {} |
OLD | NEW |