OLD | NEW |
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/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
10 #include "chrome/app/chrome_command_ids.h" | 10 #include "chrome/app/chrome_command_ids.h" |
(...skipping 548 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
559 TabContentsWrapper* wrapper, | 559 TabContentsWrapper* wrapper, |
560 views::WidgetDelegate* widget_delegate) | 560 views::WidgetDelegate* widget_delegate) |
561 : wrapper_(wrapper), | 561 : wrapper_(wrapper), |
562 ALLOW_THIS_IN_INITIALIZER_LIST(native_constrained_window_( | 562 ALLOW_THIS_IN_INITIALIZER_LIST(native_constrained_window_( |
563 NativeConstrainedWindow::CreateNativeConstrainedWindow(this))) { | 563 NativeConstrainedWindow::CreateNativeConstrainedWindow(this))) { |
564 views::Widget::InitParams params(views::Widget::InitParams::TYPE_WINDOW); | 564 views::Widget::InitParams params(views::Widget::InitParams::TYPE_WINDOW); |
565 params.delegate = widget_delegate; | 565 params.delegate = widget_delegate; |
566 params.native_widget = native_constrained_window_->AsNativeWidget(); | 566 params.native_widget = native_constrained_window_->AsNativeWidget(); |
567 params.child = true; | 567 params.child = true; |
568 params.parent = wrapper->web_contents()->GetNativeView(); | 568 params.parent = wrapper->web_contents()->GetNativeView(); |
| 569 // TODO(jamescook): In non-compact mode the window header can be transparent. |
| 570 // Check defined(USE_AURA) and set params.transparent = true. |
| 571 // Don't use Shell::GetInstance() here as some tests run this without a Shell. |
569 Init(params); | 572 Init(params); |
570 | 573 |
571 wrapper_->constrained_window_tab_helper()->AddConstrainedDialog(this); | 574 wrapper_->constrained_window_tab_helper()->AddConstrainedDialog(this); |
572 } | 575 } |
573 | 576 |
574 ConstrainedWindowViews::~ConstrainedWindowViews() { | 577 ConstrainedWindowViews::~ConstrainedWindowViews() { |
575 } | 578 } |
576 | 579 |
577 //////////////////////////////////////////////////////////////////////////////// | 580 //////////////////////////////////////////////////////////////////////////////// |
578 // ConstrainedWindowViews, ConstrainedWindow implementation: | 581 // ConstrainedWindowViews, ConstrainedWindow implementation: |
(...skipping 26 matching lines...) Expand all Loading... |
605 gfx::NativeWindow ConstrainedWindowViews::GetNativeWindow() { | 608 gfx::NativeWindow ConstrainedWindowViews::GetNativeWindow() { |
606 return Widget::GetNativeWindow(); | 609 return Widget::GetNativeWindow(); |
607 } | 610 } |
608 | 611 |
609 //////////////////////////////////////////////////////////////////////////////// | 612 //////////////////////////////////////////////////////////////////////////////// |
610 // ConstrainedWindowViews, views::Widget overrides: | 613 // ConstrainedWindowViews, views::Widget overrides: |
611 | 614 |
612 views::NonClientFrameView* ConstrainedWindowViews::CreateNonClientFrameView() { | 615 views::NonClientFrameView* ConstrainedWindowViews::CreateNonClientFrameView() { |
613 #if defined(USE_AURA) | 616 #if defined(USE_AURA) |
614 CommandLine* command_line = CommandLine::ForCurrentProcess(); | 617 CommandLine* command_line = CommandLine::ForCurrentProcess(); |
615 if (command_line->HasSwitch(ash::switches::kAuraGoogleDialogFrames) || | 618 if (command_line->HasSwitch(ash::switches::kAuraGoogleDialogFrames)) |
616 command_line->HasSwitch(ash::switches::kAuraTranslucentFrames)) { | |
617 return ash::Shell::GetInstance()->CreateDefaultNonClientFrameView(this); | 619 return ash::Shell::GetInstance()->CreateDefaultNonClientFrameView(this); |
618 } | 620 // TODO(jamescook): In non-compact mode we should use fancy translucent |
| 621 // headers. Figure out how to handle closing the window and communication |
| 622 // with the ConstrainedWindowTabHelper. Avoid Shell::GetInstance() as |
| 623 // some tests run this without a Shell. |
619 #endif | 624 #endif |
620 return new ConstrainedWindowFrameView(this); | 625 return new ConstrainedWindowFrameView(this); |
621 } | 626 } |
622 | 627 |
623 //////////////////////////////////////////////////////////////////////////////// | 628 //////////////////////////////////////////////////////////////////////////////// |
624 // ConstrainedWindowViews, NativeConstrainedWindowDelegate implementation: | 629 // ConstrainedWindowViews, NativeConstrainedWindowDelegate implementation: |
625 | 630 |
626 void ConstrainedWindowViews::OnNativeConstrainedWindowDestroyed() { | 631 void ConstrainedWindowViews::OnNativeConstrainedWindowDestroyed() { |
627 wrapper_->constrained_window_tab_helper()->WillClose(this); | 632 wrapper_->constrained_window_tab_helper()->WillClose(this); |
628 } | 633 } |
629 | 634 |
630 void ConstrainedWindowViews::OnNativeConstrainedWindowMouseActivate() { | 635 void ConstrainedWindowViews::OnNativeConstrainedWindowMouseActivate() { |
631 Activate(); | 636 Activate(); |
632 } | 637 } |
633 | 638 |
634 views::internal::NativeWidgetDelegate* | 639 views::internal::NativeWidgetDelegate* |
635 ConstrainedWindowViews::AsNativeWidgetDelegate() { | 640 ConstrainedWindowViews::AsNativeWidgetDelegate() { |
636 return this; | 641 return this; |
637 } | 642 } |
OLD | NEW |