OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 589 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
600 | 600 |
601 ConstrainedWindowViews::ConstrainedWindowViews( | 601 ConstrainedWindowViews::ConstrainedWindowViews( |
602 TabContentsWrapper* wrapper, | 602 TabContentsWrapper* wrapper, |
603 views::WidgetDelegate* widget_delegate) | 603 views::WidgetDelegate* widget_delegate) |
604 : wrapper_(wrapper), | 604 : wrapper_(wrapper), |
605 ALLOW_THIS_IN_INITIALIZER_LIST(native_constrained_window_( | 605 ALLOW_THIS_IN_INITIALIZER_LIST(native_constrained_window_( |
606 NativeConstrainedWindow::CreateNativeConstrainedWindow(this))) { | 606 NativeConstrainedWindow::CreateNativeConstrainedWindow(this))) { |
607 views::Widget::InitParams params; | 607 views::Widget::InitParams params; |
608 params.delegate = widget_delegate; | 608 params.delegate = widget_delegate; |
609 params.native_widget = native_constrained_window_->AsNativeWidget(); | 609 params.native_widget = native_constrained_window_->AsNativeWidget(); |
610 | 610 params.child = true; |
611 if (views::Widget::IsPureViews() && | 611 params.parent = wrapper->tab_contents()->GetNativeView(); |
612 views::ViewsDelegate::views_delegate && | |
613 views::ViewsDelegate::views_delegate->GetDefaultParentView()) { | |
614 // Don't set parent so that constrained window is attached to | |
615 // desktop. This is necessary for key events to work under views desktop | |
616 // because key events need to be sent to toplevel window | |
617 // which has an inputmethod object that knows where to forward | |
618 // event. | |
619 } else { | |
620 params.child = true; | |
621 params.parent = wrapper->tab_contents()->GetNativeView(); | |
622 } | |
623 | |
624 Init(params); | 612 Init(params); |
625 | 613 |
626 wrapper_->constrained_window_tab_helper()->AddConstrainedDialog(this); | 614 wrapper_->constrained_window_tab_helper()->AddConstrainedDialog(this); |
627 } | 615 } |
628 | 616 |
629 ConstrainedWindowViews::~ConstrainedWindowViews() { | 617 ConstrainedWindowViews::~ConstrainedWindowViews() { |
630 } | 618 } |
631 | 619 |
632 //////////////////////////////////////////////////////////////////////////////// | 620 //////////////////////////////////////////////////////////////////////////////// |
633 // ConstrainedWindowViews, ConstrainedWindow implementation: | 621 // ConstrainedWindowViews, ConstrainedWindow implementation: |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
676 } | 664 } |
677 | 665 |
678 void ConstrainedWindowViews::OnNativeConstrainedWindowMouseActivate() { | 666 void ConstrainedWindowViews::OnNativeConstrainedWindowMouseActivate() { |
679 Activate(); | 667 Activate(); |
680 } | 668 } |
681 | 669 |
682 views::internal::NativeWidgetDelegate* | 670 views::internal::NativeWidgetDelegate* |
683 ConstrainedWindowViews::AsNativeWidgetDelegate() { | 671 ConstrainedWindowViews::AsNativeWidgetDelegate() { |
684 return this; | 672 return this; |
685 } | 673 } |
OLD | NEW |