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

Side by Side Diff: chrome/browser/ui/views/apps/chrome_native_app_window_views.cc

Issue 456943004: Fix SetShape (SetAlphaShape) to allow Null regions (+ tests). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 4 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 643 matching lines...) Expand 10 before | Expand all | Expand 10 after
654 chrome::DrawTaskbarDecoration(GetNativeWindow(), icon); 654 chrome::DrawTaskbarDecoration(GetNativeWindow(), icon);
655 } 655 }
656 656
657 void ChromeNativeAppWindowViews::UpdateShape(scoped_ptr<SkRegion> region) { 657 void ChromeNativeAppWindowViews::UpdateShape(scoped_ptr<SkRegion> region) {
658 bool had_shape = shape_; 658 bool had_shape = shape_;
659 shape_ = region.Pass(); 659 shape_ = region.Pass();
660 660
661 aura::Window* native_window = widget()->GetNativeWindow(); 661 aura::Window* native_window = widget()->GetNativeWindow();
662 if (shape_) { 662 if (shape_) {
663 widget()->SetShape(new SkRegion(*shape_)); 663 widget()->SetShape(new SkRegion(*shape_));
664 native_window->layer()->SetAlphaShape(
sky 2014/08/11 15:26:37 Why don't we implement this in the NativeWidget im
garykac 2014/08/11 18:19:09 I'm not sure - the original implementation was don
Zachary Kuznia 2014/08/11 20:05:14 The SetShape() function didn't exist on widget whe
665 make_scoped_ptr(new SkRegion(*shape_)));
664 if (!had_shape) { 666 if (!had_shape) {
665 native_window->SetEventTargeter(scoped_ptr<ui::EventTargeter>( 667 native_window->SetEventTargeter(scoped_ptr<ui::EventTargeter>(
666 new ShapedAppWindowTargeter(native_window, this))); 668 new ShapedAppWindowTargeter(native_window, this)));
667 } 669 }
668 } else { 670 } else {
669 widget()->SetShape(NULL); 671 widget()->SetShape(NULL);
672 native_window->layer()->SetAlphaShape(scoped_ptr<SkRegion>());
670 if (had_shape) 673 if (had_shape)
671 native_window->SetEventTargeter(scoped_ptr<ui::EventTargeter>()); 674 native_window->SetEventTargeter(scoped_ptr<ui::EventTargeter>());
672 } 675 }
673 } 676 }
674 677
675 bool ChromeNativeAppWindowViews::HasFrameColor() const { 678 bool ChromeNativeAppWindowViews::HasFrameColor() const {
676 return has_frame_color_; 679 return has_frame_color_;
677 } 680 }
678 681
679 SkColor ChromeNativeAppWindowViews::ActiveFrameColor() const { 682 SkColor ChromeNativeAppWindowViews::ActiveFrameColor() const {
(...skipping 18 matching lines...) Expand all
698 InitializePanelWindow(create_params); 701 InitializePanelWindow(create_params);
699 } else { 702 } else {
700 InitializeDefaultWindow(create_params); 703 InitializeDefaultWindow(create_params);
701 } 704 }
702 extension_keybinding_registry_.reset(new ExtensionKeybindingRegistryViews( 705 extension_keybinding_registry_.reset(new ExtensionKeybindingRegistryViews(
703 Profile::FromBrowserContext(app_window->browser_context()), 706 Profile::FromBrowserContext(app_window->browser_context()),
704 widget()->GetFocusManager(), 707 widget()->GetFocusManager(),
705 extensions::ExtensionKeybindingRegistry::PLATFORM_APPS_ONLY, 708 extensions::ExtensionKeybindingRegistry::PLATFORM_APPS_ONLY,
706 NULL)); 709 NULL));
707 } 710 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698