@@ -141,24 +141,24 @@ index 0ed6e9e434350..5c8bcd5c45ede 100644
141
141
]
142
142
}
143
143
diff --git chrome/browser/ui/browser.cc chrome/browser/ui/browser.cc
144
- index fafd84d08e336..a17aad8f37537 100644
144
+ index fafd84d08e336..0985c4cd9ebf0 100644
145
145
--- chrome/browser/ui/browser.cc
146
146
+++ chrome/browser/ui/browser.cc
147
147
@@ -268,6 +268,25 @@
148
148
#include "components/captive_portal/content/captive_portal_tab_helper.h"
149
149
#endif
150
150
151
151
+ #if BUILDFLAG(ENABLE_CEF)
152
- + #define CALL_CEF_DELEGATE(name, ...) \
153
- + if (cef_browser_delegate_) { \
152
+ + #define CALL_CEF_DELEGATE(name, ...) \
153
+ + if (cef_browser_delegate_) { \
154
154
+ cef_browser_delegate_->name(__VA_ARGS__); \
155
155
+ }
156
- + #define CALL_CEF_DELEGATE_RETURN(name, ...) \
157
- + if (cef_browser_delegate_) { \
156
+ + #define CALL_CEF_DELEGATE_RETURN(name, ...) \
157
+ + if (cef_browser_delegate_) { \
158
158
+ return cef_browser_delegate_->name(__VA_ARGS__); \
159
159
+ }
160
- + #define CALL_CEF_DELEGATE_RESULT(name, result, ...) \
161
- + if (cef_browser_delegate_) { \
160
+ + #define CALL_CEF_DELEGATE_RESULT(name, result, ...) \
161
+ + if (cef_browser_delegate_) { \
162
162
+ result = cef_browser_delegate_->name(__VA_ARGS__); \
163
163
+ }
164
164
+ #else // !BUILDFLAG(ENABLE_CEF)
@@ -203,22 +203,23 @@ index fafd84d08e336..a17aad8f37537 100644
203
203
}
204
204
205
205
void Browser::FullscreenTopUIStateChanged() {
206
- @@ -1752,6 +1783,14 @@ content::KeyboardEventProcessingResult Browser::PreHandleKeyboardEvent(
206
+ @@ -1752,6 +1783,15 @@ content::KeyboardEventProcessingResult Browser::PreHandleKeyboardEvent(
207
207
return content::KeyboardEventProcessingResult::HANDLED;
208
208
}
209
209
210
210
+ #if BUILDFLAG(ENABLE_CEF)
211
211
+ if (cef_browser_delegate_) {
212
212
+ auto result = cef_browser_delegate_->PreHandleKeyboardEvent(source, event);
213
- + if (result != content::KeyboardEventProcessingResult::NOT_HANDLED)
213
+ + if (result != content::KeyboardEventProcessingResult::NOT_HANDLED) {
214
214
+ return result;
215
+ + }
215
216
+ }
216
217
+ #endif
217
218
+
218
219
return window()->PreHandleKeyboardEvent(event);
219
220
}
220
221
221
- @@ -1759,8 +1798 ,18 @@ bool Browser::HandleKeyboardEvent(content::WebContents* source,
222
+ @@ -1759,8 +1799 ,18 @@ bool Browser::HandleKeyboardEvent(content::WebContents* source,
222
223
const NativeWebKeyboardEvent& event) {
223
224
DevToolsWindow* devtools_window =
224
225
DevToolsWindow::GetInstanceForInspectedWebContents(source);
@@ -239,7 +240,7 @@ index fafd84d08e336..a17aad8f37537 100644
239
240
}
240
241
241
242
bool Browser::TabsNeedBeforeUnloadFired() const {
242
- @@ -1855,9 +1904 ,14 @@ bool Browser::IsBackForwardCacheSupported(content::WebContents& web_contents) {
243
+ @@ -1855,9 +1905 ,14 @@ bool Browser::IsBackForwardCacheSupported(content::WebContents& web_contents) {
243
244
content::PreloadingEligibility Browser::IsPrerender2Supported(
244
245
content::WebContents& web_contents,
245
246
content::PreloadingTriggerType trigger_type) {
@@ -254,7 +255,7 @@ index fafd84d08e336..a17aad8f37537 100644
254
255
}
255
256
256
257
bool Browser::ShouldShowStaleContentOnEviction(content::WebContents* source) {
257
- @@ -1920,6 +1974 ,14 @@ WebContents* Browser::OpenURLFromTab(
258
+ @@ -1920,6 +1975 ,14 @@ WebContents* Browser::OpenURLFromTab(
258
259
std::move(navigation_handle_callback));
259
260
}
260
261
@@ -269,7 +270,7 @@ index fafd84d08e336..a17aad8f37537 100644
269
270
NavigateParams nav_params(this, params.url, params.transition);
270
271
nav_params.FillNavigateParamsFromOpenURLParams(params);
271
272
nav_params.source_contents = source;
272
- @@ -2093,6 +2155 ,8 @@ void Browser::LoadingStateChanged(WebContents* source,
273
+ @@ -2093,6 +2156 ,8 @@ void Browser::LoadingStateChanged(WebContents* source,
273
274
bool should_show_loading_ui) {
274
275
ScheduleUIUpdate(source, content::INVALIDATE_TYPE_LOAD);
275
276
UpdateWindowForLoadingStateChanged(source, should_show_loading_ui);
@@ -278,7 +279,7 @@ index fafd84d08e336..a17aad8f37537 100644
278
279
}
279
280
280
281
void Browser::CloseContents(WebContents* source) {
281
- @@ -2122,6 +2186 ,8 @@ void Browser::SetContentsBounds(WebContents* source, const gfx::Rect& bounds) {
282
+ @@ -2122,6 +2187 ,8 @@ void Browser::SetContentsBounds(WebContents* source, const gfx::Rect& bounds) {
282
283
}
283
284
284
285
void Browser::UpdateTargetURL(WebContents* source, const GURL& url) {
@@ -287,7 +288,7 @@ index fafd84d08e336..a17aad8f37537 100644
287
288
if (!GetStatusBubble()) {
288
289
return;
289
290
}
290
- @@ -2131,6 +2197 ,17 @@ void Browser::UpdateTargetURL(WebContents* source, const GURL& url) {
291
+ @@ -2131,6 +2198 ,17 @@ void Browser::UpdateTargetURL(WebContents* source, const GURL& url) {
291
292
}
292
293
}
293
294
@@ -305,7 +306,11 @@ index fafd84d08e336..a17aad8f37537 100644
305
306
void Browser::ContentsMouseEvent(WebContents* source, const ui::Event& event) {
306
307
const ui::EventType type = event.type();
307
308
const bool exited = type == ui::EventType::kMouseExited;
308
- @@ -2159,6 +2236,19 @@ bool Browser::TakeFocus(content::WebContents* source, bool reverse) {
309
+ @@ -2156,9 +2234,23 @@ void Browser::ContentsZoomChange(bool zoom_in) {
310
+ }
311
+
312
+ bool Browser::TakeFocus(content::WebContents* source, bool reverse) {
313
+ + CALL_CEF_DELEGATE_RETURN(TakeFocus, source, reverse);
309
314
return false;
310
315
}
311
316
@@ -325,7 +330,7 @@ index fafd84d08e336..a17aad8f37537 100644
325
330
void Browser::BeforeUnloadFired(WebContents* web_contents,
326
331
bool proceed,
327
332
bool* proceed_to_fire_unload) {
328
- @@ -2271,12 +2361 ,24 @@ void Browser::WebContentsCreated(WebContents* source_contents,
333
+ @@ -2271,12 +2363 ,24 @@ void Browser::WebContentsCreated(WebContents* source_contents,
329
334
// to track `new_contents` after it is added to its TabModel this override can
330
335
// be removed.
331
336
CreateSessionServiceTabHelper(new_contents);
@@ -350,7 +355,7 @@ index fafd84d08e336..a17aad8f37537 100644
350
355
// Don't show the page hung dialog when a HTML popup hangs because
351
356
// the dialog will take the focus and immediately close the popup.
352
357
RenderWidgetHostView* view = render_widget_host->GetView();
353
- @@ -2289,6 +2391 ,13 @@ void Browser::RendererUnresponsive(
358
+ @@ -2289,6 +2393 ,13 @@ void Browser::RendererUnresponsive(
354
359
void Browser::RendererResponsive(
355
360
WebContents* source,
356
361
content::RenderWidgetHost* render_widget_host) {
@@ -364,7 +369,7 @@ index fafd84d08e336..a17aad8f37537 100644
364
369
RenderWidgetHostView* view = render_widget_host->GetView();
365
370
if (view && !render_widget_host->GetView()->IsHTMLFormPopup()) {
366
371
TabDialogs::FromWebContents(source)->HideHungRendererDialog(
367
- @@ -2298,6 +2407 ,15 @@ void Browser::RendererResponsive(
372
+ @@ -2298,6 +2409 ,15 @@ void Browser::RendererResponsive(
368
373
369
374
content::JavaScriptDialogManager* Browser::GetJavaScriptDialogManager(
370
375
WebContents* source) {
@@ -380,7 +385,7 @@ index fafd84d08e336..a17aad8f37537 100644
380
385
return javascript_dialogs::TabModalDialogManager::FromWebContents(source);
381
386
}
382
387
383
- @@ -2333,6 +2451 ,11 @@ void Browser::DraggableRegionsChanged(
388
+ @@ -2333,6 +2453 ,11 @@ void Browser::DraggableRegionsChanged(
384
389
if (app_controller_) {
385
390
app_controller_->DraggableRegionsChanged(regions, contents);
386
391
}
@@ -392,7 +397,7 @@ index fafd84d08e336..a17aad8f37537 100644
392
397
}
393
398
394
399
void Browser::DidFinishNavigation(
395
- @@ -2415,11 +2538 ,15 @@ void Browser::EnterFullscreenModeForTab(
400
+ @@ -2415,11 +2540 ,15 @@ void Browser::EnterFullscreenModeForTab(
396
401
const blink::mojom::FullscreenOptions& options) {
397
402
exclusive_access_manager_->fullscreen_controller()->EnterFullscreenModeForTab(
398
403
requesting_frame, options.display_id);
@@ -408,23 +413,24 @@ index fafd84d08e336..a17aad8f37537 100644
408
413
}
409
414
410
415
bool Browser::IsFullscreenForTabOrPending(const WebContents* web_contents) {
411
- @@ -2629,6 +2756,15 @@ void Browser::RequestMediaAccessPermission(
416
+ @@ -2629,6 +2758,16 @@ void Browser::RequestMediaAccessPermission(
412
417
content::WebContents* web_contents,
413
418
const content::MediaStreamRequest& request,
414
419
content::MediaResponseCallback callback) {
415
420
+ #if BUILDFLAG(ENABLE_CEF)
416
421
+ if (cef_browser_delegate_) {
417
422
+ callback = cef_browser_delegate_->RequestMediaAccessPermissionEx(
418
423
+ web_contents, request, std::move(callback));
419
- + if (callback.is_null())
424
+ + if (callback.is_null()) {
420
425
+ return;
426
+ + }
421
427
+ }
422
428
+ #endif
423
429
+
424
430
const extensions::Extension* extension =
425
431
GetExtensionForOrigin(profile_, request.security_origin);
426
432
MediaCaptureDevicesDispatcher::GetInstance()->ProcessMediaAccessRequest(
427
- @@ -3211,9 +3347 ,10 @@ void Browser::RemoveScheduledUpdatesFor(WebContents* contents) {
433
+ @@ -3211,9 +3350 ,10 @@ void Browser::RemoveScheduledUpdatesFor(WebContents* contents) {
428
434
// Browser, Getters for UI (private):
429
435
430
436
StatusBubble* Browser::GetStatusBubble() {
@@ -436,7 +442,7 @@ index fafd84d08e336..a17aad8f37537 100644
436
442
}
437
443
438
444
// We hide the status bar for web apps windows as this matches native
439
- @@ -3221,6 +3358 ,12 @@ StatusBubble* Browser::GetStatusBubble() {
445
+ @@ -3221,6 +3361 ,12 @@ StatusBubble* Browser::GetStatusBubble() {
440
446
// mode, as the minimal browser UI includes the status bar.
441
447
if (web_app::AppBrowserController::IsWebApp(this) &&
442
448
!app_controller()->HasMinimalUiButtons()) {
@@ -449,7 +455,7 @@ index fafd84d08e336..a17aad8f37537 100644
449
455
return nullptr;
450
456
}
451
457
452
- @@ -3370,6 +3513 ,8 @@ void Browser::SetAsDelegate(WebContents* web_contents, bool set_delegate) {
458
+ @@ -3370,6 +3516 ,8 @@ void Browser::SetAsDelegate(WebContents* web_contents, bool set_delegate) {
453
459
BookmarkTabHelper::FromWebContents(web_contents)->RemoveObserver(this);
454
460
web_contents_collection_.StopObserving(web_contents);
455
461
}
@@ -458,7 +464,7 @@ index fafd84d08e336..a17aad8f37537 100644
458
464
}
459
465
460
466
void Browser::TabDetachedAtImpl(content::WebContents* contents,
461
- @@ -3530,6 +3675 ,14 @@ bool Browser::PictureInPictureBrowserSupportsWindowFeature(
467
+ @@ -3530,6 +3678 ,14 @@ bool Browser::PictureInPictureBrowserSupportsWindowFeature(
462
468
463
469
bool Browser::SupportsWindowFeatureImpl(WindowFeature feature,
464
470
bool check_can_support) const {
0 commit comments