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" |
11 #include "chrome/app/chrome_command_ids.h" | 11 #include "chrome/app/chrome_command_ids.h" |
12 #include "chrome/browser/platform_util.h" | 12 #include "chrome/browser/platform_util.h" |
13 #include "chrome/browser/profiles/profile.h" | 13 #include "chrome/browser/profiles/profile.h" |
14 #include "chrome/browser/themes/theme_service.h" | 14 #include "chrome/browser/themes/theme_service.h" |
15 #include "chrome/browser/ui/constrained_window_tab_helper.h" | 15 #include "chrome/browser/ui/constrained_window_tab_helper.h" |
16 #include "chrome/browser/ui/toolbar/toolbar_model.h" | 16 #include "chrome/browser/ui/toolbar/toolbar_model.h" |
17 #include "chrome/browser/ui/views/frame/browser_view.h" | 17 #include "chrome/browser/ui/views/frame/browser_view.h" |
18 #include "chrome/common/chrome_constants.h" | 18 #include "chrome/common/chrome_constants.h" |
19 #include "content/public/browser/navigation_controller.h" | 19 #include "content/public/browser/navigation_controller.h" |
20 #include "content/public/browser/web_contents.h" | 20 #include "content/public/browser/web_contents.h" |
21 #include "content/public/browser/web_contents_view.h" | 21 #include "content/public/browser/web_contents_view.h" |
22 #include "grit/chromium_strings.h" | 22 #include "grit/chromium_strings.h" |
23 #include "grit/generated_resources.h" | 23 #include "grit/generated_resources.h" |
24 #include "grit/theme_resources.h" | 24 #include "grit/theme_resources.h" |
25 #include "grit/ui_resources.h" | 25 #include "grit/ui_resources.h" |
26 #include "net/base/net_util.h" | 26 #include "net/base/net_util.h" |
27 #include "ui/aura/client/aura_constants.h" | 27 #include "ui/aura/client/aura_constants.h" |
28 #include "ui/base/hit_test.h" | 28 #include "ui/base/hit_test.h" |
29 #include "ui/base/resource/resource_bundle.h" | 29 #include "ui/base/resource/resource_bundle.h" |
| 30 #include "ui/base/ui_base_switches.h" |
30 #include "ui/gfx/canvas.h" | 31 #include "ui/gfx/canvas.h" |
31 #include "ui/gfx/font.h" | 32 #include "ui/gfx/font.h" |
32 #include "ui/gfx/path.h" | 33 #include "ui/gfx/path.h" |
33 #include "ui/gfx/rect.h" | 34 #include "ui/gfx/rect.h" |
34 #include "ui/gfx/screen.h" | 35 #include "ui/gfx/screen.h" |
35 #include "ui/views/color_constants.h" | 36 #include "ui/views/color_constants.h" |
36 #include "ui/views/controls/button/image_button.h" | 37 #include "ui/views/controls/button/image_button.h" |
37 #include "ui/views/focus/focus_manager.h" | 38 #include "ui/views/focus/focus_manager.h" |
38 #include "ui/views/views_delegate.h" | 39 #include "ui/views/views_delegate.h" |
39 #include "ui/views/widget/widget.h" | 40 #include "ui/views/widget/widget.h" |
(...skipping 12 matching lines...) Expand all Loading... |
52 | 53 |
53 #if defined(USE_AURA) | 54 #if defined(USE_AURA) |
54 #include "ui/aura/window.h" | 55 #include "ui/aura/window.h" |
55 #include "ui/views/corewm/visibility_controller.h" | 56 #include "ui/views/corewm/visibility_controller.h" |
56 #include "ui/views/corewm/window_animations.h" | 57 #include "ui/views/corewm/window_animations.h" |
57 #include "ui/views/corewm/window_modality_controller.h" | 58 #include "ui/views/corewm/window_modality_controller.h" |
58 #endif | 59 #endif |
59 | 60 |
60 #if defined(USE_ASH) | 61 #if defined(USE_ASH) |
61 #include "ash/ash_constants.h" | 62 #include "ash/ash_constants.h" |
62 #include "ash/ash_switches.h" | |
63 #include "ash/shell.h" | 63 #include "ash/shell.h" |
64 #include "ash/wm/custom_frame_view_ash.h" | 64 #include "ash/wm/custom_frame_view_ash.h" |
65 #endif | 65 #endif |
66 | 66 |
67 using base::TimeDelta; | 67 using base::TimeDelta; |
68 | 68 |
69 namespace views { | 69 namespace views { |
70 class ClientView; | 70 class ClientView; |
71 } | 71 } |
72 | 72 |
(...skipping 565 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
638 return; | 638 return; |
639 | 639 |
640 ConstrainedWindowTabHelper* constrained_window_tab_helper = | 640 ConstrainedWindowTabHelper* constrained_window_tab_helper = |
641 ConstrainedWindowTabHelper::FromWebContents(web_contents_); | 641 ConstrainedWindowTabHelper::FromWebContents(web_contents_); |
642 constrained_window_tab_helper->WillClose(this); | 642 constrained_window_tab_helper->WillClose(this); |
643 } | 643 } |
644 | 644 |
645 views::NonClientFrameView* ConstrainedWindowViews::CreateNonClientFrameView() { | 645 views::NonClientFrameView* ConstrainedWindowViews::CreateNonClientFrameView() { |
646 #if defined(USE_ASH) | 646 #if defined(USE_ASH) |
647 CommandLine* command_line = CommandLine::ForCurrentProcess(); | 647 CommandLine* command_line = CommandLine::ForCurrentProcess(); |
648 if (command_line->HasSwitch(ash::switches::kAuraGoogleDialogFrames)) | 648 if (command_line->HasSwitch(switches::kEnableNewDialogStyle)) |
649 return ash::Shell::GetInstance()->CreateDefaultNonClientFrameView(this); | 649 return ash::Shell::GetInstance()->CreateDefaultNonClientFrameView(this); |
650 ConstrainedWindowFrameViewAsh* frame = new ConstrainedWindowFrameViewAsh; | 650 ConstrainedWindowFrameViewAsh* frame = new ConstrainedWindowFrameViewAsh; |
651 frame->Init(this); | 651 frame->Init(this); |
652 return frame; | 652 return frame; |
653 #endif | 653 #endif |
654 return new ConstrainedWindowFrameView(this); | 654 return new ConstrainedWindowFrameView(this); |
655 } | 655 } |
656 | 656 |
657 void ConstrainedWindowViews::OnNativeConstrainedWindowDestroyed() { | 657 void ConstrainedWindowViews::OnNativeConstrainedWindowDestroyed() { |
658 NotifyTabHelperWillClose(); | 658 NotifyTabHelperWillClose(); |
659 } | 659 } |
660 | 660 |
661 void ConstrainedWindowViews::OnNativeConstrainedWindowMouseActivate() { | 661 void ConstrainedWindowViews::OnNativeConstrainedWindowMouseActivate() { |
662 Activate(); | 662 Activate(); |
663 } | 663 } |
664 | 664 |
665 views::internal::NativeWidgetDelegate* | 665 views::internal::NativeWidgetDelegate* |
666 ConstrainedWindowViews::AsNativeWidgetDelegate() { | 666 ConstrainedWindowViews::AsNativeWidgetDelegate() { |
667 return this; | 667 return this; |
668 } | 668 } |
669 | 669 |
670 int ConstrainedWindowViews::GetNonClientComponent(const gfx::Point& point) { | 670 int ConstrainedWindowViews::GetNonClientComponent(const gfx::Point& point) { |
671 // Prevent a constrained window to be moved by the user. | 671 // Prevent a constrained window to be moved by the user. |
672 return HTNOWHERE; | 672 return HTNOWHERE; |
673 } | 673 } |
OLD | NEW |