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

Side by Side Diff: chrome/browser/ui/views/constrained_window_views.cc

Issue 11044020: Make Web Intents picker in Views conform to latest mocks (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Include changes from CL 11077006 Created 8 years, 2 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/constrained_window_views.h" 5 #include "chrome/browser/ui/views/constrained_window_views.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/utf_string_conversions.h" 10 #include "base/utf_string_conversions.h"
(...skipping 566 matching lines...) Expand 10 before | Expand all | Expand 10 after
577 577
578 //////////////////////////////////////////////////////////////////////////////// 578 ////////////////////////////////////////////////////////////////////////////////
579 // ConstrainedWindowViews, public: 579 // ConstrainedWindowViews, public:
580 580
581 ConstrainedWindowViews::ConstrainedWindowViews( 581 ConstrainedWindowViews::ConstrainedWindowViews(
582 content::WebContents* web_contents, 582 content::WebContents* web_contents,
583 views::WidgetDelegate* widget_delegate, 583 views::WidgetDelegate* widget_delegate,
584 bool enable_chrome_style) 584 bool enable_chrome_style)
585 : WebContentsObserver(web_contents), 585 : WebContentsObserver(web_contents),
586 web_contents_(web_contents), 586 web_contents_(web_contents),
587 ALLOW_THIS_IN_INITIALIZER_LIST(native_constrained_window_( 587 enable_chrome_style_(enable_chrome_style),
588 NativeConstrainedWindow::CreateNativeConstrainedWindow(this))), 588 custom_client_insets_(false) {
589 enable_chrome_style_(enable_chrome_style) { 589 InitConstrainedWindowViews(widget_delegate);
590 }
591
592 ConstrainedWindowViews::ConstrainedWindowViews(
593 content::WebContents* web_contents,
594 views::WidgetDelegate* widget_delegate,
595 bool enable_chrome_style,
596 const gfx::Insets& client_insets)
597 : WebContentsObserver(web_contents),
598 web_contents_(web_contents),
599 enable_chrome_style_(enable_chrome_style),
600 custom_client_insets_(true),
601 client_insets_(client_insets) {
602 InitConstrainedWindowViews(widget_delegate);
603 }
604
605 void ConstrainedWindowViews::InitConstrainedWindowViews(
606 views::WidgetDelegate* widget_delegate) {
607 native_constrained_window_ =
608 NativeConstrainedWindow::CreateNativeConstrainedWindow(this);
590 views::Widget::InitParams params(views::Widget::InitParams::TYPE_WINDOW); 609 views::Widget::InitParams params(views::Widget::InitParams::TYPE_WINDOW);
591 params.delegate = widget_delegate; 610 params.delegate = widget_delegate;
592 params.native_widget = native_constrained_window_->AsNativeWidget(); 611 params.native_widget = native_constrained_window_->AsNativeWidget();
593 params.child = true; 612 params.child = true;
594 613
595 if (enable_chrome_style_) { 614 if (enable_chrome_style_) {
596 params.parent_widget = Widget::GetTopLevelWidgetForNativeView( 615 params.parent_widget = Widget::GetTopLevelWidgetForNativeView(
597 web_contents->GetView()->GetNativeView()); 616 web_contents_->GetView()->GetNativeView());
598 } else { 617 } else {
599 params.parent = web_contents->GetNativeView(); 618 params.parent = web_contents_->GetNativeView();
600 } 619 }
601 620
602 #if defined(USE_ASH) 621 #if defined(USE_ASH)
603 // Ash window headers can be transparent. 622 // Ash window headers can be transparent.
604 params.transparent = true; 623 params.transparent = true;
605 ash::SetChildWindowVisibilityChangesAnimated(params.GetParent()); 624 ash::SetChildWindowVisibilityChangesAnimated(params.GetParent());
606 // No animations should get performed on the window since that will re-order 625 // No animations should get performed on the window since that will re-order
607 // the window stack which will then cause many problems. 626 // the window stack which will then cause many problems.
608 if (params.parent && params.parent->parent()) { 627 if (params.parent && params.parent->parent()) {
609 params.parent->parent()->SetProperty(aura::client::kAnimationsDisabledKey, 628 params.parent->parent()->SetProperty(aura::client::kAnimationsDisabledKey,
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
688 // ConstrainedWindowViews, views::Widget overrides: 707 // ConstrainedWindowViews, views::Widget overrides:
689 708
690 void ConstrainedWindowViews::CenterWindow(const gfx::Size& size) { 709 void ConstrainedWindowViews::CenterWindow(const gfx::Size& size) {
691 Widget::CenterWindow(size); 710 Widget::CenterWindow(size);
692 if (enable_chrome_style_) 711 if (enable_chrome_style_)
693 PositionChromeStyleWindow(); 712 PositionChromeStyleWindow();
694 } 713 }
695 714
696 views::NonClientFrameView* ConstrainedWindowViews::CreateNonClientFrameView() { 715 views::NonClientFrameView* ConstrainedWindowViews::CreateNonClientFrameView() {
697 if (enable_chrome_style_) { 716 if (enable_chrome_style_) {
698 return new ConstrainedWindowFrameSimple(this); 717 ConstrainedWindowFrameSimple* frame =
718 new ConstrainedWindowFrameSimple(this);
719 if (custom_client_insets_) {
720 frame->set_border(views::Border::CreateEmptyBorder(
721 client_insets_.top(),
722 client_insets_.left(),
723 client_insets_.bottom(),
724 client_insets_.right()));
725 }
726 return frame;
699 } else { 727 } else {
700 #if defined(USE_ASH) 728 #if defined(USE_ASH)
701 CommandLine* command_line = CommandLine::ForCurrentProcess(); 729 CommandLine* command_line = CommandLine::ForCurrentProcess();
702 if (command_line->HasSwitch(ash::switches::kAuraGoogleDialogFrames)) 730 if (command_line->HasSwitch(ash::switches::kAuraGoogleDialogFrames))
703 return ash::Shell::GetInstance()->CreateDefaultNonClientFrameView(this); 731 return ash::Shell::GetInstance()->CreateDefaultNonClientFrameView(this);
704 ConstrainedWindowFrameViewAsh* frame = new ConstrainedWindowFrameViewAsh; 732 ConstrainedWindowFrameViewAsh* frame = new ConstrainedWindowFrameViewAsh;
705 frame->Init(this); 733 frame->Init(this);
706 return frame; 734 return frame;
707 #endif 735 #endif
708 return new ConstrainedWindowFrameView(this); 736 return new ConstrainedWindowFrameView(this);
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
747 } 775 }
748 } 776 }
749 777
750 //////////////////////////////////////////////////////////////////////////////// 778 ////////////////////////////////////////////////////////////////////////////////
751 // ConstrainedWindowViews, content::WebContentsObserver implementation: 779 // ConstrainedWindowViews, content::WebContentsObserver implementation:
752 780
753 void ConstrainedWindowViews::WebContentsDestroyed( 781 void ConstrainedWindowViews::WebContentsDestroyed(
754 content::WebContents* web_contents) { 782 content::WebContents* web_contents) {
755 web_contents_ = NULL; 783 web_contents_ = NULL;
756 } 784 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698