| 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/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
| (...skipping 622 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 633 void ConstrainedWindowViews::FocusConstrainedWindow() { | 633 void ConstrainedWindowViews::FocusConstrainedWindow() { |
| 634 ConstrainedWindowTabHelper* helper = | 634 ConstrainedWindowTabHelper* helper = |
| 635 tab_contents_->constrained_window_tab_helper(); | 635 tab_contents_->constrained_window_tab_helper(); |
| 636 if ((!helper->delegate() || | 636 if ((!helper->delegate() || |
| 637 helper->delegate()->ShouldFocusConstrainedWindow()) && | 637 helper->delegate()->ShouldFocusConstrainedWindow()) && |
| 638 widget_delegate() && | 638 widget_delegate() && |
| 639 widget_delegate()->GetInitiallyFocusedView()) { | 639 widget_delegate()->GetInitiallyFocusedView()) { |
| 640 widget_delegate()->GetInitiallyFocusedView()->RequestFocus(); | 640 widget_delegate()->GetInitiallyFocusedView()->RequestFocus(); |
| 641 } | 641 } |
| 642 #if defined(USE_ASH) | 642 #if defined(USE_ASH) |
| 643 GetNativeView()->Focus(); | 643 // We don't necessarily have a RootWindow yet. |
| 644 if (GetNativeView()->GetRootWindow()) |
| 645 GetNativeView()->Focus(); |
| 644 #endif | 646 #endif |
| 645 } | 647 } |
| 646 | 648 |
| 647 gfx::NativeWindow ConstrainedWindowViews::GetNativeWindow() { | 649 gfx::NativeWindow ConstrainedWindowViews::GetNativeWindow() { |
| 648 return Widget::GetNativeWindow(); | 650 return Widget::GetNativeWindow(); |
| 649 } | 651 } |
| 650 | 652 |
| 651 //////////////////////////////////////////////////////////////////////////////// | 653 //////////////////////////////////////////////////////////////////////////////// |
| 652 // ConstrainedWindowViews, views::Widget overrides: | 654 // ConstrainedWindowViews, views::Widget overrides: |
| 653 | 655 |
| (...skipping 26 matching lines...) Expand all Loading... |
| 680 | 682 |
| 681 views::internal::NativeWidgetDelegate* | 683 views::internal::NativeWidgetDelegate* |
| 682 ConstrainedWindowViews::AsNativeWidgetDelegate() { | 684 ConstrainedWindowViews::AsNativeWidgetDelegate() { |
| 683 return this; | 685 return this; |
| 684 } | 686 } |
| 685 | 687 |
| 686 int ConstrainedWindowViews::GetNonClientComponent(const gfx::Point& point) { | 688 int ConstrainedWindowViews::GetNonClientComponent(const gfx::Point& point) { |
| 687 // Prevent a constrained window to be moved by the user. | 689 // Prevent a constrained window to be moved by the user. |
| 688 return HTNOWHERE; | 690 return HTNOWHERE; |
| 689 } | 691 } |
| OLD | NEW |