| 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 23 matching lines...) Expand all Loading... |
| 34 #include "ui/gfx/rect.h" | 34 #include "ui/gfx/rect.h" |
| 35 #include "ui/gfx/screen.h" | 35 #include "ui/gfx/screen.h" |
| 36 #include "ui/views/color_constants.h" | 36 #include "ui/views/color_constants.h" |
| 37 #include "ui/views/controls/button/image_button.h" | 37 #include "ui/views/controls/button/image_button.h" |
| 38 #include "ui/views/focus/focus_manager.h" | 38 #include "ui/views/focus/focus_manager.h" |
| 39 #include "ui/views/views_delegate.h" | 39 #include "ui/views/views_delegate.h" |
| 40 #include "ui/views/widget/widget.h" | 40 #include "ui/views/widget/widget.h" |
| 41 #include "ui/views/window/client_view.h" | 41 #include "ui/views/window/client_view.h" |
| 42 #include "ui/views/window/dialog_client_view.h" | 42 #include "ui/views/window/dialog_client_view.h" |
| 43 #include "ui/views/window/dialog_delegate.h" | 43 #include "ui/views/window/dialog_delegate.h" |
| 44 #include "ui/views/window/dialog_frame_view.h" |
| 44 #include "ui/views/window/frame_background.h" | 45 #include "ui/views/window/frame_background.h" |
| 45 #include "ui/views/window/non_client_view.h" | 46 #include "ui/views/window/non_client_view.h" |
| 46 #include "ui/views/window/window_resources.h" | 47 #include "ui/views/window/window_resources.h" |
| 47 #include "ui/views/window/window_shape.h" | 48 #include "ui/views/window/window_shape.h" |
| 48 | 49 |
| 49 #if defined(OS_WIN) && !defined(USE_AURA) | 50 #if defined(OS_WIN) && !defined(USE_AURA) |
| 50 #include "ui/base/win/shell.h" | 51 #include "ui/base/win/shell.h" |
| 51 #include "ui/views/widget/native_widget_win.h" | 52 #include "ui/views/widget/native_widget_win.h" |
| 52 #endif | 53 #endif |
| 53 | 54 |
| (...skipping 572 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 626 } | 627 } |
| 627 | 628 |
| 628 void ConstrainedWindowViews::PulseWebContentsModalDialog() { | 629 void ConstrainedWindowViews::PulseWebContentsModalDialog() { |
| 629 } | 630 } |
| 630 | 631 |
| 631 gfx::NativeWindow ConstrainedWindowViews::GetNativeWindow() { | 632 gfx::NativeWindow ConstrainedWindowViews::GetNativeWindow() { |
| 632 return Widget::GetNativeWindow(); | 633 return Widget::GetNativeWindow(); |
| 633 } | 634 } |
| 634 | 635 |
| 635 views::NonClientFrameView* ConstrainedWindowViews::CreateNonClientFrameView() { | 636 views::NonClientFrameView* ConstrainedWindowViews::CreateNonClientFrameView() { |
| 637 if (views::DialogDelegate::UseNewStyle()) |
| 638 return new views::DialogFrameView(widget_delegate()->GetWindowTitle()); |
| 636 #if defined(USE_ASH) | 639 #if defined(USE_ASH) |
| 637 CommandLine* command_line = CommandLine::ForCurrentProcess(); | |
| 638 if (command_line->HasSwitch(switches::kEnableNewDialogStyle)) | |
| 639 return ash::Shell::GetInstance()->CreateDefaultNonClientFrameView(this); | |
| 640 ConstrainedWindowFrameViewAsh* frame = new ConstrainedWindowFrameViewAsh; | 640 ConstrainedWindowFrameViewAsh* frame = new ConstrainedWindowFrameViewAsh; |
| 641 frame->Init(this); | 641 frame->Init(this); |
| 642 return frame; | 642 return frame; |
| 643 #endif | 643 #endif |
| 644 return new ConstrainedWindowFrameView(this); | 644 return new ConstrainedWindowFrameView(this); |
| 645 } | 645 } |
| 646 | 646 |
| 647 void ConstrainedWindowViews::OnNativeConstrainedWindowDestroyed() { | 647 void ConstrainedWindowViews::OnNativeConstrainedWindowDestroyed() { |
| 648 WebContentsModalDialogManager* web_contents_modal_dialog_manager = | 648 WebContentsModalDialogManager* web_contents_modal_dialog_manager = |
| 649 WebContentsModalDialogManager::FromWebContents(web_contents_); | 649 WebContentsModalDialogManager::FromWebContents(web_contents_); |
| 650 web_contents_modal_dialog_manager->WillClose(this); | 650 web_contents_modal_dialog_manager->WillClose(this); |
| 651 } | 651 } |
| 652 | 652 |
| 653 void ConstrainedWindowViews::OnNativeConstrainedWindowMouseActivate() { | 653 void ConstrainedWindowViews::OnNativeConstrainedWindowMouseActivate() { |
| 654 Activate(); | 654 Activate(); |
| 655 } | 655 } |
| 656 | 656 |
| 657 views::internal::NativeWidgetDelegate* | 657 views::internal::NativeWidgetDelegate* |
| 658 ConstrainedWindowViews::AsNativeWidgetDelegate() { | 658 ConstrainedWindowViews::AsNativeWidgetDelegate() { |
| 659 return this; | 659 return this; |
| 660 } | 660 } |
| 661 | 661 |
| 662 int ConstrainedWindowViews::GetNonClientComponent(const gfx::Point& point) { | 662 int ConstrainedWindowViews::GetNonClientComponent(const gfx::Point& point) { |
| 663 // Prevent a constrained window to be moved by the user. | 663 // Prevent a constrained window to be moved by the user. |
| 664 return HTNOWHERE; | 664 return HTNOWHERE; |
| 665 } | 665 } |
| OLD | NEW |