From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Heilig Benedek Date: Sat, 10 Aug 2019 00:41:50 +0200 Subject: feat: enable picture in picture mode for video players These files are needed to implement PiP, but the Electron build patches out chrome's generated resources for our own. This updates the #include so that we don't get errors for Chrome's generated resources, which are non-existent because we don't generate them in our build. diff --git a/chrome/browser/ui/views/overlay/back_to_tab_image_button.cc b/chrome/browser/ui/views/overlay/back_to_tab_image_button.cc index 7bc8d118f87b91baf1c3bd1d34374996ab1d3638..2d2c1c86f311b07f0c2b09d5a4c082cc5599600c 100644 --- a/chrome/browser/ui/views/overlay/back_to_tab_image_button.cc +++ b/chrome/browser/ui/views/overlay/back_to_tab_image_button.cc @@ -5,7 +5,7 @@ #include "chrome/browser/ui/views/overlay/back_to_tab_image_button.h" #include "chrome/browser/ui/color/chrome_color_id.h" -#include "chrome/grit/generated_resources.h" +#include "electron/grit/electron_resources.h" #include "ui/base/l10n/l10n_util.h" #include "ui/base/metadata/metadata_impl_macros.h" #include "ui/base/models/image_model.h" diff --git a/chrome/browser/ui/views/overlay/back_to_tab_label_button.cc b/chrome/browser/ui/views/overlay/back_to_tab_label_button.cc index 7d0e39968bf34cdc99549cb48f6bf0a11c182565..f21c1672abf34dc9d19cd39c5d09083a60ef6978 100644 --- a/chrome/browser/ui/views/overlay/back_to_tab_label_button.cc +++ b/chrome/browser/ui/views/overlay/back_to_tab_label_button.cc @@ -5,7 +5,7 @@ #include "chrome/browser/ui/views/overlay/back_to_tab_label_button.h" #include "chrome/browser/ui/color/chrome_color_id.h" -#include "chrome/grit/generated_resources.h" +#include "electron/grit/electron_resources.h" #include "third_party/skia/include/core/SkColor.h" #include "ui/base/cursor/cursor.h" #include "ui/base/l10n/l10n_util.h" diff --git a/chrome/browser/ui/views/overlay/close_image_button.cc b/chrome/browser/ui/views/overlay/close_image_button.cc index d3400d7b02edc9cffba4cb53ec601b6e4cfea3b2..8e620ad6172a650ea96f80c0b44035932471d88b 100644 --- a/chrome/browser/ui/views/overlay/close_image_button.cc +++ b/chrome/browser/ui/views/overlay/close_image_button.cc @@ -6,7 +6,7 @@ #include "build/chromeos_buildflags.h" #include "chrome/browser/ui/color/chrome_color_id.h" -#include "chrome/grit/generated_resources.h" +#include "electron/grit/electron_resources.h" #include "ui/base/l10n/l10n_util.h" #include "ui/base/metadata/metadata_impl_macros.h" #include "ui/base/models/image_model.h" diff --git a/chrome/browser/ui/views/overlay/document_overlay_window_views.cc b/chrome/browser/ui/views/overlay/document_overlay_window_views.cc index 3309906bcae27ba89d73ce4fba49843a10cd31f6..9f828f70606238186b35b5e1ca8751134eaf3c33 100644 --- a/chrome/browser/ui/views/overlay/document_overlay_window_views.cc +++ b/chrome/browser/ui/views/overlay/document_overlay_window_views.cc @@ -15,24 +15,28 @@ #include "base/timer/timer.h" #include "build/build_config.h" #include "chrome/app/vector_icons/vector_icons.h" +#if 0 #include "chrome/browser/command_updater_delegate.h" #include "chrome/browser/command_updater_impl.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/themes/theme_service.h" #include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/browser_finder.h" +#endif #include "chrome/browser/ui/color/chrome_color_id.h" +#if 0 #include "chrome/browser/ui/toolbar/chrome_location_bar_model_delegate.h" #include "chrome/browser/ui/views/location_bar/location_bar_view.h" +#endif #include "chrome/browser/ui/views/overlay/back_to_tab_image_button.h" #include "chrome/browser/ui/views/overlay/close_image_button.h" #include "chrome/browser/ui/views/overlay/resize_handle_button.h" -#include "chrome/grit/generated_resources.h" #include "components/omnibox/browser/location_bar_model_impl.h" #include "components/vector_icons/vector_icons.h" #include "content/public/browser/document_picture_in_picture_window_controller.h" #include "content/public/browser/picture_in_picture_window_controller.h" #include "content/public/browser/web_contents.h" +#include "electron/grit/electron_resources.h" #include "content/public/common/content_constants.h" #include "media/base/media_switches.h" #include "media/base/video_util.h" @@ -57,7 +61,7 @@ #include "ui/aura/window.h" #endif -#if BUILDFLAG(IS_WIN) +#if 0 #include "chrome/browser/shell_integration_win.h" #include "ui/aura/window.h" #include "ui/aura/window_tree_host.h" @@ -109,7 +113,7 @@ END_METADATA } // namespace OverlayLocationBarViewProxy::~OverlayLocationBarViewProxy() = default; - +#if 0 class OverlayLocationBarViewImpl : public OverlayLocationBarViewProxy, public ChromeLocationBarModelDelegate, public LocationBarView::Delegate, @@ -167,7 +171,7 @@ class OverlayLocationBarViewImpl : public OverlayLocationBarViewProxy, const std::unique_ptr location_bar_model_; CommandUpdaterImpl command_updater_; }; - +#endif // static std::unique_ptr DocumentOverlayWindowViews::Create( content::DocumentPictureInPictureWindowController* controller, @@ -203,7 +207,7 @@ std::unique_ptr DocumentOverlayWindowViews::Create( overlay_window->Init(std::move(params)); overlay_window->OnRootViewReady(); -#if BUILDFLAG(IS_WIN) +#if 0 std::wstring app_user_model_id; Browser* browser = chrome::FindBrowserWithWebContents(controller->GetWebContents()); @@ -278,12 +282,6 @@ views::View* DocumentOverlayWindowViews::GetControlsContainerView() const { return controls_container_view_; } -const ui::ThemeProvider* DocumentOverlayWindowViews::GetThemeProvider() const { - // FIXME: is there a way to use a dark theme just for this window? - DCHECK(profile_for_theme_); - return &ThemeService::GetThemeProviderForProfile(profile_for_theme_); -} - void DocumentOverlayWindowViews::SetUpViews() { // The window content consists of the fixed-height controls_container_view at // the top which is a box layout, and the remainder of the view is filled with @@ -299,6 +297,7 @@ void DocumentOverlayWindowViews::SetUpViews() { // +-------------------------------------+ content::WebContents* pip_contents = controller_->GetChildWebContents(); +#if 0 auto* profile = Profile::FromBrowserContext(pip_contents->GetBrowserContext()); profile_for_theme_ = profile; @@ -309,8 +308,8 @@ void DocumentOverlayWindowViews::SetUpViews() { location_bar_view_proxy_ = std::make_unique( profile, controller_->GetWebContents()); } - - auto web_view = std::make_unique(profile); +#endif + auto web_view = std::make_unique(); DVLOG(2) << __func__ << ": content WebView=" << web_view.get(); web_view->SetWebContents(pip_contents); diff --git a/chrome/browser/ui/views/overlay/document_overlay_window_views.h b/chrome/browser/ui/views/overlay/document_overlay_window_views.h index 86d385842501d28b5eb42f841822294eb597e6ed..43c19dfa6ec6b48f8694636cc184dd616e5d6aca 100644 --- a/chrome/browser/ui/views/overlay/document_overlay_window_views.h +++ b/chrome/browser/ui/views/overlay/document_overlay_window_views.h @@ -55,7 +55,6 @@ class DocumentOverlayWindowViews : public OverlayWindowViews, bool IsVisible() const override; void OnNativeWidgetMove() override; void OnNativeWidgetDestroyed() override; - const ui::ThemeProvider* GetThemeProvider() const override; // OverlayWindowViews bool ControlsHitTestContainsPoint(const gfx::Point& point) override; diff --git a/chrome/browser/ui/views/overlay/hang_up_button.cc b/chrome/browser/ui/views/overlay/hang_up_button.cc index 26f8f5ffa444d874b229b5e8debf087e4469dfd1..10149e812a43e3d5c92701e9b2ae8d68ed8395c7 100644 --- a/chrome/browser/ui/views/overlay/hang_up_button.cc +++ b/chrome/browser/ui/views/overlay/hang_up_button.cc @@ -5,7 +5,7 @@ #include "chrome/browser/ui/views/overlay/hang_up_button.h" #include "chrome/browser/ui/color/chrome_color_id.h" -#include "chrome/grit/generated_resources.h" +#include "electron/grit/electron_resources.h" #include "components/vector_icons/vector_icons.h" #include "ui/base/l10n/l10n_util.h" #include "ui/base/metadata/metadata_impl_macros.h" diff --git a/chrome/browser/ui/views/overlay/overlay_window_views.cc b/chrome/browser/ui/views/overlay/overlay_window_views.cc index 850b34e3b40f7ff1848c66158976db079e0853bd..105dbc3661eb2710b2f10ca6584e85c36ad14705 100644 --- a/chrome/browser/ui/views/overlay/overlay_window_views.cc +++ b/chrome/browser/ui/views/overlay/overlay_window_views.cc @@ -14,13 +14,15 @@ #include "base/time/time.h" #include "base/timer/timer.h" #include "build/build_config.h" +#if 0 #include "chrome/browser/profiles/profile.h" #include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/browser_finder.h" -#include "chrome/grit/generated_resources.h" +#endif #include "components/vector_icons/vector_icons.h" #include "content/public/browser/picture_in_picture_window_controller.h" #include "content/public/browser/web_contents.h" +#include "electron/grit/electron_resources.h" #include "ui/base/hit_test.h" #include "ui/display/display.h" #include "ui/display/screen.h" @@ -36,7 +38,7 @@ #include "ui/aura/window.h" #endif -#if BUILDFLAG(IS_WIN) +#if 0 #include "chrome/browser/shell_integration_win.h" #include "ui/aura/window.h" #include "ui/aura/window_tree_host.h" diff --git a/chrome/browser/ui/views/overlay/playback_image_button.cc b/chrome/browser/ui/views/overlay/playback_image_button.cc index bcd3b2e1038786b660a4b91fbc20d9d8b4afffb4..a953c9d0ee0b49d6cc096e3eb236296b57cbc6c0 100644 --- a/chrome/browser/ui/views/overlay/playback_image_button.cc +++ b/chrome/browser/ui/views/overlay/playback_image_button.cc @@ -6,7 +6,7 @@ #include "chrome/app/vector_icons/vector_icons.h" #include "chrome/browser/ui/color/chrome_color_id.h" -#include "chrome/grit/generated_resources.h" +#include "electron/grit/electron_resources.h" #include "components/vector_icons/vector_icons.h" #include "ui/base/l10n/l10n_util.h" #include "ui/base/metadata/metadata_impl_macros.h" diff --git a/chrome/browser/ui/views/overlay/resize_handle_button.cc b/chrome/browser/ui/views/overlay/resize_handle_button.cc index 8bf217b9b0c2bd22d6940c24c58eccb9865c5286..91f061a1243135db475371dda00c2fe054f4e8e3 100644 --- a/chrome/browser/ui/views/overlay/resize_handle_button.cc +++ b/chrome/browser/ui/views/overlay/resize_handle_button.cc @@ -6,7 +6,7 @@ #include "chrome/app/vector_icons/vector_icons.h" #include "chrome/browser/ui/color/chrome_color_id.h" -#include "chrome/grit/generated_resources.h" +#include "electron/grit/electron_resources.h" #include "ui/base/hit_test.h" #include "ui/base/l10n/l10n_util.h" #include "ui/base/metadata/metadata_impl_macros.h" diff --git a/chrome/browser/ui/views/overlay/skip_ad_label_button.cc b/chrome/browser/ui/views/overlay/skip_ad_label_button.cc index 51c7db1bfbd3c03b9cb2786c8c7482b33e3aca0b..2890f7420d2fd258f84019963eab6c9606e228db 100644 --- a/chrome/browser/ui/views/overlay/skip_ad_label_button.cc +++ b/chrome/browser/ui/views/overlay/skip_ad_label_button.cc @@ -5,7 +5,7 @@ #include "chrome/browser/ui/views/overlay/skip_ad_label_button.h" #include "chrome/browser/ui/color/chrome_color_id.h" -#include "chrome/grit/generated_resources.h" +#include "electron/grit/electron_resources.h" #include "ui/base/l10n/l10n_util.h" #include "ui/base/metadata/metadata_impl_macros.h" #include "ui/gfx/color_palette.h" diff --git a/chrome/browser/ui/views/overlay/toggle_camera_button.cc b/chrome/browser/ui/views/overlay/toggle_camera_button.cc index 46ec4441ddb227325b319359f9d33a80aa856d85..57957d72310c0a232c78489fba5a07cdf475dc53 100644 --- a/chrome/browser/ui/views/overlay/toggle_camera_button.cc +++ b/chrome/browser/ui/views/overlay/toggle_camera_button.cc @@ -5,7 +5,7 @@ #include "chrome/browser/ui/views/overlay/toggle_camera_button.h" #include "chrome/browser/ui/color/chrome_color_id.h" -#include "chrome/grit/generated_resources.h" +#include "electron/grit/electron_resources.h" #include "components/vector_icons/vector_icons.h" #include "ui/base/l10n/l10n_util.h" #include "ui/base/metadata/metadata_impl_macros.h" diff --git a/chrome/browser/ui/views/overlay/toggle_microphone_button.cc b/chrome/browser/ui/views/overlay/toggle_microphone_button.cc index 59b9a5442185bfb9efd8ed571ec63d56e3bc3326..34d58bf54019e0b8001c29cb301861d045c60214 100644 --- a/chrome/browser/ui/views/overlay/toggle_microphone_button.cc +++ b/chrome/browser/ui/views/overlay/toggle_microphone_button.cc @@ -5,7 +5,7 @@ #include "chrome/browser/ui/views/overlay/toggle_microphone_button.h" #include "chrome/browser/ui/color/chrome_color_id.h" -#include "chrome/grit/generated_resources.h" +#include "electron/grit/electron_resources.h" #include "components/vector_icons/vector_icons.h" #include "ui/base/l10n/l10n_util.h" #include "ui/base/metadata/metadata_impl_macros.h" diff --git a/chrome/browser/ui/views/overlay/track_image_button.cc b/chrome/browser/ui/views/overlay/track_image_button.cc index 5e136488b37887e9523ac04a9ff4ccdfaf96c104..24899f4c2b6fe66b96a6728bf747f1aad66f20a9 100644 --- a/chrome/browser/ui/views/overlay/track_image_button.cc +++ b/chrome/browser/ui/views/overlay/track_image_button.cc @@ -6,7 +6,7 @@ #include "chrome/app/vector_icons/vector_icons.h" #include "chrome/browser/ui/color/chrome_color_id.h" -#include "chrome/grit/generated_resources.h" +#include "electron/grit/electron_resources.h" #include "components/vector_icons/vector_icons.h" #include "ui/base/l10n/l10n_util.h" #include "ui/base/metadata/metadata_impl_macros.h" diff --git a/chrome/browser/ui/views/overlay/video_overlay_window_views.cc b/chrome/browser/ui/views/overlay/video_overlay_window_views.cc index b2e281840f48592eb773c16042fb6b56a0fa132b..d5156bab0c81ca508733a8d3ba95f052ff6d83e6 100644 --- a/chrome/browser/ui/views/overlay/video_overlay_window_views.cc +++ b/chrome/browser/ui/views/overlay/video_overlay_window_views.cc @@ -15,9 +15,11 @@ #include "base/timer/timer.h" #include "build/build_config.h" #include "chrome/app/vector_icons/vector_icons.h" +#if 0 #include "chrome/browser/profiles/profile.h" #include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/browser_finder.h" +#endif #include "chrome/browser/ui/color/chrome_color_id.h" #include "chrome/browser/ui/views/overlay/back_to_tab_image_button.h" #include "chrome/browser/ui/views/overlay/back_to_tab_label_button.h" @@ -29,10 +31,10 @@ #include "chrome/browser/ui/views/overlay/toggle_camera_button.h" #include "chrome/browser/ui/views/overlay/toggle_microphone_button.h" #include "chrome/browser/ui/views/overlay/track_image_button.h" -#include "chrome/grit/generated_resources.h" #include "components/vector_icons/vector_icons.h" #include "content/public/browser/video_picture_in_picture_window_controller.h" #include "content/public/browser/web_contents.h" +#include "electron/grit/electron_resources.h" #include "media/base/media_switches.h" #include "media/base/video_util.h" #include "third_party/skia/include/core/SkColor.h" @@ -56,7 +58,7 @@ #include "ui/aura/window.h" #endif -#if BUILDFLAG(IS_WIN) +#if 0 #include "chrome/browser/shell_integration_win.h" #include "ui/aura/window.h" #include "ui/aura/window_tree_host.h" @@ -148,7 +150,7 @@ std::unique_ptr VideoOverlayWindowViews::Create( overlay_window->Init(std::move(params)); overlay_window->OnRootViewReady(); -#if BUILDFLAG(IS_WIN) +#if 0 std::wstring app_user_model_id; Browser* browser = chrome::FindBrowserWithWebContents(controller->GetWebContents());