Commit c4433dfd authored by Antonio Gomes's avatar Antonio Gomes Committed by Commit Bot

Move frame_utils.cc to //chromeos/ui/frame

Dependency/include graph:

- frame_utils.h is included by frame_header.cc;
- frame_header.h is included by default_frame_header.h
- browser_non_client_frame_view_ash.cc includes default_frame_header.h.

So, in order to free browser_non_client_frame_view_ash.cc|h from
including //ash/ headers the items above will migrate step by step
to //chromeos/ui.

BUG=1113900
R=jamescook@chromium.org, sky@chromium.org

Change-Id: I573a053321b82825d80554c1a3c44079bf6d2a4b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2521364
Commit-Queue: Antonio Gomes <tonikitoo@igalia.com>
Reviewed-by: default avatarScott Violet <sky@chromium.org>
Reviewed-by: default avatarJames Cook <jamescook@chromium.org>
Cr-Commit-Position: refs/heads/master@{#824893}
parent 290211db
...@@ -2675,6 +2675,7 @@ static_library("test_support") { ...@@ -2675,6 +2675,7 @@ static_library("test_support") {
"//base/test:test_support", "//base/test:test_support",
"//cc:test_support", "//cc:test_support",
"//chromeos/services/assistant/public/cpp", "//chromeos/services/assistant/public/cpp",
"//chromeos/ui/frame",
"//ui/accessibility/mojom", "//ui/accessibility/mojom",
"//ui/platform_window/common", "//ui/platform_window/common",
......
...@@ -11,7 +11,6 @@ ...@@ -11,7 +11,6 @@
#include "ash/frame/header_view.h" #include "ash/frame/header_view.h"
#include "ash/public/cpp/ash_constants.h" #include "ash/public/cpp/ash_constants.h"
#include "ash/public/cpp/default_frame_header.h" #include "ash/public/cpp/default_frame_header.h"
#include "ash/public/cpp/frame_utils.h"
#include "ash/public/cpp/tablet_mode_observer.h" #include "ash/public/cpp/tablet_mode_observer.h"
#include "ash/public/cpp/window_properties.h" #include "ash/public/cpp/window_properties.h"
#include "ash/shell.h" #include "ash/shell.h"
...@@ -24,6 +23,7 @@ ...@@ -24,6 +23,7 @@
#include "base/bind.h" #include "base/bind.h"
#include "chromeos/ui/base/window_properties.h" #include "chromeos/ui/base/window_properties.h"
#include "chromeos/ui/frame/caption_buttons/frame_caption_button_container_view.h" #include "chromeos/ui/frame/caption_buttons/frame_caption_button_container_view.h"
#include "chromeos/ui/frame/frame_utils.h"
#include "chromeos/ui/frame/immersive/immersive_fullscreen_controller.h" #include "chromeos/ui/frame/immersive/immersive_fullscreen_controller.h"
#include "ui/aura/client/aura_constants.h" #include "ui/aura/client/aura_constants.h"
#include "ui/aura/window.h" #include "ui/aura/window.h"
...@@ -290,7 +290,7 @@ gfx::Rect NonClientFrameViewAsh::GetWindowBoundsForClientBounds( ...@@ -290,7 +290,7 @@ gfx::Rect NonClientFrameViewAsh::GetWindowBoundsForClientBounds(
} }
int NonClientFrameViewAsh::NonClientHitTest(const gfx::Point& point) { int NonClientFrameViewAsh::NonClientHitTest(const gfx::Point& point) {
return FrameBorderNonClientHitTest(this, point); return chromeos::FrameBorderNonClientHitTest(this, point);
} }
void NonClientFrameViewAsh::GetWindowMask(const gfx::Size& size, void NonClientFrameViewAsh::GetWindowMask(const gfx::Size& size,
......
...@@ -126,8 +126,6 @@ component("cpp") { ...@@ -126,8 +126,6 @@ component("cpp") {
"fps_counter.h", "fps_counter.h",
"frame_header.cc", "frame_header.cc",
"frame_header.h", "frame_header.h",
"frame_utils.cc",
"frame_utils.h",
"gesture_action_type.h", "gesture_action_type.h",
"holding_space/holding_space_client.h", "holding_space/holding_space_client.h",
"holding_space/holding_space_color_provider.cc", "holding_space/holding_space_color_provider.cc",
......
...@@ -4,11 +4,11 @@ ...@@ -4,11 +4,11 @@
#include "ash/public/cpp/frame_header.h" #include "ash/public/cpp/frame_header.h"
#include "ash/public/cpp/frame_utils.h"
#include "ash/public/cpp/window_properties.h" #include "ash/public/cpp/window_properties.h"
#include "base/logging.h" // DCHECK #include "base/logging.h" // DCHECK
#include "chromeos/ui/frame/caption_buttons/caption_button_model.h" #include "chromeos/ui/frame/caption_buttons/caption_button_model.h"
#include "chromeos/ui/frame/caption_buttons/frame_caption_button_container_view.h" #include "chromeos/ui/frame/caption_buttons/frame_caption_button_container_view.h"
#include "chromeos/ui/frame/frame_utils.h"
#include "chromeos/ui/vector_icons/vector_icons.h" #include "chromeos/ui/vector_icons/vector_icons.h"
#include "ui/base/class_property.h" #include "ui/base/class_property.h"
#include "ui/compositor/layer_animation_observer.h" #include "ui/compositor/layer_animation_observer.h"
...@@ -367,7 +367,8 @@ void FrameHeader::LayoutHeaderInternal() { ...@@ -367,7 +367,8 @@ void FrameHeader::LayoutHeaderInternal() {
// TODO(crbug.com/1092005): Investigate if we can move this to // TODO(crbug.com/1092005): Investigate if we can move this to
// CaptionButtonModel and just check the model in // CaptionButtonModel and just check the model in
// chromeos::FrameCaptionButtonContainerView. // chromeos::FrameCaptionButtonContainerView.
const bool use_restore_frame = ash::ShouldUseRestoreFrame(target_widget_); const bool use_restore_frame =
chromeos::ShouldUseRestoreFrame(target_widget_);
caption_button_container()->SetButtonImage( caption_button_container()->SetButtonImage(
views::CAPTION_BUTTON_ICON_MAXIMIZE_RESTORE, views::CAPTION_BUTTON_ICON_MAXIMIZE_RESTORE,
use_restore_frame ? maximize_icon : restore_icon); use_restore_frame ? maximize_icon : restore_icon);
......
...@@ -4,8 +4,8 @@ ...@@ -4,8 +4,8 @@
#include "ash/test/ash_test_views_delegate.h" #include "ash/test/ash_test_views_delegate.h"
#include "ash/public/cpp/frame_utils.h"
#include "ash/shell.h" #include "ash/shell.h"
#include "chromeos/ui/frame/frame_utils.h"
namespace ash { namespace ash {
...@@ -20,7 +20,7 @@ void AshTestViewsDelegate::OnBeforeWidgetInit( ...@@ -20,7 +20,7 @@ void AshTestViewsDelegate::OnBeforeWidgetInit(
params->context = Shell::GetRootWindowForNewWindows(); params->context = Shell::GetRootWindowForNewWindows();
if (params->opacity == views::Widget::InitParams::WindowOpacity::kInferred) if (params->opacity == views::Widget::InitParams::WindowOpacity::kInferred)
ResolveInferredOpacity(params); chromeos::ResolveInferredOpacity(params);
TestViewsDelegate::OnBeforeWidgetInit(params, delegate); TestViewsDelegate::OnBeforeWidgetInit(params, delegate);
} }
......
...@@ -22,8 +22,8 @@ ...@@ -22,8 +22,8 @@
#if defined(OS_CHROMEOS) #if defined(OS_CHROMEOS)
#include "ash/public/cpp/app_types.h" #include "ash/public/cpp/app_types.h"
#include "ash/public/cpp/frame_utils.h"
#include "chrome/browser/ui/views/touch_selection_menu_runner_chromeos.h" #include "chrome/browser/ui/views/touch_selection_menu_runner_chromeos.h"
#include "chromeos/ui/frame/frame_utils.h"
#include "ui/aura/client/aura_constants.h" #include "ui/aura/client/aura_constants.h"
#endif #endif
...@@ -172,7 +172,7 @@ void ChromeViewsDelegate::OnBeforeWidgetInit( ...@@ -172,7 +172,7 @@ void ChromeViewsDelegate::OnBeforeWidgetInit(
// We need to determine opacity if it's not already specified. // We need to determine opacity if it's not already specified.
if (params->opacity == views::Widget::InitParams::WindowOpacity::kInferred) { if (params->opacity == views::Widget::InitParams::WindowOpacity::kInferred) {
#if defined(OS_CHROMEOS) #if defined(OS_CHROMEOS)
ash::ResolveInferredOpacity(params); chromeos::ResolveInferredOpacity(params);
#else #else
params->opacity = views::Widget::InitParams::WindowOpacity::kOpaque; params->opacity = views::Widget::InitParams::WindowOpacity::kOpaque;
#endif #endif
......
...@@ -5,13 +5,13 @@ ...@@ -5,13 +5,13 @@
#include "chrome/browser/ui/views/frame/browser_frame_header_ash.h" #include "chrome/browser/ui/views/frame/browser_frame_header_ash.h"
#include "ash/public/cpp/ash_constants.h" #include "ash/public/cpp/ash_constants.h"
#include "ash/public/cpp/frame_utils.h"
#include "ash/public/cpp/tablet_mode.h" #include "ash/public/cpp/tablet_mode.h"
#include "base/check.h" #include "base/check.h"
#include "chrome/app/vector_icons/vector_icons.h" #include "chrome/app/vector_icons/vector_icons.h"
#include "chromeos/ui/base/window_properties.h" #include "chromeos/ui/base/window_properties.h"
#include "chromeos/ui/base/window_state_type.h" #include "chromeos/ui/base/window_state_type.h"
#include "chromeos/ui/frame/caption_buttons/frame_caption_button_container_view.h" #include "chromeos/ui/frame/caption_buttons/frame_caption_button_container_view.h"
#include "chromeos/ui/frame/frame_utils.h"
#include "third_party/skia/include/core/SkCanvas.h" #include "third_party/skia/include/core/SkCanvas.h"
#include "third_party/skia/include/core/SkColor.h" #include "third_party/skia/include/core/SkColor.h"
#include "third_party/skia/include/core/SkPaint.h" #include "third_party/skia/include/core/SkPaint.h"
...@@ -147,7 +147,7 @@ views::CaptionButtonLayoutSize BrowserFrameHeaderAsh::GetButtonLayoutSize() ...@@ -147,7 +147,7 @@ views::CaptionButtonLayoutSize BrowserFrameHeaderAsh::GetButtonLayoutSize()
if (ash::TabletMode::Get() && ash::TabletMode::Get()->InTabletMode()) if (ash::TabletMode::Get() && ash::TabletMode::Get()->InTabletMode())
return views::CaptionButtonLayoutSize::kBrowserCaptionMaximized; return views::CaptionButtonLayoutSize::kBrowserCaptionMaximized;
return ash::ShouldUseRestoreFrame(target_widget()) return chromeos::ShouldUseRestoreFrame(target_widget())
? views::CaptionButtonLayoutSize::kBrowserCaptionRestored ? views::CaptionButtonLayoutSize::kBrowserCaptionRestored
: views::CaptionButtonLayoutSize::kBrowserCaptionMaximized; : views::CaptionButtonLayoutSize::kBrowserCaptionMaximized;
} }
......
...@@ -8,7 +8,6 @@ ...@@ -8,7 +8,6 @@
#include "ash/public/cpp/app_types.h" #include "ash/public/cpp/app_types.h"
#include "ash/public/cpp/default_frame_header.h" #include "ash/public/cpp/default_frame_header.h"
#include "ash/public/cpp/frame_utils.h"
#include "ash/public/cpp/window_properties.h" #include "ash/public/cpp/window_properties.h"
#include "ash/wm/window_util.h" #include "ash/wm/window_util.h"
#include "base/metrics/user_metrics.h" #include "base/metrics/user_metrics.h"
...@@ -40,6 +39,7 @@ ...@@ -40,6 +39,7 @@
#include "chromeos/ui/base/window_properties.h" #include "chromeos/ui/base/window_properties.h"
#include "chromeos/ui/base/window_state_type.h" #include "chromeos/ui/base/window_state_type.h"
#include "chromeos/ui/frame/caption_buttons/frame_caption_button_container_view.h" #include "chromeos/ui/frame/caption_buttons/frame_caption_button_container_view.h"
#include "chromeos/ui/frame/frame_utils.h"
#include "content/public/browser/web_contents.h" #include "content/public/browser/web_contents.h"
#include "third_party/skia/include/core/SkColor.h" #include "third_party/skia/include/core/SkColor.h"
#include "ui/accessibility/ax_enums.mojom.h" #include "ui/accessibility/ax_enums.mojom.h"
...@@ -256,7 +256,7 @@ gfx::Rect BrowserNonClientFrameViewAsh::GetWindowBoundsForClientBounds( ...@@ -256,7 +256,7 @@ gfx::Rect BrowserNonClientFrameViewAsh::GetWindowBoundsForClientBounds(
} }
int BrowserNonClientFrameViewAsh::NonClientHitTest(const gfx::Point& point) { int BrowserNonClientFrameViewAsh::NonClientHitTest(const gfx::Point& point) {
int hit_test = ash::FrameBorderNonClientHitTest(this, point); int hit_test = chromeos::FrameBorderNonClientHitTest(this, point);
// When the window is restored we want a large click target above the tabs // When the window is restored we want a large click target above the tabs
// to drag the window, so redirect clicks in the tab's shadow to caption. // to drag the window, so redirect clicks in the tab's shadow to caption.
......
...@@ -22,6 +22,8 @@ source_set("frame") { ...@@ -22,6 +22,8 @@ source_set("frame") {
"caption_buttons/frame_size_button_delegate.h", "caption_buttons/frame_size_button_delegate.h",
"caption_buttons/snap_controller.cc", "caption_buttons/snap_controller.cc",
"caption_buttons/snap_controller.h", "caption_buttons/snap_controller.h",
"frame_utils.cc",
"frame_utils.h",
"immersive/immersive_context.cc", "immersive/immersive_context.cc",
"immersive/immersive_context.h", "immersive/immersive_context.h",
"immersive/immersive_focus_watcher.cc", "immersive/immersive_focus_watcher.cc",
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#include "ash/public/cpp/frame_utils.h" #include "chromeos/ui/frame/frame_utils.h"
#include "chromeos/ui/base/chromeos_ui_constants.h" #include "chromeos/ui/base/chromeos_ui_constants.h"
#include "chromeos/ui/base/window_properties.h" #include "chromeos/ui/base/window_properties.h"
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
#include "ui/views/window/hit_test_utils.h" #include "ui/views/window/hit_test_utils.h"
#include "ui/views/window/non_client_view.h" #include "ui/views/window/non_client_view.h"
namespace ash { namespace chromeos {
using WindowOpacity = views::Widget::InitParams::WindowOpacity; using WindowOpacity = views::Widget::InitParams::WindowOpacity;
...@@ -94,4 +94,4 @@ bool ShouldUseRestoreFrame(const views::Widget* widget) { ...@@ -94,4 +94,4 @@ bool ShouldUseRestoreFrame(const views::Widget* widget) {
return true; return true;
} }
} // namespace ash } // namespace chromeos
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
#ifndef ASH_PUBLIC_CPP_FRAME_UTILS_H_ #ifndef ASH_PUBLIC_CPP_FRAME_UTILS_H_
#define ASH_PUBLIC_CPP_FRAME_UTILS_H_ #define ASH_PUBLIC_CPP_FRAME_UTILS_H_
#include "ash/public/cpp/ash_public_export.h" #include "base/component_export.h"
#include "third_party/skia/include/core/SkColor.h" #include "third_party/skia/include/core/SkColor.h"
#include "ui/views/widget/widget.h" #include "ui/views/widget/widget.h"
...@@ -17,20 +17,21 @@ namespace views { ...@@ -17,20 +17,21 @@ namespace views {
class NonClientFrameView; class NonClientFrameView;
} }
namespace ash { namespace chromeos {
// Returns the HitTestCompat for the specified point. // Returns the HitTestCompat for the specified point.
ASH_PUBLIC_EXPORT int FrameBorderNonClientHitTest( COMPONENT_EXPORT(CHROMEOS_UI_FRAME)
views::NonClientFrameView* view, int FrameBorderNonClientHitTest(views::NonClientFrameView* view,
const gfx::Point& point_in_widget); const gfx::Point& point_in_widget);
// Resolve the inferred opacity and updates the params. // Resolve the inferred opacity and updates the params.
ASH_PUBLIC_EXPORT void ResolveInferredOpacity( COMPONENT_EXPORT(CHROMEOS_UI_FRAME)
views::Widget::InitParams* params); void ResolveInferredOpacity(views::Widget::InitParams* params);
// Checks whether we should draw the restored window frame on |widget|. // Checks whether we should draw the restored window frame on |widget|.
ASH_PUBLIC_EXPORT bool ShouldUseRestoreFrame(const views::Widget* widget); COMPONENT_EXPORT(CHROMEOS_UI_FRAME)
bool ShouldUseRestoreFrame(const views::Widget* widget);
} // namespace ash } // namespace chromeos
#endif // ASH_PUBLIC_CPP_FRAME_UTILS_H_ #endif // ASH_PUBLIC_CPP_FRAME_UTILS_H_
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment