Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/chrome_native_app_window_views.h" | 5 #include "chrome/browser/ui/views/apps/chrome_native_app_window_views.h" |
| 6 | 6 |
| 7 #include "apps/ui/views/app_window_frame_view.h" | 7 #include "apps/ui/views/app_window_frame_view.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "chrome/app/chrome_command_ids.h" | 9 #include "chrome/app/chrome_command_ids.h" |
| 10 #include "chrome/browser/app_mode/app_mode_utils.h" | 10 #include "chrome/browser/app_mode/app_mode_utils.h" |
| (...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 259 else | 259 else |
| 260 widget()->SetBounds(window_bounds); | 260 widget()->SetBounds(window_bounds); |
| 261 } | 261 } |
| 262 | 262 |
| 263 if (IsFrameless() && | 263 if (IsFrameless() && |
| 264 init_params.opacity == views::Widget::InitParams::TRANSLUCENT_WINDOW) { | 264 init_params.opacity == views::Widget::InitParams::TRANSLUCENT_WINDOW) { |
| 265 // The given window is most likely not rectangular since it uses | 265 // The given window is most likely not rectangular since it uses |
| 266 // transparency and has no standard frame, don't show a shadow for it. | 266 // transparency and has no standard frame, don't show a shadow for it. |
| 267 // TODO(skuhne): If we run into an application which should have a shadow | 267 // TODO(skuhne): If we run into an application which should have a shadow |
| 268 // but does not have, a new attribute has to be added. | 268 // but does not have, a new attribute has to be added. |
| 269 #if defined(USE_AURA) | |
| 269 wm::SetShadowType(widget()->GetNativeWindow(), wm::SHADOW_TYPE_NONE); | 270 wm::SetShadowType(widget()->GetNativeWindow(), wm::SHADOW_TYPE_NONE); |
|
tapted
2015/02/20 07:50:29
I think we need a general fix for this.
Mac autom
jackhou1
2015/02/26 04:35:16
Done.
| |
| 271 #endif | |
| 270 } | 272 } |
| 271 | 273 |
| 272 #if defined(OS_CHROMEOS) | 274 #if defined(OS_CHROMEOS) |
| 273 if (create_params.is_ime_window) | 275 if (create_params.is_ime_window) |
| 274 return; | 276 return; |
| 275 #endif | 277 #endif |
| 276 | 278 |
| 277 // Register accelarators supported by app windows. | 279 // Register accelarators supported by app windows. |
| 278 // TODO(jeremya/stevenjb): should these be registered for panels too? | 280 // TODO(jeremya/stevenjb): should these be registered for panels too? |
| 279 views::FocusManager* focus_manager = GetFocusManager(); | 281 views::FocusManager* focus_manager = GetFocusManager(); |
| (...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 608 // specific, and lift this restriction. | 610 // specific, and lift this restriction. |
| 609 if (icon->Width() != icon->Height()) { | 611 if (icon->Width() != icon->Height()) { |
| 610 LOG(ERROR) << "Attempt to set a non-square badge; request ignored."; | 612 LOG(ERROR) << "Attempt to set a non-square badge; request ignored."; |
| 611 return; | 613 return; |
| 612 } | 614 } |
| 613 } | 615 } |
| 614 chrome::DrawTaskbarDecoration(GetNativeWindow(), icon); | 616 chrome::DrawTaskbarDecoration(GetNativeWindow(), icon); |
| 615 } | 617 } |
| 616 | 618 |
| 617 void ChromeNativeAppWindowViews::UpdateShape(scoped_ptr<SkRegion> region) { | 619 void ChromeNativeAppWindowViews::UpdateShape(scoped_ptr<SkRegion> region) { |
| 620 #if defined(USE_AURA) | |
|
tapted
2015/02/20 07:50:30
It's annoying... but I think we need to try to mak
jackhou1
2015/02/26 04:35:16
Done.
| |
| 618 bool had_shape = shape_; | 621 bool had_shape = shape_; |
| 622 #endif | |
| 619 shape_ = region.Pass(); | 623 shape_ = region.Pass(); |
| 620 | 624 |
| 625 #if defined(USE_AURA) | |
| 621 aura::Window* native_window = widget()->GetNativeWindow(); | 626 aura::Window* native_window = widget()->GetNativeWindow(); |
| 622 if (shape_) { | 627 if (shape_) { |
| 623 widget()->SetShape(new SkRegion(*shape_)); | 628 widget()->SetShape(new SkRegion(*shape_)); |
| 624 if (!had_shape) { | 629 if (!had_shape) { |
| 625 native_window->SetEventTargeter(scoped_ptr<ui::EventTargeter>( | 630 native_window->SetEventTargeter(scoped_ptr<ui::EventTargeter>( |
| 626 new ShapedAppWindowTargeter(native_window, this))); | 631 new ShapedAppWindowTargeter(native_window, this))); |
| 627 } | 632 } |
| 628 } else { | 633 } else { |
| 629 widget()->SetShape(NULL); | 634 widget()->SetShape(NULL); |
| 630 if (had_shape) | 635 if (had_shape) |
| 631 native_window->SetEventTargeter(scoped_ptr<ui::EventTargeter>()); | 636 native_window->SetEventTargeter(scoped_ptr<ui::EventTargeter>()); |
| 632 } | 637 } |
| 638 #endif | |
| 633 widget()->OnSizeConstraintsChanged(); | 639 widget()->OnSizeConstraintsChanged(); |
| 634 } | 640 } |
| 635 | 641 |
| 636 bool ChromeNativeAppWindowViews::HasFrameColor() const { | 642 bool ChromeNativeAppWindowViews::HasFrameColor() const { |
| 637 return has_frame_color_; | 643 return has_frame_color_; |
| 638 } | 644 } |
| 639 | 645 |
| 640 SkColor ChromeNativeAppWindowViews::ActiveFrameColor() const { | 646 SkColor ChromeNativeAppWindowViews::ActiveFrameColor() const { |
| 641 return active_frame_color_; | 647 return active_frame_color_; |
| 642 } | 648 } |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 687 #if defined(USE_ASH) | 693 #if defined(USE_ASH) |
| 688 // For Aura windows on the Ash desktop the sizes are different and the user | 694 // For Aura windows on the Ash desktop the sizes are different and the user |
| 689 // can resize the window from slightly outside the bounds as well. | 695 // can resize the window from slightly outside the bounds as well. |
| 690 if (chrome::IsNativeWindowInAsh(widget()->GetNativeWindow())) { | 696 if (chrome::IsNativeWindowInAsh(widget()->GetNativeWindow())) { |
| 691 frame->SetResizeSizes(ash::kResizeInsideBoundsSize, | 697 frame->SetResizeSizes(ash::kResizeInsideBoundsSize, |
| 692 ash::kResizeOutsideBoundsSize, | 698 ash::kResizeOutsideBoundsSize, |
| 693 ash::kResizeAreaCornerSize); | 699 ash::kResizeAreaCornerSize); |
| 694 } | 700 } |
| 695 #endif | 701 #endif |
| 696 | 702 |
| 697 #if !defined(OS_CHROMEOS) | 703 #if !defined(OS_CHROMEOS) && defined(USE_AURA) |
|
tapted
2015/02/20 07:50:30
If this moves to ChromeNativeAppWindowAura the #if
jackhou1
2015/02/26 04:35:16
Done.
| |
| 698 // For non-Ash windows, install an easy resize window targeter, which ensures | 704 // For non-Ash windows, install an easy resize window targeter, which ensures |
| 699 // that the root window (not the app) receives mouse events on the edges. | 705 // that the root window (not the app) receives mouse events on the edges. |
| 700 if (chrome::GetHostDesktopTypeForNativeWindow(widget()->GetNativeWindow()) != | 706 if (chrome::GetHostDesktopTypeForNativeWindow(widget()->GetNativeWindow()) != |
| 701 chrome::HOST_DESKTOP_TYPE_ASH) { | 707 chrome::HOST_DESKTOP_TYPE_ASH) { |
| 702 aura::Window* window = widget()->GetNativeWindow(); | 708 aura::Window* window = widget()->GetNativeWindow(); |
| 703 int resize_inside = frame->resize_inside_bounds_size(); | 709 int resize_inside = frame->resize_inside_bounds_size(); |
| 704 gfx::Insets inset( | 710 gfx::Insets inset( |
| 705 resize_inside, resize_inside, resize_inside, resize_inside); | 711 resize_inside, resize_inside, resize_inside, resize_inside); |
| 706 // Add the EasyResizeWindowTargeter on the window, not its root window. The | 712 // Add the EasyResizeWindowTargeter on the window, not its root window. The |
| 707 // root window does not have a delegate, which is needed to handle the event | 713 // root window does not have a delegate, which is needed to handle the event |
| 708 // in Linux. | 714 // in Linux. |
| 709 window->SetEventTargeter(scoped_ptr<ui::EventTargeter>( | 715 window->SetEventTargeter(scoped_ptr<ui::EventTargeter>( |
| 710 new wm::EasyResizeWindowTargeter(window, inset, inset))); | 716 new wm::EasyResizeWindowTargeter(window, inset, inset))); |
| 711 } | 717 } |
| 712 #endif | 718 #endif |
| 713 | 719 |
| 714 return frame; | 720 return frame; |
| 715 } | 721 } |
| OLD | NEW |