| 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 510 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 779 new ash::ImmersiveFullscreenController()); | 787 new ash::ImmersiveFullscreenController()); |
| 780 custom_frame_view->InitImmersiveFullscreenControllerForView( | 788 custom_frame_view->InitImmersiveFullscreenControllerForView( |
| 781 immersive_fullscreen_controller_.get()); | 789 immersive_fullscreen_controller_.get()); |
| 782 } | 790 } |
| 783 #endif | 791 #endif |
| 784 custom_frame_view->GetHeaderView()->set_context_menu_controller(this); | 792 custom_frame_view->GetHeaderView()->set_context_menu_controller(this); |
| 785 return custom_frame_view; | 793 return custom_frame_view; |
| 786 } | 794 } |
| 787 } | 795 } |
| 788 #endif | 796 #endif |
| 797 |
| 798 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) |
| 799 // If using the system title bar, we need a ShellWindowFrameView instead of a |
| 800 // CustomFrameView. The ShellWindowFrameView will not draw its own frame. |
| 801 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kUseSystemTitleBar)) |
| 802 return CreateShellWindowFrameView(); |
| 803 #endif |
| 804 |
| 789 if (ShouldUseChromeStyleFrame()) | 805 if (ShouldUseChromeStyleFrame()) |
| 790 return CreateShellWindowFrameView(); | 806 return CreateShellWindowFrameView(); |
| 791 return views::WidgetDelegateView::CreateNonClientFrameView(widget); | 807 return views::WidgetDelegateView::CreateNonClientFrameView(widget); |
| 792 } | 808 } |
| 793 | 809 |
| 794 bool NativeAppWindowViews::WidgetHasHitTestMask() const { | 810 bool NativeAppWindowViews::WidgetHasHitTestMask() const { |
| 795 return shape_ != NULL; | 811 return shape_ != NULL; |
| 796 } | 812 } |
| 797 | 813 |
| 798 void NativeAppWindowViews::GetWidgetHitTestMask(gfx::Path* mask) const { | 814 void NativeAppWindowViews::GetWidgetHitTestMask(gfx::Path* mask) const { |
| (...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1005 gfx::Rect client_bounds = gfx::Rect(1000, 1000); | 1021 gfx::Rect client_bounds = gfx::Rect(1000, 1000); |
| 1006 gfx::Rect window_bounds = | 1022 gfx::Rect window_bounds = |
| 1007 window_->non_client_view()->GetWindowBoundsForClientBounds( | 1023 window_->non_client_view()->GetWindowBoundsForClientBounds( |
| 1008 client_bounds); | 1024 client_bounds); |
| 1009 return window_bounds.InsetsFrom(client_bounds); | 1025 return window_bounds.InsetsFrom(client_bounds); |
| 1010 } | 1026 } |
| 1011 | 1027 |
| 1012 void NativeAppWindowViews::HideWithApp() {} | 1028 void NativeAppWindowViews::HideWithApp() {} |
| 1013 void NativeAppWindowViews::ShowWithApp() {} | 1029 void NativeAppWindowViews::ShowWithApp() {} |
| 1014 void NativeAppWindowViews::UpdateWindowMinMaxSize() {} | 1030 void NativeAppWindowViews::UpdateWindowMinMaxSize() {} |
| OLD | NEW |