mirror of
https://github.com/Alex313031/thorium.git
synced 2025-01-09 11:27:32 -03:00
add th24 loose files
This commit is contained in:
parent
8222996125
commit
7a40533d3f
1 changed files with 154 additions and 0 deletions
|
@ -1545,6 +1545,63 @@ index e7660352853f2..726ab047decb4 100644
|
|||
GetLayoutConstant(TAB_STRIP_PADDING) - view_size.width() - offset;
|
||||
const gfx::Rect new_bounds = gfx::Rect(gfx::Point(x, 0), view_size);
|
||||
view->SetBoundsRect(new_bounds);
|
||||
diff --git a/chrome/browser/ui/views/frame/window_caption_util.cc b/chrome/browser/ui/views/frame/window_caption_util.cc
|
||||
new file mode 100644
|
||||
index 0000000000000..04703d70ecf9b
|
||||
--- /dev/null
|
||||
+++ b/chrome/browser/ui/views/frame/window_caption_util.cc
|
||||
@@ -0,0 +1,24 @@
|
||||
+// Copyright 2024 The Chromium Authors and Alex313031
|
||||
+// 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/frame/window_caption_util.h"
|
||||
+
|
||||
+#include "build/build_config.h"
|
||||
+#include "chrome/browser/ui/browser.h"
|
||||
+#include "chrome/browser/ui/thorium_2024.h"
|
||||
+
|
||||
+// static
|
||||
+bool WindowCaptionUtil::IsWindowsTabSearchCaptionButtonEnabled(
|
||||
+ const Browser* browser) {
|
||||
+#if BUILDFLAG(IS_WIN)
|
||||
+ static const bool remove_tabsearch_button =
|
||||
+ base::CommandLine::ForCurrentProcess()->HasSwitch("remove-tabsearch-button");
|
||||
+ static const bool disable_caption_button =
|
||||
+ base::CommandLine::ForCurrentProcess()->HasSwitch("disable-caption-button");
|
||||
+ return features::IsThorium2024() && browser->is_type_normal() &&
|
||||
+ !remove_tabsearch_button && !disable_caption_button;
|
||||
+#else
|
||||
+ return false;
|
||||
+#endif // BUILDFLAG(IS_WIN)
|
||||
+}
|
||||
diff --git a/chrome/browser/ui/views/frame/window_caption_util.h b/chrome/browser/ui/views/frame/window_caption_util.h
|
||||
new file mode 100644
|
||||
index 0000000000000..92e166d7ca93c
|
||||
--- /dev/null
|
||||
+++ b/chrome/browser/ui/views/frame/window_caption_util.h
|
||||
@@ -0,0 +1,21 @@
|
||||
+// Copyright 2024 The Chromium Authors and Alex313031
|
||||
+// 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_FRAME_WINDOW_CAPTION_UTIL_H_
|
||||
+#define CHROME_BROWSER_UI_VIEWS_FRAME_WINDOW_CAPTION_UTIL_H_
|
||||
+
|
||||
+class Browser;
|
||||
+
|
||||
+// Static-only class containing values and helper functions for frame classes
|
||||
+// that need to be accessible outside of /browser/ui/views.
|
||||
+class WindowCaptionUtil {
|
||||
+ public:
|
||||
+ // Returns true if the Windows caption button is enabled.
|
||||
+ static bool IsWindowsTabSearchCaptionButtonEnabled(const Browser* browser);
|
||||
+
|
||||
+ private:
|
||||
+ WindowCaptionUtil() {}
|
||||
+};
|
||||
+
|
||||
+#endif // CHROME_BROWSER_UI_VIEWS_FRAME_WINDOW_CAPTION_UTIL_H_
|
||||
diff --git a/chrome/browser/ui/views/frame/windows_caption_button.cc b/chrome/browser/ui/views/frame/windows_caption_button.cc
|
||||
index d8000f801d188..7f69dd091d42a 100644
|
||||
--- a/chrome/browser/ui/views/frame/windows_caption_button.cc
|
||||
|
@ -2064,6 +2121,103 @@ index e368f860ec9a7..b81b109035cdd 100644
|
|||
"toolbar_action_hover_card_bubble_view.cc",
|
||||
"toolbar_action_hover_card_bubble_view.h",
|
||||
"toolbar_action_hover_card_controller.cc",
|
||||
diff --git a/chrome/browser/ui/views/toolbar/restore_tab_button.cc b/chrome/browser/ui/views/toolbar/restore_tab_button.cc
|
||||
new file mode 100644
|
||||
index 0000000000000..60be9a17489bf
|
||||
--- /dev/null
|
||||
+++ b/chrome/browser/ui/views/toolbar/restore_tab_button.cc
|
||||
@@ -0,0 +1,54 @@
|
||||
+// Copyright 2024 The Chromium Authors and Alex313031
|
||||
+// 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/toolbar/restore_tab_button.h"
|
||||
+
|
||||
+#include "chrome/app/chrome_command_ids.h"
|
||||
+#include "chrome/browser/command_updater.h"
|
||||
+#include "chrome/browser/external_protocol/external_protocol_handler.h"
|
||||
+#include "chrome/browser/ui/browser.h"
|
||||
+#include "components/vector_icons/vector_icons.h"
|
||||
+//#include "ui/base/l10n/l10n_util.h"
|
||||
+#include "ui/base/metadata/metadata_impl_macros.h"
|
||||
+#include "ui/base/ui_base_features.h"
|
||||
+#include "ui/views/accessibility/view_accessibility.h"
|
||||
+#include "ui/views/controls/button/button_controller.h"
|
||||
+
|
||||
+RestoreTabButton::RestoreTabButton(CommandUpdater* command_updater)
|
||||
+ : ToolbarButton(base::BindRepeating(&RestoreTabButton::ButtonPressed,
|
||||
+ base::Unretained(this))),
|
||||
+ command_updater_(command_updater) {
|
||||
+
|
||||
+ SetIcon();
|
||||
+
|
||||
+ constexpr char16_t RestoreTabAccessName[] = u"Restore Tab Button";
|
||||
+ GetViewAccessibility().SetName(RestoreTabAccessName);
|
||||
+ constexpr char16_t RestoreTabAccessToolTipName[] = u"Restore Tab";
|
||||
+ SetTooltipText(RestoreTabAccessToolTipName);
|
||||
+ button_controller()->set_notify_action(
|
||||
+ views::ButtonController::NotifyAction::kOnPress);
|
||||
+}
|
||||
+
|
||||
+RestoreTabButton::~RestoreTabButton() = default;
|
||||
+
|
||||
+void RestoreTabButton::ButtonPressed() {
|
||||
+ ExternalProtocolHandler::PermitLaunchUrl();
|
||||
+
|
||||
+ int command = IDC_RESTORE_TAB;
|
||||
+ ExecuteBrowserCommand(command);
|
||||
+}
|
||||
+
|
||||
+void RestoreTabButton::SetIcon() {
|
||||
+ SetVectorIcon(vector_icons::kRestoreIcon);
|
||||
+}
|
||||
+
|
||||
+void RestoreTabButton::ExecuteBrowserCommand(int command) {
|
||||
+ if (!command_updater_) {
|
||||
+ return;
|
||||
+ }
|
||||
+ command_updater_->ExecuteCommand(command);
|
||||
+}
|
||||
+
|
||||
+BEGIN_METADATA(RestoreTabButton)
|
||||
+END_METADATA
|
||||
diff --git a/chrome/browser/ui/views/toolbar/restore_tab_button.h b/chrome/browser/ui/views/toolbar/restore_tab_button.h
|
||||
new file mode 100644
|
||||
index 0000000000000..43b9476bb127c
|
||||
--- /dev/null
|
||||
+++ b/chrome/browser/ui/views/toolbar/restore_tab_button.h
|
||||
@@ -0,0 +1,31 @@
|
||||
+// Copyright 2024 The Chromium Authors and Alex313031
|
||||
+// 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_TOOLBAR_RESTORE_TAB_BUTTON_H_
|
||||
+#define CHROME_BROWSER_UI_VIEWS_TOOLBAR_RESTORE_TAB_BUTTON_H_
|
||||
+
|
||||
+#include "base/memory/raw_ptr.h"
|
||||
+#include "chrome/browser/ui/views/toolbar/toolbar_button.h"
|
||||
+#include "ui/base/metadata/metadata_header_macros.h"
|
||||
+
|
||||
+class CommandUpdater;
|
||||
+
|
||||
+class RestoreTabButton : public ToolbarButton {
|
||||
+ METADATA_HEADER(RestoreTabButton, ToolbarButton)
|
||||
+
|
||||
+ public:
|
||||
+ explicit RestoreTabButton(CommandUpdater* command_updater);
|
||||
+ RestoreTabButton(const RestoreTabButton&) = delete;
|
||||
+ RestoreTabButton& operator=(const RestoreTabButton&) = delete;
|
||||
+ ~RestoreTabButton() override;
|
||||
+
|
||||
+ private:
|
||||
+ void SetIcon();
|
||||
+ void ButtonPressed();
|
||||
+ void ExecuteBrowserCommand(int command);
|
||||
+
|
||||
+ raw_ptr<CommandUpdater, DanglingUntriaged> command_updater_;
|
||||
+};
|
||||
+
|
||||
+#endif // CHROME_BROWSER_UI_VIEWS_TOOLBAR_RESTORE_TAB_BUTTON_H_
|
||||
diff --git a/chrome/browser/ui/views/toolbar/toolbar_view.cc b/chrome/browser/ui/views/toolbar/toolbar_view.cc
|
||||
index 577215577d9ac..3d63a1a714ef3 100644
|
||||
--- a/chrome/browser/ui/views/toolbar/toolbar_view.cc
|
||||
|
|
Loading…
Reference in a new issue