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