-
-
Notifications
You must be signed in to change notification settings - Fork 153
/
thorium-2024-ui.patch
2128 lines (1992 loc) · 88.6 KB
/
thorium-2024-ui.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
diff --git a/chrome/browser/extensions/api/messaging/launch_context_win.cc b/chrome/browser/extensions/api/messaging/launch_context_win.cc
index b103bbe61303d..469611cb36e7a 100644
--- a/chrome/browser/extensions/api/messaging/launch_context_win.cc
+++ b/chrome/browser/extensions/api/messaging/launch_context_win.cc
@@ -62,7 +62,7 @@ bool GetManifestPathWithFlags(HKEY root_key,
std::wstring* result) {
#if BUILDFLAG(CHROMIUM_BRANDING)
static constexpr wchar_t kChromiumNativeMessagingRegistryKey[] =
- L"SOFTWARE\\Chromium\\NativeMessagingHosts";
+ L"SOFTWARE\\Thorium\\NativeMessagingHosts";
// Try to read the path using the Chromium-specific registry for Chromium.
// If that fails, fallback to Chrome-specific registry key below.
diff --git a/chrome/browser/resources/downloads/item.html b/chrome/browser/resources/downloads/item.html
index eb515155212c9..0633e101be077 100644
--- a/chrome/browser/resources/downloads/item.html
+++ b/chrome/browser/resources/downloads/item.html
@@ -384,7 +384,7 @@
hidden="[[!shouldShowReferrerUrl_(data.displayReferrerUrl)]]">
<!-- Text populated dynamically -->
</div>
- <a id="url" hidden="[[showReferrerUrl_]]" target="_blank"
+ <a id="url" target="_blank"
on-click="onUrlClick_" focus-row-control
focus-type="url">[[getDisplayUrlStr_(data.displayUrl)]]</a>
</div>
@@ -430,9 +430,6 @@
<!-- Menu and/or quick action(s). -->
<div role="gridcell" id="action-icon-buttons">
<cr-icon-button id="more-actions" iron-icon="cr:more-vert"
- hidden="[[!computeShowActionMenu_(pauseOrResumeText_,
- isDangerous_, isReviewable_, showDeepScan_, showCancel_,
- showOpenAnyway_, data.state, data.retry, data.dangerType)]]"
class="dropdown-trigger" title="$i18n{moreActions}"
on-click="onMoreActionsClick_" aria-haspopup="menu"
focus-row-control focus-type="actionMenuButton">
diff --git a/chrome/browser/resources/pdf/manifest.json b/chrome/browser/resources/pdf/manifest.json
index f355f92ac2f37..e0b69081164fd 100644
--- a/chrome/browser/resources/pdf/manifest.json
+++ b/chrome/browser/resources/pdf/manifest.json
@@ -3,8 +3,8 @@
"manifest_version": 2,
"key": "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDN6hM0rsDYGbzQPQfOygqlRtQgKUXMfnSjhIBL7LnReAVBEd7ZmKtyN2qmSasMl4HZpMhVe2rPWVVwBDl6iyNE/Kok6E6v6V3vCLGsOpQAuuNVye/3QxzIldzG/jQAdWZiyXReRVapOhZtLjGfywCvlWq7Sl/e3sbc0vWybSDI2QIDAQAB",
"name": "<NAME>",
- "version": "1",
- "description": "",
+ "version": "1.0.1",
+ "description": "Internal Component Extension for rendering PDFs.",
"offline_enabled": true,
"incognito": "split",
"permissions": [
diff --git a/chrome/browser/search/search.cc b/chrome/browser/search/search.cc
index 916e1c043f3e5..9bc0ea94e459a 100644
--- a/chrome/browser/search/search.cc
+++ b/chrome/browser/search/search.cc
@@ -95,17 +95,6 @@ enum NewTabURLState {
NEW_TAB_URL_MAX
};
-const TemplateURL* GetDefaultSearchProviderTemplateURL(Profile* profile) {
- if (profile) {
- TemplateURLService* template_url_service =
- TemplateURLServiceFactory::GetForProfile(profile);
- if (template_url_service) {
- return template_url_service->GetDefaultSearchProvider();
- }
- }
- return nullptr;
-}
-
bool IsMatchingServiceWorker(const GURL& my_url, const GURL& document_url) {
// The origin should match.
if (!MatchesOrigin(my_url, document_url)) {
@@ -142,21 +131,6 @@ bool IsNTPOrRelatedURLHelper(const GURL& url, Profile* profile) {
IsMatchingServiceWorker(url, new_tab_url));
}
-bool IsURLAllowedForSupervisedUser(const GURL& url, Profile& profile) {
- if (!supervised_user::IsSubjectToParentalControls(*profile.GetPrefs())) {
- return true;
- }
- supervised_user::SupervisedUserService* supervised_user_service =
- SupervisedUserServiceFactory::GetForProfile(&profile);
- supervised_user::SupervisedUserURLFilter* url_filter =
- supervised_user_service->GetURLFilter();
- if (url_filter->GetFilteringBehaviorForURL(url) ==
- supervised_user::FilteringBehavior::kBlock) {
- return false;
- }
- return true;
-}
-
// Used to look up the URL to use for the New Tab page. Also tracks how we
// arrived at that URL so it can be logged with UMA.
struct NewTabURLDetails {
@@ -179,33 +153,9 @@ struct NewTabURLDetails {
const GURL local_url(default_is_google
? chrome::kChromeUINewTabPageURL
: chrome::kChromeUINewTabPageThirdPartyURL);
- if (default_is_google) {
- return NewTabURLDetails(local_url, NEW_TAB_URL_VALID);
- }
#endif
- const TemplateURL* template_url =
- GetDefaultSearchProviderTemplateURL(profile);
- if (!profile || !template_url) {
- return NewTabURLDetails(local_url, NEW_TAB_URL_BAD);
- }
-
- GURL search_provider_url(template_url->new_tab_url_ref().ReplaceSearchTerms(
- TemplateURLRef::SearchTermsArgs(std::u16string()),
- UIThreadSearchTermsData()));
-
- if (!search_provider_url.is_valid()) {
- return NewTabURLDetails(local_url, NEW_TAB_URL_NOT_SET);
- }
- if (!search_provider_url.SchemeIsCryptographic()) {
- return NewTabURLDetails(local_url, NEW_TAB_URL_INSECURE);
- }
- if (!IsURLAllowedForSupervisedUser(search_provider_url,
- CHECK_DEREF(profile))) {
- return NewTabURLDetails(local_url, NEW_TAB_URL_BLOCKED);
- }
-
- return NewTabURLDetails(search_provider_url, NEW_TAB_URL_VALID);
+ return NewTabURLDetails(local_url, NEW_TAB_URL_VALID);
}
const GURL url;
diff --git a/chrome/browser/ui/bookmarks/bookmark_utils.cc b/chrome/browser/ui/bookmarks/bookmark_utils.cc
index e7858be996ca8..c0b2695b6e00b 100644
--- a/chrome/browser/ui/bookmarks/bookmark_utils.cc
+++ b/chrome/browser/ui/bookmarks/bookmark_utils.cc
@@ -318,8 +318,35 @@ ui::ImageModel GetBookmarkFolderIcon(
absl::variant<ui::ColorId, SkColor> color,
const ui::ColorProvider* color_provider) {
gfx::ImageSkia folder;
- folder =
- GetBookmarkFolderImageFromVectorIcon(icon_type, color, color_provider);
+ if (features::IsThorium2024()) {
+#if BUILDFLAG(IS_WIN)
+ // TODO(bsep): vectorize the Windows versions: crbug.com/564112
+ folder = *ui::ResourceBundle::GetSharedInstance().GetImageSkiaNamed(
+ default_id);
+#elif BUILDFLAG(IS_MAC)
+ SkColor sk_color;
+ if (absl::holds_alternative<SkColor>(color)) {
+ sk_color = absl::get<SkColor>(color);
+ } else {
+ DCHECK(color_provider);
+ sk_color = color_provider->GetColor(absl::get<ui::ColorId>(color));
+ }
+ const int white_id = (icon_type == BookmarkFolderIconType::kNormal)
+ ? IDR_FOLDER_CLOSED_WHITE
+ : IDR_BOOKMARK_BAR_FOLDER_MANAGED_WHITE;
+ const int resource_id =
+ color_utils::IsDark(sk_color) ? default_id : white_id;
+ folder = *ui::ResourceBundle::GetSharedInstance()
+ .GetNativeImageNamed(resource_id)
+ .ToImageSkia();
+#else
+ folder = GetBookmarkFolderImageFromVectorIcon(icon_type, color,
+ color_provider);
+#endif
+ } else {
+ folder =
+ GetBookmarkFolderImageFromVectorIcon(icon_type, color, color_provider);
+ }
return gfx::ImageSkia(std::make_unique<RTLFlipSource>(folder),
folder.size());
};
diff --git a/chrome/browser/ui/bookmarks/bookmark_utils_desktop.cc b/chrome/browser/ui/bookmarks/bookmark_utils_desktop.cc
index 64948595a4bc6..a568c893736ca 100644
--- a/chrome/browser/ui/bookmarks/bookmark_utils_desktop.cc
+++ b/chrome/browser/ui/bookmarks/bookmark_utils_desktop.cc
@@ -47,7 +47,7 @@ using bookmarks::BookmarkNode;
namespace chrome {
-size_t kNumBookmarkUrlsBeforePrompting = 15;
+size_t kNumBookmarkUrlsBeforePrompting = 50;
static BookmarkNavigationWrapper* g_nav_wrapper_test_instance = nullptr;
diff --git a/chrome/browser/ui/bookmarks/recently_used_folders_combo_model.cc b/chrome/browser/ui/bookmarks/recently_used_folders_combo_model.cc
index 71f9d6ad07da0..246532a09797a 100644
--- a/chrome/browser/ui/bookmarks/recently_used_folders_combo_model.cc
+++ b/chrome/browser/ui/bookmarks/recently_used_folders_combo_model.cc
@@ -133,10 +133,6 @@ std::optional<size_t> RecentlyUsedFoldersComboModel::GetDefaultIndex() const {
// TODO(pbos): Look at returning -1 here if there's no default index. Right
// now a lot of code in Combobox assumes an index within `items_` bounds.
auto it = base::ranges::find(items_, Item(parent_node_, Item::TYPE_NODE));
- if (it == items_.end()) {
- it = base::ranges::find(items_,
- Item(parent_node_, Item::TYPE_ALL_BOOKMARKS_NODE));
- }
return it == items_.end() ? 0 : static_cast<int>(it - items_.begin());
}
diff --git a/chrome/browser/ui/browser_command_controller.cc b/chrome/browser/ui/browser_command_controller.cc
index 8837e8baf3025..1d95a1a3ddf46 100644
--- a/chrome/browser/ui/browser_command_controller.cc
+++ b/chrome/browser/ui/browser_command_controller.cc
@@ -1433,7 +1433,8 @@ void BrowserCommandController::InitCommandState() {
command_updater_.UpdateCommandEnabled(IDC_WINDOW_CLOSE_OTHER_TABS,
normal_window);
- const bool enable_tab_search_commands = browser_->is_type_normal();
+ const bool enable_tab_search_commands = browser_->is_type_normal() &&
+ !base::CommandLine::ForCurrentProcess()->HasSwitch("remove-tabsearch-button");
command_updater_.UpdateCommandEnabled(IDC_TAB_SEARCH,
enable_tab_search_commands);
command_updater_.UpdateCommandEnabled(IDC_TAB_SEARCH_CLOSE,
diff --git a/chrome/browser/ui/layout_constants.cc b/chrome/browser/ui/layout_constants.cc
index ea5c2c05f5fa9..5db2dac1b2fa2 100644
--- a/chrome/browser/ui/layout_constants.cc
+++ b/chrome/browser/ui/layout_constants.cc
@@ -7,6 +7,7 @@
#include "base/feature_list.h"
#include "base/notreached.h"
#include "build/build_config.h"
+#include "chrome/browser/ui/thorium_2024.h"
#include "chrome/browser/ui/tabs/features.h"
#include "chrome/browser/ui/ui_features.h"
#include "components/omnibox/common/omnibox_features.h"
@@ -22,20 +23,25 @@ int GetLayoutConstant(LayoutConstant constant) {
const bool touch_ui = ui::TouchUiController::Get()->touch_ui();
switch (constant) {
case APP_MENU_PROFILE_ROW_AVATAR_ICON_SIZE:
- return 24;
+ return features::IsThorium2024() ? 18 : 24;
case APP_MENU_MAXIMUM_CHARACTER_LENGTH:
return 30;
case BOOKMARK_BAR_HEIGHT: {
// The fixed margin ensures the bookmark buttons appear centered relative
// to the white space above and below.
- const int bookmark_bar_attached_vertical_margin = 6;
+ const int bookmark_bar_attached_vertical_margin = features::IsThorium2024() ? 3 : 6;
return GetLayoutConstant(BOOKMARK_BAR_BUTTON_HEIGHT) +
bookmark_bar_attached_vertical_margin;
}
- case BOOKMARK_BAR_BUTTON_HEIGHT:
- return touch_ui ? 36 : 28;
+ case BOOKMARK_BAR_BUTTON_HEIGHT: {
+ if (features::IsThorium2024()) {
+ return touch_ui ? 34 : 26;
+ } else {
+ return touch_ui ? 36 : 28;
+ }
+ }
case BOOKMARK_BAR_BUTTON_PADDING:
- return GetLayoutConstant(TOOLBAR_ELEMENT_PADDING);
+ return features::IsThorium2024() ? 2 : GetLayoutConstant(TOOLBAR_ELEMENT_PADDING);
case BOOKMARK_BAR_BUTTON_IMAGE_LABEL_PADDING:
return 6;
case WEB_APP_MENU_BUTTON_SIZE:
@@ -85,6 +91,8 @@ int GetLayoutConstant(LayoutConstant constant) {
return 16;
case TAB_ALERT_INDICATOR_ICON_WIDTH:
return touch_ui ? 12 : 16;
+ case TAB_BUTTON_OFFSET:
+ return features::IsThorium2024() ? -1 : 0;
case TAB_CLOSE_BUTTON_SIZE:
return touch_ui ? 24 : 16;
case TAB_HEIGHT:
@@ -93,7 +101,13 @@ int GetLayoutConstant(LayoutConstant constant) {
return GetLayoutConstant(TAB_HEIGHT) +
GetLayoutConstant(TAB_STRIP_PADDING);
case TAB_STRIP_PADDING:
- return 6;
+ return features::IsThorium2024() ? 0 : 6;
+ case TAB_MARGIN:
+ return features::IsThorium2024() ? 6 : 6;
+ case TAB_INACTIVE_PADDING:
+ return features::IsThorium2024() ? 3 : 6;
+ case TAB_SEARCH_PADDING:
+ return features::IsThorium2024() ? 3 : 6;
case TAB_SEPARATOR_HEIGHT:
return touch_ui ? 24 : 20;
case TAB_PRE_TITLE_PADDING:
@@ -112,9 +126,13 @@ int GetLayoutConstant(LayoutConstant constant) {
case TOOLBAR_DIVIDER_CORNER_RADIUS:
return 1;
case TOOLBAR_DIVIDER_HEIGHT:
- return touch_ui ? 20 : 16;
+ if (features::IsThorium2024()) {
+ return 18;
+ } else {
+ return touch_ui ? 20 : 16;
+ }
case TOOLBAR_DIVIDER_SPACING:
- return 9;
+ return features::IsThorium2024() ? 7 : 9;
case TOOLBAR_DIVIDER_WIDTH:
return 2;
case TOOLBAR_ELEMENT_PADDING:
@@ -122,13 +140,17 @@ int GetLayoutConstant(LayoutConstant constant) {
case TOOLBAR_ICON_DEFAULT_MARGIN:
return touch_ui ? 0 : 2;
case TOOLBAR_STANDARD_SPACING:
- return touch_ui ? 12 : 9;
+ if (features::IsThorium2024()) {
+ return touch_ui ? 12 : 6;
+ } else {
+ return touch_ui ? 12 : 9;
+ }
case PAGE_INFO_ICON_SIZE:
return 20;
case DOWNLOAD_ICON_SIZE:
return 20;
case TOOLBAR_CORNER_RADIUS:
- return 8;
+ return 0;
default:
break;
}
@@ -146,7 +168,11 @@ gfx::Insets GetLayoutInsets(LayoutInset inset) {
return gfx::Insets::VH(8, 20);
case LOCATION_BAR_ICON_INTERIOR_PADDING:
- return gfx::Insets::VH(2, 2);
+ if (features::IsThorium2024()) {
+ return touch_ui ? gfx::Insets::VH(5, 10) : gfx::Insets::VH(4, 8);
+ } else {
+ return gfx::Insets::VH(2, 2);
+ }
case LOCATION_BAR_PAGE_INFO_ICON_PADDING:
return touch_ui ? gfx::Insets::VH(5, 10) : gfx::Insets::VH(4, 4);
@@ -161,7 +187,8 @@ gfx::Insets GetLayoutInsets(LayoutInset inset) {
}
case TOOLBAR_BUTTON:
- return gfx::Insets(touch_ui ? 12 : 7);
+ return gfx::Insets(touch_ui ? 12
+ : (features::IsThorium2024() ? 6 : 7));
case BROWSER_APP_MENU_CHIP_PADDING:
if (touch_ui) {
@@ -178,10 +205,18 @@ gfx::Insets GetLayoutInsets(LayoutInset inset) {
}
case TOOLBAR_INTERIOR_MARGIN:
- return touch_ui ? gfx::Insets() : gfx::Insets::VH(6, 5);
+ if (features::IsThorium2024()) {
+ return touch_ui ? gfx::Insets() : gfx::Insets::VH(4, 6);
+ } else {
+ return touch_ui ? gfx::Insets() : gfx::Insets::VH(6, 5);
+ }
case WEBUI_TAB_STRIP_TOOLBAR_INTERIOR_MARGIN:
- return gfx::Insets::VH(4, 0);
+ if (features::IsThorium2024()) {
+ return gfx::Insets::VH(4, 6);
+ } else {
+ return gfx::Insets::VH(4, 0);
+ }
}
NOTREACHED_IN_MIGRATION();
return gfx::Insets();
diff --git a/chrome/browser/ui/layout_constants.h b/chrome/browser/ui/layout_constants.h
index a35795ee8cc11..60577ba01a5fd 100644
--- a/chrome/browser/ui/layout_constants.h
+++ b/chrome/browser/ui/layout_constants.h
@@ -123,9 +123,21 @@ enum LayoutConstant {
// detached tab, and on all sides of the controls padding.
TAB_STRIP_PADDING,
+ // For the tab margins
+ TAB_MARGIN,
+
+ // For inactive tab padding
+ TAB_INACTIVE_PADDING,
+
// The height of a separator in the tabstrip.
TAB_SEPARATOR_HEIGHT,
+ // Padding for the tab search button
+ TAB_SEARCH_PADDING,
+
+ // Offset y for new tab button
+ TAB_BUTTON_OFFSET,
+
// Padding before the tab title.
TAB_PRE_TITLE_PADDING,
diff --git a/chrome/browser/ui/status_bubble.h b/chrome/browser/ui/status_bubble.h
index 74a00df155806..00945e93c0afa 100644
--- a/chrome/browser/ui/status_bubble.h
+++ b/chrome/browser/ui/status_bubble.h
@@ -18,7 +18,7 @@ class GURL;
class StatusBubble {
public:
// On hover, expand status bubble to fit long URL after this delay.
- static const int kExpandHoverDelayMS = 1600;
+ static const int kExpandHoverDelayMS = 1;
virtual ~StatusBubble() {}
diff --git a/chrome/browser/ui/tabs/tab_menu_model.cc b/chrome/browser/ui/tabs/tab_menu_model.cc
index d2aae6af7306b..da6152848c9e4 100644
--- a/chrome/browser/ui/tabs/tab_menu_model.cc
+++ b/chrome/browser/ui/tabs/tab_menu_model.cc
@@ -105,6 +105,10 @@ void TabMenuModel::Build(TabStripModel* tab_strip, int index) {
AddItemWithStringId(TabStripModel::CommandNewTabToRight,
base::i18n::IsRTL() ? IDS_TAB_CXMENU_NEWTABTOLEFT
: IDS_TAB_CXMENU_NEWTABTORIGHT);
+ AddItemWithStringId(TabStripModel::CommandNewTabToLeft,
+ base::i18n::IsRTL() ? IDS_TAB_CXMENU_NEWTABTORIGHT
+ : IDS_TAB_CXMENU_NEWTABTOLEFT);
+ //AddItemWithStringId(IDC_RESTORE_TAB, IDS_RESTORE_TAB);
if (tab_strip->delegate()->SupportsReadLater()) {
AddItem(
TabStripModel::CommandAddToReadLater,
diff --git a/chrome/browser/ui/tabs/tab_strip_model.cc b/chrome/browser/ui/tabs/tab_strip_model.cc
index 89df9a7f7a805..d52782a295e31 100644
--- a/chrome/browser/ui/tabs/tab_strip_model.cc
+++ b/chrome/browser/ui/tabs/tab_strip_model.cc
@@ -1296,6 +1296,7 @@ bool TabStripModel::IsContextMenuCommandEnabled(
ContextMenuCommand command_id) const {
DCHECK(command_id > CommandFirst && command_id < CommandLast);
switch (command_id) {
+ case CommandNewTabToLeft:
case CommandNewTabToRight:
case CommandCloseTab:
return true;
@@ -1397,6 +1398,16 @@ void TabStripModel::ExecuteContextMenuCommand(int context_index,
if (!ContainsIndex(context_index))
return;
switch (command_id) {
+
+ case CommandNewTabToLeft: {
+ base::RecordAction(UserMetricsAction("TabContextMenu_NewTab"));
+ UMA_HISTOGRAM_ENUMERATION("Tab.NewTab", NewTabTypes::NEW_TAB_CONTEXT_MENU,
+ NewTabTypes::NEW_TAB_ENUM_COUNT);
+ delegate()->AddTabAt(GURL(), context_index, true,
+ GetTabGroupForTab(context_index));
+ break;
+ }
+
case CommandNewTabToRight: {
base::RecordAction(UserMetricsAction("TabContextMenu_NewTab"));
UMA_HISTOGRAM_ENUMERATION("Tab.NewTab", NewTabTypes::NEW_TAB_CONTEXT_MENU,
diff --git a/chrome/browser/ui/tabs/tab_strip_model.h b/chrome/browser/ui/tabs/tab_strip_model.h
index 7f2f57facf152..3638494eb0dbf 100644
--- a/chrome/browser/ui/tabs/tab_strip_model.h
+++ b/chrome/browser/ui/tabs/tab_strip_model.h
@@ -547,6 +547,7 @@ class TabStripModel : public TabGroupController {
// for entries in the 'Add to existing group' submenu.
enum ContextMenuCommand {
CommandFirst,
+ CommandNewTabToLeft,
CommandNewTabToRight,
CommandReload,
CommandDuplicate,
diff --git a/chrome/browser/ui/tabs/tab_style.cc b/chrome/browser/ui/tabs/tab_style.cc
index b32265fa04597..35e5182f22671 100644
--- a/chrome/browser/ui/tabs/tab_style.cc
+++ b/chrome/browser/ui/tabs/tab_style.cc
@@ -6,6 +6,7 @@
#include "chrome/browser/ui/layout_constants.h"
#include "chrome/browser/ui/tabs/features.h"
+#include "chrome/browser/ui/thorium_2024.h"
#include "chrome/browser/ui/ui_features.h"
#include "ui/base/ui_base_features.h"
#include "ui/color/color_provider.h"
@@ -16,13 +17,18 @@ namespace {
// Thickness in DIPs of the separator painted on the left and right edges of
// the tab.
+constexpr int kThoriumSeparatorThickness = 2;
constexpr int kChromeRefreshSeparatorThickness = 2;
+constexpr float kThoriumSeparatorHorizontalMargin = 0.0f;
constexpr int kChromeRefreshSeparatorHorizontalMargin = 2;
// TODO (crbug.com/1451400): This constant should be in LayoutConstants.
+constexpr int kThoriumSeparatorHeight = 20;
constexpr int kChromeRefreshSeparatorHeight = 16;
// The padding from the top of the tab to the content area.
+constexpr int kThoriumTabVerticalPadding = 9;
constexpr int kChromeRefreshTabVerticalPadding = 6;
+constexpr int kThoriumTabHorizontalPadding = 6;
constexpr int kChromeRefreshTabHorizontalPadding = 8;
class ChromeRefresh2023TabStyle : public TabStyle {
@@ -54,8 +60,28 @@ class ChromeRefresh2023TabStyle : public TabStyle {
TabStyle::~TabStyle() = default;
int ChromeRefresh2023TabStyle::GetStandardWidth() const {
+
+ const std::string custom_tab_width = base::CommandLine::ForCurrentProcess()->
+ GetSwitchValueASCII("custom-tab-width");
+ int kTabWidthValue;
+ if (custom_tab_width == "60") {
+ kTabWidthValue = 60;
+ } else if (custom_tab_width == "120") {
+ kTabWidthValue = 120;
+ } else if (custom_tab_width == "180") {
+ kTabWidthValue = 180;
+ } else if (custom_tab_width == "240") {
+ kTabWidthValue = 240;
+ } else if (custom_tab_width == "300") {
+ kTabWidthValue = 300;
+ } else if (custom_tab_width == "400") {
+ kTabWidthValue = 400;
+ } else {
+ kTabWidthValue = 240;
+ }
+
// The standard tab width is 240 DIP including both separators.
- constexpr int kTabWidth = 240;
+ const int kTabWidth = kTabWidthValue;
// The overlap includes one separator, so subtract it here.
return kTabWidth + GetTabOverlap() - GetSeparatorSize().width();
}
@@ -102,19 +128,42 @@ int ChromeRefresh2023TabStyle::GetMinimumInactiveWidth() const {
}
int ChromeRefresh2023TabStyle::GetTopCornerRadius() const {
- return 10;
+ static const bool rectangular_tabs =
+ base::CommandLine::ForCurrentProcess()->HasSwitch("rectangular-tabs");
+ if (features::IsThorium2024() && !rectangular_tabs) {
+ return 8;
+ } else if ((rectangular_tabs && features::IsThorium2024()) || (rectangular_tabs && !features::IsThorium2024())) {
+ return 4;
+ } else {
+ return 10;
+ }
}
int ChromeRefresh2023TabStyle::GetBottomCornerRadius() const {
- return 12;
+ static const bool rectangular_tabs =
+ base::CommandLine::ForCurrentProcess()->HasSwitch("rectangular-tabs");
+ if (features::IsThorium2024() && !rectangular_tabs) {
+ return 10;
+ } else if ((rectangular_tabs && features::IsThorium2024()) || (rectangular_tabs && !features::IsThorium2024())) {
+ return 4;
+ } else {
+ return 12;
+ }
}
int ChromeRefresh2023TabStyle::GetTabOverlap() const {
// The overlap removes the width and the margins of the separator.
- const float total_separator_width = GetSeparatorMargins().left() +
- GetSeparatorSize().width() +
- GetSeparatorMargins().right();
- return 2 * GetBottomCornerRadius() - total_separator_width;
+ if (features::IsThorium2024()) {
+ const float total_separator_width = GetSeparatorMargins().left() +
+ GetSeparatorSize().width() +
+ GetSeparatorMargins().right();
+ return 2 * GetBottomCornerRadius() - total_separator_width;
+ } else {
+ const float total_separator_width = GetSeparatorMargins().left() +
+ GetSeparatorSize().width() +
+ GetSeparatorMargins().right();
+ return 2 * GetBottomCornerRadius() - total_separator_width;
+ }
}
gfx::Size ChromeRefresh2023TabStyle::GetPreviewImageSize() const {
@@ -124,23 +173,43 @@ gfx::Size ChromeRefresh2023TabStyle::GetPreviewImageSize() const {
}
gfx::Size ChromeRefresh2023TabStyle::GetSeparatorSize() const {
- return gfx::Size(kChromeRefreshSeparatorThickness,
- kChromeRefreshSeparatorHeight);
+ if (features::IsThorium2024()) {
+ return gfx::Size(kThoriumSeparatorThickness,
+ kThoriumSeparatorHeight);
+ } else {
+ return gfx::Size(kChromeRefreshSeparatorThickness,
+ kChromeRefreshSeparatorHeight);
+ }
}
gfx::Insets ChromeRefresh2023TabStyle::GetSeparatorMargins() const {
- return gfx::Insets::TLBR(GetLayoutConstant(TAB_STRIP_PADDING),
- kChromeRefreshSeparatorHorizontalMargin,
- GetLayoutConstant(TAB_STRIP_PADDING),
- kChromeRefreshSeparatorHorizontalMargin);
+ if (features::IsThorium2024()) {
+ return gfx::Insets::TLBR(GetLayoutConstant(TAB_INACTIVE_PADDING),
+ kThoriumSeparatorHorizontalMargin,
+ GetLayoutConstant(TAB_INACTIVE_PADDING),
+ kThoriumSeparatorHorizontalMargin);
+ } else {
+ return gfx::Insets::TLBR(GetLayoutConstant(TAB_STRIP_PADDING),
+ kChromeRefreshSeparatorHorizontalMargin,
+ GetLayoutConstant(TAB_STRIP_PADDING),
+ kChromeRefreshSeparatorHorizontalMargin);
+ }
}
int ChromeRefresh2023TabStyle::GetSeparatorCornerRadius() const {
- return GetSeparatorSize().width() / 2;
+ if (features::IsThorium2024()) {
+ return 0;
+ } else {
+ return GetSeparatorSize().width() / 2;
+ }
}
int ChromeRefresh2023TabStyle::GetDragHandleExtension(int height) const {
- return 6;
+ if (features::IsThorium2024()) {
+ return (height - GetSeparatorSize().height()) / 2 - 1;
+ } else {
+ return 6;
+ }
}
SkColor ChromeRefresh2023TabStyle::GetTabBackgroundColor(
@@ -177,11 +246,19 @@ SkColor ChromeRefresh2023TabStyle::GetTabBackgroundColor(
}
gfx::Insets ChromeRefresh2023TabStyle::GetContentsInsets() const {
- return gfx::Insets::TLBR(
- kChromeRefreshTabVerticalPadding + GetLayoutConstant(TAB_STRIP_PADDING),
- GetBottomCornerRadius() + kChromeRefreshTabHorizontalPadding,
- kChromeRefreshTabVerticalPadding + GetLayoutConstant(TAB_STRIP_PADDING),
- GetBottomCornerRadius() + kChromeRefreshTabHorizontalPadding);
+ if (features::IsThorium2024()) {
+ return gfx::Insets::TLBR(
+ kThoriumTabVerticalPadding + GetLayoutConstant(TAB_STRIP_PADDING),
+ GetBottomCornerRadius() + kThoriumTabHorizontalPadding,
+ kThoriumTabVerticalPadding + GetLayoutConstant(TAB_STRIP_PADDING),
+ GetBottomCornerRadius() + kThoriumTabHorizontalPadding);
+ } else {
+ return gfx::Insets::TLBR(
+ kChromeRefreshTabVerticalPadding + GetLayoutConstant(TAB_STRIP_PADDING),
+ GetBottomCornerRadius() + kChromeRefreshTabHorizontalPadding,
+ kChromeRefreshTabVerticalPadding + GetLayoutConstant(TAB_STRIP_PADDING),
+ GetBottomCornerRadius() + kChromeRefreshTabHorizontalPadding);
+ }
}
float ChromeRefresh2023TabStyle::GetSelectedTabOpacity() const {
diff --git a/chrome/browser/ui/thorium_2024.h b/chrome/browser/ui/thorium_2024.h
new file mode 100644
index 0000000000000..de40b42fcc722
--- /dev/null
+++ b/chrome/browser/ui/thorium_2024.h
@@ -0,0 +1,14 @@
+// Copyright 2024 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_THORIUM_2024_UI_H_
+#define CHROME_BROWSER_UI_THORIUM_2024_UI_H_
+
+#include "base/command_line.h"
+#include "ui/base/ui_base_features.h"
+
+// Blanking out until moving file to //ui/base
+//static const bool thor24 = features::IsThorium2024();
+
+#endif // CHROME_BROWSER_UI_THORIUM_2024_UI_H_
diff --git a/chrome/browser/ui/toolbar/chrome_labs/chrome_labs_model.cc b/chrome/browser/ui/toolbar/chrome_labs/chrome_labs_model.cc
index 6a91493f7c2bc..004fa7b7981c3 100644
--- a/chrome/browser/ui/toolbar/chrome_labs/chrome_labs_model.cc
+++ b/chrome/browser/ui/toolbar/chrome_labs/chrome_labs_model.cc
@@ -49,6 +49,16 @@ const std::vector<LabInfo>& GetData() {
l10n_util::GetStringUTF16(IDS_TABS_SHRINK_TO_LARGE_WIDTH),
l10n_util::GetStringUTF16(IDS_TABS_DO_NOT_SHRINK)};
+ const char kThorium2024FlagId[] = "thorium-2024";
+ std::u16string kThorium2024FlagName = u"Enable Thorium 2024 UI";
+ std::u16string kThorium2024FlagDescription = u"Enable an experimental UI, which restores many parts of the pre-Chrome Refresh 2023 UI.";
+
+ lab_info.emplace_back(
+ kThorium2024FlagId,
+ kThorium2024FlagName,
+ kThorium2024FlagDescription,
+ "chrome-labs-thorium-2024", version_info::Channel::BETA);
+
lab_info.emplace_back(
flag_descriptions::kScrollableTabStripFlagId,
l10n_util::GetStringUTF16(IDS_TAB_SCROLLING_EXPERIMENT_NAME),
diff --git a/chrome/browser/ui/views/bookmarks/bookmark_bar_view.cc b/chrome/browser/ui/views/bookmarks/bookmark_bar_view.cc
index fd011f8983a1d..8000a05951f9b 100644
--- a/chrome/browser/ui/views/bookmarks/bookmark_bar_view.cc
+++ b/chrome/browser/ui/views/bookmarks/bookmark_bar_view.cc
@@ -54,6 +54,7 @@
#include "chrome/browser/ui/layout_constants.h"
#include "chrome/browser/ui/tabs/saved_tab_groups/saved_tab_group_service_factory.h"
#include "chrome/browser/ui/tabs/tab_strip_model.h"
+#include "chrome/browser/ui/thorium_2024.h"
#include "chrome/browser/ui/ui_features.h"
#include "chrome/browser/ui/view_ids.h"
#include "chrome/browser/ui/views/bookmarks/bookmark_bar_view_observer.h"
@@ -343,8 +344,8 @@ class BookmarkBarView::ButtonSeparatorView : public views::Separator {
public:
ButtonSeparatorView() {
- const int leading_padding = 8;
- const int trailing_padding = 8;
+ const int leading_padding = features::IsThorium2024() ? 4 : 8;
+ const int trailing_padding = features::IsThorium2024() ? 3 : 8;
separator_thickness_ = kBookmarkBarSeparatorThickness;
const gfx::Insets border_insets =
gfx::Insets::TLBR(0, leading_padding, 0, trailing_padding);
@@ -694,7 +695,7 @@ void BookmarkBarView::Layout(PassKey) {
}
int x = GetLeadingMargin();
- static constexpr int kBookmarkBarTrailingMargin = 8;
+ static const int kBookmarkBarTrailingMargin = features::IsThorium2024() ? 0 : 8;
int width = View::width() - x - kBookmarkBarTrailingMargin;
const int button_height = GetLayoutConstant(BOOKMARK_BAR_BUTTON_HEIGHT);
diff --git a/chrome/browser/ui/views/chrome_layout_provider.cc b/chrome/browser/ui/views/chrome_layout_provider.cc
index 5291d09d2154f..c8cf8e0ad6037 100644
--- a/chrome/browser/ui/views/chrome_layout_provider.cc
+++ b/chrome/browser/ui/views/chrome_layout_provider.cc
@@ -7,6 +7,7 @@
#include <algorithm>
#include "base/feature_list.h"
+#include "chrome/browser/ui/thorium_2024.h"
#include "chrome/browser/ui/views/chrome_typography.h"
#include "components/omnibox/common/omnibox_features.h"
#include "ui/base/pointer/touch_ui_controller.h"
@@ -161,7 +162,7 @@ int ChromeLayoutProvider::GetDistanceMetric(int metric) const {
case DISTANCE_INFOBAR_HEIGHT:
// Spec says height of button should be 36dp, vertical padding on both
// top and bottom should be 8dp.
- return 36 + 2 * 8;
+ return features::IsThorium2024() ? 42 : 36 + 2 * 8;
case DISTANCE_PERMISSION_PROMPT_HORIZONTAL_ICON_LABEL_PADDING:
return 8;
case DISTANCE_RICH_HOVER_BUTTON_ICON_HORIZONTAL:
diff --git a/chrome/browser/ui/views/frame/browser_frame_view_layout_linux.cc b/chrome/browser/ui/views/frame/browser_frame_view_layout_linux.cc
index af21424e93618..7ab9cd6819469 100644
--- a/chrome/browser/ui/views/frame/browser_frame_view_layout_linux.cc
+++ b/chrome/browser/ui/views/frame/browser_frame_view_layout_linux.cc
@@ -73,5 +73,5 @@ gfx::Insets BrowserFrameViewLayoutLinux::RestoredFrameEdgeInsets() const {
}
int BrowserFrameViewLayoutLinux::NonClientExtraTopThickness() const {
- return delegate_->IsTabStripVisible() ? 0 : kExtraTopBorder;
+ return (!features::IsThorium2024() && delegate_->IsTabStripVisible()) ? 0 : kExtraTopBorder;
}
diff --git a/chrome/browser/ui/views/frame/browser_frame_view_win.cc b/chrome/browser/ui/views/frame/browser_frame_view_win.cc
index b57fb5baa52a7..4fc9467f16b6c 100644
--- a/chrome/browser/ui/views/frame/browser_frame_view_win.cc
+++ b/chrome/browser/ui/views/frame/browser_frame_view_win.cc
@@ -315,7 +315,9 @@ int BrowserFrameViewWin::NonClientHitTest(const gfx::Point& point) {
// pixels at the end of the top and bottom edges trigger diagonal resizing.
constexpr int kResizeCornerWidth = 16;
- const int top_border_thickness = GetLayoutConstant(TAB_STRIP_PADDING);
+ const int top_border_thickness = features::IsThorium2024()
+ ? GetLayoutConstant(TAB_INACTIVE_PADDING)
+ : GetLayoutConstant(TAB_STRIP_PADDING);
const int window_component = GetHTComponentForFrame(
point, gfx::Insets::TLBR(top_border_thickness, 0, 0, 0),
@@ -495,7 +497,7 @@ int BrowserFrameViewWin::FrameTopBorderThickness(bool restored) const {
// default. When maximized, the OS sizes the window such that the border
// extends beyond the screen edges. In that case, we must return the
// default value.
- const int kTopResizeFrameArea = 0;
+ const int kTopResizeFrameArea = features::IsThorium2024() ? 6 : 0;
return kTopResizeFrameArea;
}
@@ -555,6 +557,22 @@ int BrowserFrameViewWin::TopAreaHeight(bool restored) const {
return top;
}
+ // In maximized mode, we do not add any additional thickness to the grab
+ // handle above the tabs; just return the frame thickness.
+ if (maximized) {
+ return top;
+ }
+
+ // Besides the frame border, there's empty space atop the window in restored
+ // mode, to use to drag the window around.
+ constexpr int kNonClientRestoredExtraThickness = 8;
+ int thickness = kNonClientRestoredExtraThickness;
+ if (EverHasVisibleBackgroundTabShapes() && features::IsThorium2024()) {
+ thickness =
+ std::max(thickness, BrowserNonClientFrameView::kMinimumDragHeight);
+ return top + thickness;
+ }
+
// The tabstrip controls its own top padding.
return top;
}
@@ -803,17 +821,30 @@ void BrowserFrameViewWin::LayoutCaptionButtons() {
const gfx::Size preferred_size =
caption_button_container_->GetPreferredSize();
+ int height = preferred_size.height();
+ // We use the standard caption bar height when maximized in tablet mode, which
+ // is smaller than our preferred button size.
+ if (IsWebUITabStrip() && IsMaximized()) {
+ height = std::min(height, TitlebarMaximizedVisualHeight());
+ }
+ if (!browser_view()->GetWebAppFrameToolbarPreferredSize().IsEmpty()) {
+ height = IsMaximized() ? TitlebarMaximizedVisualHeight()
+ : TitlebarHeight(false) - WindowTopY();
+ }
const int system_caption_buttons_width =
ShouldBrowserCustomDrawTitlebar(browser_view())
? 0
: width() - frame()->GetMinimizeButtonOffset();
+ height = features::IsThorium2024() ? std::min(GetFrameHeight(), height)
+ : GetFrameHeight();
+
caption_button_container_->SetBounds(
CaptionButtonsOnLeadingEdge()
? system_caption_buttons_width
: width() - system_caption_buttons_width - preferred_size.width(),
- WindowTopY(), preferred_size.width(), GetFrameHeight());
+ WindowTopY(), preferred_size.width(), height);
}
void BrowserFrameViewWin::LayoutClientView() {
diff --git a/chrome/browser/ui/views/frame/browser_non_client_frame_view_chromeos.cc b/chrome/browser/ui/views/frame/browser_non_client_frame_view_chromeos.cc
index 480b5be6b3f5e..de3c389d5bdf9 100644
--- a/chrome/browser/ui/views/frame/browser_non_client_frame_view_chromeos.cc
+++ b/chrome/browser/ui/views/frame/browser_non_client_frame_view_chromeos.cc
@@ -280,7 +280,11 @@ int BrowserNonClientFrameViewChromeOS::GetTopInset(bool restored) const {
}
if (browser_view()->GetTabStripVisible()) {
- return 0;
+ if (features::IsThorium2024()) {
+ return header_height - browser_view()->GetTabStripHeight();
+ } else {
+ return 0;
+ }
}
Browser* browser = browser_view()->browser();
diff --git a/chrome/browser/ui/views/frame/browser_non_client_frame_view_mac.h b/chrome/browser/ui/views/frame/browser_non_client_frame_view_mac.h
index 263261b1c8204..93335609f27da 100644
--- a/chrome/browser/ui/views/frame/browser_non_client_frame_view_mac.h
+++ b/chrome/browser/ui/views/frame/browser_non_client_frame_view_mac.h
@@ -105,6 +105,8 @@ class BrowserNonClientFrameViewMac : public BrowserNonClientFrameView,
const gfx::Rect& frame,
const gfx::Insets& caption_button_insets);
+ CGFloat FullscreenBackingBarHeight() const;
+
// Calculate the y offset the top UI needs to shift down due to showing the
// slide down menu bar at the very top in full screen.
int TopUIFullscreenYOffset() const;
diff --git a/chrome/browser/ui/views/frame/browser_non_client_frame_view_mac.mm b/chrome/browser/ui/views/frame/browser_non_client_frame_view_mac.mm
index 73592431e1d6c..e55efc19bfd88 100644
--- a/chrome/browser/ui/views/frame/browser_non_client_frame_view_mac.mm
+++ b/chrome/browser/ui/views/frame/browser_non_client_frame_view_mac.mm
@@ -50,6 +50,8 @@ namespace {
// Keep in sync with web_app_frame_toolbar_browsertest.cc
constexpr double kTitlePaddingWidthFraction = 0.1;
+constexpr int kResizeHandleHeight = 1;
+
// Empirical measurements of the traffic lights.
constexpr int kCaptionButtonsWidth = 52;
constexpr int kCaptionButtonsInsetsCatalinaOrOlder = 70;
@@ -225,7 +227,46 @@ void BrowserNonClientFrameViewMac::LayoutWebAppWindowTitle(
}
int BrowserNonClientFrameViewMac::GetTopInset(bool restored) const {
- return 0;
+ if (features::IsThorium2024()) {
+ if (!browser_view()->ShouldDrawTabStrip()) {
+ return 0;
+ }
+
+ // Mac seems to reserve 1 DIP of the top inset as a resize handle.
+ const int kTabstripTopInset = 8;
+ int top_inset = kTabstripTopInset;
+ if (EverHasVisibleBackgroundTabShapes()) {
+ top_inset =
+ std::max(top_inset, BrowserNonClientFrameView::kMinimumDragHeight +
+ kResizeHandleHeight);
+ }
+
+ // Immersive fullscreen attaches the tab strip to the title bar, no need to
+ // calculate the y_offset below.
+ if (browser_view()->UsesImmersiveFullscreenMode()) {
+ return top_inset;
+ }
+
+ // Calculate the y offset for the tab strip because in fullscreen mode the tab
+ // strip may need to move under the slide down menu bar.
+ CGFloat y_offset = TopUIFullscreenYOffset();
+ if (y_offset > 0) {
+ // When menubar shows up, we need to update mouse tracking area.
+ NSWindow* window = GetWidget()->GetNativeWindow().GetNativeNSWindow();
+ NSRect content_bounds = [[window contentView] bounds];
+ // Backing bar tracking area uses native coordinates.
+ CGFloat tracking_height =
+ FullscreenBackingBarHeight() + top_inset + y_offset;
+ NSRect backing_bar_area =
+ NSMakeRect(0, NSMaxY(content_bounds) - tracking_height,
+ NSWidth(content_bounds), tracking_height);
+ [fullscreen_toolbar_controller_ updateToolbarFrame:backing_bar_area];
+ }
+
+ return y_offset + top_inset;
+ } else {
+ return 0;
+ }
}
void BrowserNonClientFrameViewMac::UpdateFullscreenTopUI() {
@@ -488,6 +529,21 @@ void BrowserNonClientFrameViewMac::PaintThemedFrame(gfx::Canvas* canvas) {
canvas->DrawImageInt(overlay, 0, 0);
}
+CGFloat BrowserNonClientFrameViewMac::FullscreenBackingBarHeight() const {
+ BrowserView* browser_view = this->browser_view();
+ DCHECK(browser_view->IsFullscreen());
+
+ CGFloat total_height = 0;
+ if (browser_view->ShouldDrawTabStrip()) {
+ total_height += browser_view->GetTabStripHeight();
+ }
+
+ if (browser_view->IsToolbarVisible())
+ total_height += browser_view->toolbar()->bounds().height();
+
+ return total_height;
+}
+
int BrowserNonClientFrameViewMac::TopUIFullscreenYOffset() const {
if (!browser_view()->GetTabStripVisible() ||
!browser_view()->IsFullscreen() ||
diff --git a/chrome/browser/ui/views/frame/opaque_browser_frame_view.cc b/chrome/browser/ui/views/frame/opaque_browser_frame_view.cc
index ba129325c8700..fbfa68c2e71b1 100644
--- a/chrome/browser/ui/views/frame/opaque_browser_frame_view.cc
+++ b/chrome/browser/ui/views/frame/opaque_browser_frame_view.cc
@@ -254,7 +254,9 @@ void OpaqueBrowserFrameView::LayoutWebAppWindowTitle(
}
int OpaqueBrowserFrameView::GetTopInset(bool restored) const {
- return layout_->NonClientTopHeight(restored);
+ return browser_view()->ShouldDrawTabStrip() && features::IsThorium2024()
+ ? layout_->GetTabStripInsetsTop(restored)
+ : layout_->NonClientTopHeight(restored);
}
void OpaqueBrowserFrameView::UpdateThrobber(bool running) {
diff --git a/chrome/browser/ui/views/frame/opaque_browser_frame_view_layout.cc b/chrome/browser/ui/views/frame/opaque_browser_frame_view_layout.cc
index 67b69d18a802e..f2189d01b206f 100644
--- a/chrome/browser/ui/views/frame/opaque_browser_frame_view_layout.cc
+++ b/chrome/browser/ui/views/frame/opaque_browser_frame_view_layout.cc
@@ -78,7 +78,7 @@ gfx::Rect OpaqueBrowserFrameViewLayout::GetBoundsForTabStripRegion(
int total_width) const {
const int x = available_space_leading_x_;
const int available_width = available_space_trailing_x_ - x;
- return gfx::Rect(x, NonClientTopHeight(false), std::max(0, available_width),
+ return gfx::Rect(x, GetTabStripInsetsTop(false), std::max(0, available_width),
tabstrip_minimum_size.height());
}
@@ -181,6 +181,15 @@ int OpaqueBrowserFrameViewLayout::NonClientTopHeight(bool restored) const {
kContentEdgeShadowThickness;
}
+int OpaqueBrowserFrameViewLayout::GetTabStripInsetsTop(bool restored) const {
+ const int top = NonClientTopHeight(restored);
+ const bool start_at_top_of_frame = !restored &&
+ delegate_->IsFrameCondensed() &&
+ features::IsThorium2024();
+ return start_at_top_of_frame ? top
+ : (top + GetNonClientRestoredExtraThickness());
+}
+
gfx::Insets OpaqueBrowserFrameViewLayout::FrameEdgeInsets(bool restored) const {
return IsFrameEdgeVisible(restored) ? RestoredFrameEdgeInsets()
: gfx::Insets();
@@ -190,7 +199,12 @@ int OpaqueBrowserFrameViewLayout::DefaultCaptionButtonY(bool restored) const {
// Maximized buttons start at window top, since the window has no border. This
// offset is for the image (the actual clickable bounds extend all the way to
// the top to take Fitts' Law into account).
- return views::NonClientFrameView::kFrameShadowThickness;
+ const bool start_at_top_of_frame = !restored &&
+ delegate_->IsFrameCondensed() &&
+ features::IsThorium2024();
+ return start_at_top_of_frame
+ ? FrameBorderInsets(false).top()
+ : views::NonClientFrameView::kFrameShadowThickness;
}
int OpaqueBrowserFrameViewLayout::CaptionButtonY(views::FrameButton button_id,
@@ -236,6 +250,21 @@ int OpaqueBrowserFrameViewLayout::GetWindowCaptionSpacing(