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 #if defined(USE_AURA) |
| 570 // In non-compact mode the window header can be transparent. |
| 571 if (!ash::Shell::GetInstance()->IsWindowModeCompact()) |
| 572 params.transparent = true; |
| 573 #endif |
569 Init(params); | 574 Init(params); |
570 | 575 |
571 wrapper_->constrained_window_tab_helper()->AddConstrainedDialog(this); | 576 wrapper_->constrained_window_tab_helper()->AddConstrainedDialog(this); |
572 } | 577 } |
573 | 578 |
574 ConstrainedWindowViews::~ConstrainedWindowViews() { | 579 ConstrainedWindowViews::~ConstrainedWindowViews() { |
575 } | 580 } |
576 | 581 |
577 //////////////////////////////////////////////////////////////////////////////// | 582 //////////////////////////////////////////////////////////////////////////////// |
578 // ConstrainedWindowViews, ConstrainedWindow implementation: | 583 // ConstrainedWindowViews, ConstrainedWindow implementation: |
(...skipping 26 matching lines...) Expand all Loading... |
605 gfx::NativeWindow ConstrainedWindowViews::GetNativeWindow() { | 610 gfx::NativeWindow ConstrainedWindowViews::GetNativeWindow() { |
606 return Widget::GetNativeWindow(); | 611 return Widget::GetNativeWindow(); |
607 } | 612 } |
608 | 613 |
609 //////////////////////////////////////////////////////////////////////////////// | 614 //////////////////////////////////////////////////////////////////////////////// |
610 // ConstrainedWindowViews, views::Widget overrides: | 615 // ConstrainedWindowViews, views::Widget overrides: |
611 | 616 |
612 views::NonClientFrameView* ConstrainedWindowViews::CreateNonClientFrameView() { | 617 views::NonClientFrameView* ConstrainedWindowViews::CreateNonClientFrameView() { |
613 #if defined(USE_AURA) | 618 #if defined(USE_AURA) |
614 CommandLine* command_line = CommandLine::ForCurrentProcess(); | 619 CommandLine* command_line = CommandLine::ForCurrentProcess(); |
615 if (command_line->HasSwitch(ash::switches::kAuraGoogleDialogFrames) || | 620 if (command_line->HasSwitch(ash::switches::kAuraGoogleDialogFrames)) |
616 command_line->HasSwitch(ash::switches::kAuraTranslucentFrames)) { | |
617 return ash::Shell::GetInstance()->CreateDefaultNonClientFrameView(this); | 621 return ash::Shell::GetInstance()->CreateDefaultNonClientFrameView(this); |
618 } | 622 // In non-compact mode use fancy translucent headers. |
| 623 if (!ash::Shell::GetInstance()->IsWindowModeCompact()) |
| 624 return ash::Shell::GetInstance()->CreateDefaultNonClientFrameView(this); |
619 #endif | 625 #endif |
620 return new ConstrainedWindowFrameView(this); | 626 return new ConstrainedWindowFrameView(this); |
621 } | 627 } |
622 | 628 |
623 //////////////////////////////////////////////////////////////////////////////// | 629 //////////////////////////////////////////////////////////////////////////////// |
624 // ConstrainedWindowViews, NativeConstrainedWindowDelegate implementation: | 630 // ConstrainedWindowViews, NativeConstrainedWindowDelegate implementation: |
625 | 631 |
626 void ConstrainedWindowViews::OnNativeConstrainedWindowDestroyed() { | 632 void ConstrainedWindowViews::OnNativeConstrainedWindowDestroyed() { |
627 wrapper_->constrained_window_tab_helper()->WillClose(this); | 633 wrapper_->constrained_window_tab_helper()->WillClose(this); |
628 } | 634 } |
629 | 635 |
630 void ConstrainedWindowViews::OnNativeConstrainedWindowMouseActivate() { | 636 void ConstrainedWindowViews::OnNativeConstrainedWindowMouseActivate() { |
631 Activate(); | 637 Activate(); |
632 } | 638 } |
633 | 639 |
634 views::internal::NativeWidgetDelegate* | 640 views::internal::NativeWidgetDelegate* |
635 ConstrainedWindowViews::AsNativeWidgetDelegate() { | 641 ConstrainedWindowViews::AsNativeWidgetDelegate() { |
636 return this; | 642 return this; |
637 } | 643 } |
OLD | NEW |