| 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/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
| 10 #include "chrome/app/chrome_command_ids.h" | 11 #include "chrome/app/chrome_command_ids.h" |
| 11 #include "chrome/browser/profiles/profile.h" | 12 #include "chrome/browser/profiles/profile.h" |
| 12 #include "chrome/browser/themes/theme_service.h" | 13 #include "chrome/browser/themes/theme_service.h" |
| 13 #include "chrome/browser/ui/constrained_window_tab_helper.h" | 14 #include "chrome/browser/ui/constrained_window_tab_helper.h" |
| 14 #include "chrome/browser/ui/tab_contents/tab_contents.h" | 15 #include "chrome/browser/ui/tab_contents/tab_contents.h" |
| 15 #include "chrome/browser/ui/toolbar/toolbar_model.h" | 16 #include "chrome/browser/ui/toolbar/toolbar_model.h" |
| 17 #include "chrome/browser/ui/views/constrained_window_frame_simple.h" |
| 16 #include "chrome/browser/ui/views/frame/browser_view.h" | 18 #include "chrome/browser/ui/views/frame/browser_view.h" |
| 17 #include "chrome/common/chrome_constants.h" | 19 #include "chrome/common/chrome_constants.h" |
| 20 #include "chrome/common/chrome_switches.h" |
| 18 #include "chrome/common/chrome_notification_types.h" | 21 #include "chrome/common/chrome_notification_types.h" |
| 19 #include "content/public/browser/web_contents.h" | 22 #include "content/public/browser/web_contents.h" |
| 20 #include "content/public/browser/web_contents_view.h" | 23 #include "content/public/browser/web_contents_view.h" |
| 21 #include "grit/chromium_strings.h" | 24 #include "grit/chromium_strings.h" |
| 22 #include "grit/generated_resources.h" | 25 #include "grit/generated_resources.h" |
| 23 #include "grit/theme_resources.h" | 26 #include "grit/theme_resources.h" |
| 24 #include "grit/theme_resources_standard.h" | 27 #include "grit/theme_resources_standard.h" |
| 25 #include "grit/ui_resources.h" | 28 #include "grit/ui_resources.h" |
| 26 #include "net/base/net_util.h" | 29 #include "net/base/net_util.h" |
| 27 #include "ui/base/hit_test.h" | 30 #include "ui/base/hit_test.h" |
| (...skipping 16 matching lines...) Expand all Loading... |
| 44 | 47 |
| 45 #if defined(OS_WIN) && !defined(USE_AURA) | 48 #if defined(OS_WIN) && !defined(USE_AURA) |
| 46 #include "ui/views/widget/native_widget_win.h" | 49 #include "ui/views/widget/native_widget_win.h" |
| 47 #endif | 50 #endif |
| 48 | 51 |
| 49 #if defined(USE_ASH) | 52 #if defined(USE_ASH) |
| 50 #include "ash/ash_switches.h" | 53 #include "ash/ash_switches.h" |
| 51 #include "ash/shell.h" | 54 #include "ash/shell.h" |
| 52 #include "ash/wm/custom_frame_view_ash.h" | 55 #include "ash/wm/custom_frame_view_ash.h" |
| 53 #include "ash/wm/visibility_controller.h" | 56 #include "ash/wm/visibility_controller.h" |
| 54 #include "base/command_line.h" | |
| 55 #include "ui/aura/window.h" | 57 #include "ui/aura/window.h" |
| 56 #endif | 58 #endif |
| 57 | 59 |
| 58 using base::TimeDelta; | 60 using base::TimeDelta; |
| 59 | 61 |
| 60 namespace views { | 62 namespace views { |
| 61 class ClientView; | 63 class ClientView; |
| 62 } | 64 } |
| 63 | 65 |
| 64 // An enumeration of image resources used by this window. | 66 // An enumeration of image resources used by this window. |
| (...skipping 561 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 626 } | 628 } |
| 627 | 629 |
| 628 gfx::NativeWindow ConstrainedWindowViews::GetNativeWindow() { | 630 gfx::NativeWindow ConstrainedWindowViews::GetNativeWindow() { |
| 629 return Widget::GetNativeWindow(); | 631 return Widget::GetNativeWindow(); |
| 630 } | 632 } |
| 631 | 633 |
| 632 //////////////////////////////////////////////////////////////////////////////// | 634 //////////////////////////////////////////////////////////////////////////////// |
| 633 // ConstrainedWindowViews, views::Widget overrides: | 635 // ConstrainedWindowViews, views::Widget overrides: |
| 634 | 636 |
| 635 views::NonClientFrameView* ConstrainedWindowViews::CreateNonClientFrameView() { | 637 views::NonClientFrameView* ConstrainedWindowViews::CreateNonClientFrameView() { |
| 638 CommandLine* command_line = CommandLine::ForCurrentProcess(); |
| 639 if (command_line->HasSwitch(switches::kEnableFramelessConstrainedDialogs)) { |
| 640 return new ConstrainedWindowFrameSimple(this); |
| 641 } else { |
| 636 #if defined(USE_ASH) | 642 #if defined(USE_ASH) |
| 637 CommandLine* command_line = CommandLine::ForCurrentProcess(); | 643 if (command_line->HasSwitch(ash::switches::kAuraGoogleDialogFrames)) |
| 638 if (command_line->HasSwitch(ash::switches::kAuraGoogleDialogFrames)) | 644 return ash::Shell::GetInstance()->CreateDefaultNonClientFrameView(this); |
| 639 return ash::Shell::GetInstance()->CreateDefaultNonClientFrameView(this); | 645 ConstrainedWindowFrameViewAsh* frame = new ConstrainedWindowFrameViewAsh; |
| 640 ConstrainedWindowFrameViewAsh* frame = new ConstrainedWindowFrameViewAsh; | 646 frame->Init(this); |
| 641 frame->Init(this); | 647 return frame; |
| 642 return frame; | |
| 643 #endif | 648 #endif |
| 644 return new ConstrainedWindowFrameView(this); | 649 return new ConstrainedWindowFrameView(this); |
| 650 } |
| 645 } | 651 } |
| 646 | 652 |
| 647 //////////////////////////////////////////////////////////////////////////////// | 653 //////////////////////////////////////////////////////////////////////////////// |
| 648 // ConstrainedWindowViews, NativeConstrainedWindowDelegate implementation: | 654 // ConstrainedWindowViews, NativeConstrainedWindowDelegate implementation: |
| 649 | 655 |
| 650 void ConstrainedWindowViews::OnNativeConstrainedWindowDestroyed() { | 656 void ConstrainedWindowViews::OnNativeConstrainedWindowDestroyed() { |
| 651 tab_contents_->constrained_window_tab_helper()->WillClose(this); | 657 tab_contents_->constrained_window_tab_helper()->WillClose(this); |
| 652 } | 658 } |
| 653 | 659 |
| 654 void ConstrainedWindowViews::OnNativeConstrainedWindowMouseActivate() { | 660 void ConstrainedWindowViews::OnNativeConstrainedWindowMouseActivate() { |
| 655 Activate(); | 661 Activate(); |
| 656 } | 662 } |
| 657 | 663 |
| 658 views::internal::NativeWidgetDelegate* | 664 views::internal::NativeWidgetDelegate* |
| 659 ConstrainedWindowViews::AsNativeWidgetDelegate() { | 665 ConstrainedWindowViews::AsNativeWidgetDelegate() { |
| 660 return this; | 666 return this; |
| 661 } | 667 } |
| OLD | NEW |