Skip to content

Commit

Permalink
Move FullscreenControlPopup to components for reuse
Browse files Browse the repository at this point in the history
FullscreenControlPopup will be reused in exo crrev.com/c/2821565.

Bug: 1198400
Change-Id: Id9b2bc0644f9dc2e8faa6bf89d3c8073cd7a5740
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2823031
Reviewed-by: Xianzhu Wang <wangxianzhu@chromium.org>
Reviewed-by: Scott Violet <sky@chromium.org>
Reviewed-by: Austin Sullivan <asully@chromium.org>
Reviewed-by: Robert Liao <robliao@chromium.org>
Reviewed-by: Ted Choc <tedchoc@chromium.org>
Reviewed-by: Yuwei Huang <yuweih@chromium.org>
Reviewed-by: Peter Boström <pbos@chromium.org>
Commit-Queue: Joel Hockey <joelhockey@chromium.org>
Cr-Commit-Position: refs/heads/master@{#872217}
  • Loading branch information
Joel Hockey authored and Chromium LUCI CQ committed Apr 14, 2021
1 parent cf5d45c commit 2de97cc
Show file tree
Hide file tree
Showing 26 changed files with 98 additions and 26 deletions.
5 changes: 0 additions & 5 deletions chrome/app/generated_resources.grd
Original file line number Diff line number Diff line change
Expand Up @@ -3429,11 +3429,6 @@ are declared in tools/grit/grit_rule.gni.
Empty Cache and Hard Reload
</message>

<!-- Fullscreen mode -->
<message name="IDS_EXIT_FULLSCREEN_MODE" desc="Clickable message displayed on entering full screen mode. Clicking on the link exits full screen mode.">
Exit full screen
</message>

<!-- Tab sharing infobar -->
<message name="IDS_TAB_SHARING_INFOBAR_SHARING_CURRENT_TAB_LABEL" desc="Text displayed on an infobar when current tab is being shared.">
Sharing this tab to <ph name="APP_NAME">$1<ex>meet.google.com</ex></ph>
Expand Down
5 changes: 1 addition & 4 deletions chrome/browser/ui/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -3802,10 +3802,6 @@ static_library("ui") {
"views/frame/web_footer_experiment_view.h",
"views/fullscreen_control/fullscreen_control_host.cc",
"views/fullscreen_control/fullscreen_control_host.h",
"views/fullscreen_control/fullscreen_control_popup.cc",
"views/fullscreen_control/fullscreen_control_popup.h",
"views/fullscreen_control/fullscreen_control_view.cc",
"views/fullscreen_control/fullscreen_control_view.h",
"views/global_error_bubble_view.cc",
"views/global_error_bubble_view.h",
"views/global_media_controls/global_media_controls_types.h",
Expand Down Expand Up @@ -4358,6 +4354,7 @@ static_library("ui") {
"//chrome/browser/ui/views",
"//components/constrained_window",
"//components/content_settings/browser/ui",
"//components/fullscreen_control",
"//components/media_message_center",
"//components/page_info",
"//components/payments/content",
Expand Down
1 change: 1 addition & 0 deletions chrome/browser/ui/views/DEPS
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
include_rules = [
"+chrome/browser/ui/views",
"+components/fullscreen_control",
"+components/services/app_service/public",
"+third_party/libaddressinput",
"+services/tracing/public",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
#include "chrome/browser/app_mode/app_mode_utils.h"
#include "chrome/browser/ui/views/exclusive_access_bubble_views.h"
#include "chrome/browser/ui/views/frame/browser_view.h"
#include "chrome/browser/ui/views/fullscreen_control/fullscreen_control_view.h"
#include "chrome/common/channel_info.h"
#include "chrome/common/chrome_switches.h"
#include "components/fullscreen_control/fullscreen_control_view.h"
#include "components/version_info/channel.h"
#include "content/public/common/content_features.h"
#include "ui/events/event.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#include "base/callback_forward.h"
#include "base/macros.h"
#include "base/timer/timer.h"
#include "chrome/browser/ui/views/fullscreen_control/fullscreen_control_popup.h"
#include "components/fullscreen_control/fullscreen_control_popup.h"
#include "ui/events/event_observer.h"

class BrowserView;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@
#include "chrome/browser/ui/views/exclusive_access_bubble_views.h"
#include "chrome/browser/ui/views/frame/browser_view.h"
#include "chrome/browser/ui/views/fullscreen_control/fullscreen_control_host.h"
#include "chrome/browser/ui/views/fullscreen_control/fullscreen_control_view.h"
#include "chrome/common/chrome_features.h"
#include "chrome/test/base/in_process_browser_test.h"
#include "chrome/test/base/ui_test_utils.h"
#include "components/fullscreen_control/fullscreen_control_view.h"
#include "content/public/browser/web_contents.h"
#include "content/public/common/content_features.h"
#include "content/public/test/browser_test.h"
Expand Down
2 changes: 0 additions & 2 deletions chrome/test/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -6184,8 +6184,6 @@ test("unit_tests") {
"../browser/ui/views/frame/test_with_browser_view.cc",
"../browser/ui/views/frame/test_with_browser_view.h",
"../browser/ui/views/frame/web_contents_close_handler_unittest.cc",
"../browser/ui/views/fullscreen_control/fullscreen_control_popup_unittest.cc",
"../browser/ui/views/fullscreen_control/fullscreen_control_view_unittest.cc",
"../browser/ui/views/global_media_controls/media_notification_container_impl_view_unittest.cc",
"../browser/ui/views/global_media_controls/media_notification_device_selector_view_unittest.cc",
"../browser/ui/views/global_media_controls/media_notification_list_view_unittest.cc",
Expand Down
1 change: 1 addition & 0 deletions components/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,7 @@ test("components_unittests") {

if (toolkit_views) {
deps += [
"//components/fullscreen_control:unit_tests",
"//components/media_message_center:unit_tests",
"//components/ui_devtools:unit_tests",
]
Expand Down
1 change: 1 addition & 0 deletions components/OWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ per-file browsing_data_strings.grdp=file://components/browsing_data/OWNERS
per-file crash_strings.grdp=file://components/crash/OWNERS
per-file dom_distiller_strings.grdp=file://components/dom_distiller/OWNERS
per-file error_page_strings.grdp=file://components/error_page/OWNERS
per-file fullscreen_control_strings.grdp=file://components/fullscreen_control/OWNERS
per-file heavy_ad_intervention_strings.grdp=file://components/heavy_ad_intervention/OWNERS
per-file javascript_dialogs_strings.grdp=file://components/javascript_dialogs/OWNERS
per-file management_mobile_strings.grdp=file://components/management/OWNERS
Expand Down
1 change: 1 addition & 0 deletions components/components_strings.grd
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,7 @@
<part file="error_page_strings.grdp" />
<part file="find_in_page_strings.grdp" />
<part file="flags_strings.grdp" />
<part file="fullscreen_control_strings.grdp" />
<part file="heavy_ad_intervention_strings.grdp" />
<part file="history_strings.grdp" />
<part file="javascript_dialogs_strings.grdp" />
Expand Down
43 changes: 43 additions & 0 deletions components/fullscreen_control/BUILD.gn
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Copyright 2021 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

static_library("fullscreen_control") {
sources = [
"fullscreen_control_popup.cc",
"fullscreen_control_popup.h",
"fullscreen_control_view.cc",
"fullscreen_control_view.h",
]
deps = [
"//base",
"//cc/paint",
"//components/strings",
"//components/vector_icons",
"//skia",
"//ui/base",
"//ui/compositor",
"//ui/gfx:native_widget_types",
"//ui/gfx/animation",
"//ui/gfx/geometry",
"//ui/views",
]
}

source_set("unit_tests") {
testonly = true
sources = [
"fullscreen_control_popup_unittest.cc",
"fullscreen_control_view_unittest.cc",
]

deps = [
":fullscreen_control",
"//base",
"//base/test:test_support",
"//testing/gtest",
"//ui/gfx:test_support",
"//ui/views",
"//ui/views:test_support",
]
}
8 changes: 8 additions & 0 deletions components/fullscreen_control/DEPS
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
include_rules = [
"+cc/paint",
"+components/vector_icons",
"+components/strings",
"+testing/gtest",
"+third_party/skia",
"+ui"
]
3 changes: 3 additions & 0 deletions components/fullscreen_control/DIR_METADATA
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
monorail {
component: "UI>Browser"
}
2 changes: 2 additions & 0 deletions components/fullscreen_control/OWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
file://chrome/browser/ui/views/fullscreen_control/OWNERS
file://chrome/browser/ui/views/OWNERS
6 changes: 6 additions & 0 deletions components/fullscreen_control/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Fullscreen Control #

Fullscreen control provides UI components used during fullscreen:
* Exit circle with 'X' shown when the mouse moves to the top of the screen.

The components are used by chrome browser, and by Chrome OS exo.
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "chrome/browser/ui/views/fullscreen_control/fullscreen_control_popup.h"
#include "components/fullscreen_control/fullscreen_control_popup.h"

#include <memory>

#include "base/bind.h"
#include "chrome/browser/ui/views/fullscreen_control/fullscreen_control_view.h"
#include "components/fullscreen_control/fullscreen_control_view.h"
#include "ui/compositor/scoped_layer_animation_settings.h"
#include "ui/views/widget/widget.h"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef CHROME_BROWSER_UI_VIEWS_FULLSCREEN_CONTROL_FULLSCREEN_CONTROL_POPUP_H_
#define CHROME_BROWSER_UI_VIEWS_FULLSCREEN_CONTROL_FULLSCREEN_CONTROL_POPUP_H_
#ifndef COMPONENTS_FULLSCREEN_CONTROL_FULLSCREEN_CONTROL_POPUP_H_
#define COMPONENTS_FULLSCREEN_CONTROL_FULLSCREEN_CONTROL_POPUP_H_

#include <memory>

Expand Down Expand Up @@ -79,4 +79,4 @@ class FullscreenControlPopup : public views::AnimationDelegateViews {
DISALLOW_COPY_AND_ASSIGN(FullscreenControlPopup);
};

#endif // CHROME_BROWSER_UI_VIEWS_FULLSCREEN_CONTROL_FULLSCREEN_CONTROL_POPUP_H_
#endif // COMPONENTS_FULLSCREEN_CONTROL_FULLSCREEN_CONTROL_POPUP_H_
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#include "base/test/test_mock_time_task_runner.h"
#include "base/threading/thread_task_runner_handle.h"
#include "base/time/time.h"
#include "chrome/browser/ui/views/fullscreen_control/fullscreen_control_popup.h"
#include "components/fullscreen_control/fullscreen_control_popup.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "ui/gfx/animation/animation_test_api.h"
#include "ui/views/test/widget_test.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "chrome/browser/ui/views/fullscreen_control/fullscreen_control_view.h"
#include "components/fullscreen_control/fullscreen_control_view.h"

#include <memory>

#include "base/callback.h"
#include "cc/paint/paint_flags.h"
#include "chrome/grit/generated_resources.h"
#include "components/strings/grit/components_strings.h"
#include "components/vector_icons/vector_icons.h"
#include "third_party/skia/include/core/SkColor.h"
#include "ui/base/l10n/l10n_util.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef CHROME_BROWSER_UI_VIEWS_FULLSCREEN_CONTROL_FULLSCREEN_CONTROL_VIEW_H_
#define CHROME_BROWSER_UI_VIEWS_FULLSCREEN_CONTROL_FULLSCREEN_CONTROL_VIEW_H_
#ifndef COMPONENTS_FULLSCREEN_CONTROL_FULLSCREEN_CONTROL_VIEW_H_
#define COMPONENTS_FULLSCREEN_CONTROL_FULLSCREEN_CONTROL_VIEW_H_

#include "base/callback.h"
#include "ui/views/controls/button/button.h"
Expand Down Expand Up @@ -32,4 +32,4 @@ class FullscreenControlView : public views::View {
views::Button* exit_fullscreen_button_;
};

#endif // CHROME_BROWSER_UI_VIEWS_FULLSCREEN_CONTROL_FULLSCREEN_CONTROL_VIEW_H_
#endif // COMPONENTS_FULLSCREEN_CONTROL_FULLSCREEN_CONTROL_VIEW_H_
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "chrome/browser/ui/views/fullscreen_control/fullscreen_control_view.h"
#include "components/fullscreen_control/fullscreen_control_view.h"

#include "testing/gtest/include/gtest/gtest.h"
#include "ui/views/controls/button/button.h"
Expand Down
6 changes: 6 additions & 0 deletions components/fullscreen_control_strings.grdp
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<grit-part>
<message name="IDS_EXIT_FULLSCREEN_MODE" desc="Clickable message displayed on entering full screen mode. Clicking on the link exits full screen mode.">
Exit full screen
</message>
</grit-part>
3 changes: 3 additions & 0 deletions components/fullscreen_control_strings_grdp/DIR_METADATA
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
monorail {
component: "UI>Browser"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
77262c576584a767eb718ce4e342d8c8b59d3d78
1 change: 1 addition & 0 deletions components/fullscreen_control_strings_grdp/OWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
file://components/fullscreen_control/OWNERS
5 changes: 5 additions & 0 deletions components/fullscreen_control_strings_grdp/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
This directory of image SHA-1 hashes is used to improve translations of UI
strings through context images for translators.

See also: [Chrome Translation Screenshots - Instructions & FAQ
](https://docs.google.com/document/d/1nwYWDny20icMSpLUuV_LgrlbWKrYpbXOERUIZNH636o/edit#heading=h.2t7lc4cxo2au)

0 comments on commit 2de97cc

Please sign in to comment.