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

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

Issue 137403005: Remove some code inside USE_AURA and OS_WIN ifdefs. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 6 years, 11 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 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 605 matching lines...) Expand 10 before | Expand all | Expand 10 after
616 observer_list_.AddObserver(observer); 616 observer_list_.AddObserver(observer);
617 } 617 }
618 void NativeAppWindowViews::RemoveObserver( 618 void NativeAppWindowViews::RemoveObserver(
619 web_modal::ModalDialogHostObserver* observer) { 619 web_modal::ModalDialogHostObserver* observer) {
620 observer_list_.RemoveObserver(observer); 620 observer_list_.RemoveObserver(observer);
621 } 621 }
622 622
623 // Private method. TODO(stevenjb): Move this below InitializePanelWindow() 623 // Private method. TODO(stevenjb): Move this below InitializePanelWindow()
624 // to match declaration order. 624 // to match declaration order.
625 void NativeAppWindowViews::OnViewWasResized() { 625 void NativeAppWindowViews::OnViewWasResized() {
626 // TODO(jeremya): this doesn't seem like a terribly elegant way to keep the
627 // window shape in sync.
628 #if defined(OS_WIN) && !defined(USE_AURA)
629 DCHECK(window_);
630 DCHECK(web_view_);
631 gfx::Size sz = web_view_->size();
632 int height = sz.height(), width = sz.width();
633 if (ShouldUseChromeStyleFrame()) {
634 // Set the window shape of the RWHV.
635 const int kCornerRadius = 1;
636 gfx::Path path;
637 if (window_->IsMaximized() || window_->IsFullscreen()) {
638 // Don't round the corners when the window is maximized or fullscreen.
639 path.addRect(0, 0, width, height);
640 } else {
641 if (frameless_) {
642 path.moveTo(0, kCornerRadius);
643 path.lineTo(kCornerRadius, 0);
644 path.lineTo(width - kCornerRadius, 0);
645 path.lineTo(width, kCornerRadius);
646 } else {
647 // Don't round the top corners in chrome-style frame mode.
648 path.moveTo(0, 0);
649 path.lineTo(width, 0);
650 }
651 path.lineTo(width, height - kCornerRadius - 1);
652 path.lineTo(width - kCornerRadius - 1, height);
653 path.lineTo(kCornerRadius + 1, height);
654 path.lineTo(0, height - kCornerRadius - 1);
655 path.close();
656 }
657 SetWindowRgn(web_contents()->GetView()->GetNativeView(),
658 path.CreateNativeRegion(), 1);
659 }
660
661 SkRegion* rgn = new SkRegion;
662 if (!window_->IsFullscreen()) {
663 if (draggable_region_)
664 rgn->op(*draggable_region_, SkRegion::kUnion_Op);
665 if (!window_->IsMaximized()) {
666 if (frameless_)
667 rgn->op(0, 0, width, kResizeInsideBoundsSize, SkRegion::kUnion_Op);
668 rgn->op(0, 0, kResizeInsideBoundsSize, height, SkRegion::kUnion_Op);
669 rgn->op(width - kResizeInsideBoundsSize, 0, width, height,
670 SkRegion::kUnion_Op);
671 rgn->op(0, height - kResizeInsideBoundsSize, width, height,
672 SkRegion::kUnion_Op);
673 }
674 }
675 if (web_contents()->GetRenderViewHost()->GetView())
676 web_contents()->GetRenderViewHost()->GetView()->SetClickthroughRegion(rgn);
677 #endif
678
679 FOR_EACH_OBSERVER(web_modal::ModalDialogHostObserver, 626 FOR_EACH_OBSERVER(web_modal::ModalDialogHostObserver,
680 observer_list_, 627 observer_list_,
681 OnPositionRequiresUpdate()); 628 OnPositionRequiresUpdate());
682 } 629 }
683 630
684 // WidgetDelegate implementation. 631 // WidgetDelegate implementation.
685 632
686 void NativeAppWindowViews::OnWidgetMove() { 633 void NativeAppWindowViews::OnWidgetMove() {
687 shell_window_->OnNativeWindowChanged(); 634 shell_window_->OnNativeWindowChanged();
688 } 635 }
(...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after
1013 gfx::Rect client_bounds = gfx::Rect(1000, 1000); 960 gfx::Rect client_bounds = gfx::Rect(1000, 1000);
1014 gfx::Rect window_bounds = 961 gfx::Rect window_bounds =
1015 window_->non_client_view()->GetWindowBoundsForClientBounds( 962 window_->non_client_view()->GetWindowBoundsForClientBounds(
1016 client_bounds); 963 client_bounds);
1017 return window_bounds.InsetsFrom(client_bounds); 964 return window_bounds.InsetsFrom(client_bounds);
1018 } 965 }
1019 966
1020 void NativeAppWindowViews::HideWithApp() {} 967 void NativeAppWindowViews::HideWithApp() {}
1021 void NativeAppWindowViews::ShowWithApp() {} 968 void NativeAppWindowViews::ShowWithApp() {}
1022 void NativeAppWindowViews::UpdateWindowMinMaxSize() {} 969 void NativeAppWindowViews::UpdateWindowMinMaxSize() {}
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698