Commit 6739deb6 authored by Thomas Lukaszewicz's avatar Thomas Lukaszewicz Committed by Commit Bot

Tab Search: Add ChromeExtensionWebContentsObserver.

This CL adds a ChromeExtensionWebContentsObserver to the WebContents
used by the Tab Search bubble. When the UI is shown in a full tab
this is added for us but is otherwise not registered automatically.

This is required to ensure we can collect metrics from the
extension's metricsPrivate APIs for UMA histograms.

This should result in no functional changes beyond enabling metrics
collection on the front end.

Bug: 1099917
Change-Id: I127aafeab79a11caac3d48ed9c9ce7b6233e4aab
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2442485Reviewed-by: default avatarYuheng Huang <yuhengh@chromium.org>
Commit-Queue: Thomas Lukaszewicz <tluk@chromium.org>
Cr-Commit-Position: refs/heads/master@{#812731}
parent ae45f114
......@@ -5,6 +5,7 @@
#include "chrome/browser/ui/views/tab_search/tab_search_bubble_view.h"
#include "base/metrics/histogram_functions.h"
#include "chrome/browser/extensions/chrome_extension_web_contents_observer.h"
#include "chrome/browser/ui/webui/tab_search/tab_search_ui.h"
#include "chrome/common/webui_url_constants.h"
#include "ui/gfx/geometry/rounded_corners_f.h"
......@@ -66,6 +67,11 @@ TabSearchBubbleView::TabSearchBubbleView(
set_margins(gfx::Insets());
SetLayoutManager(std::make_unique<views::FillLayout>());
// Required for intercepting extension function calls when the page is loaded
// in a bubble (not a full tab, thus tab helpers are not registered
// automatically).
extensions::ChromeExtensionWebContentsObserver::CreateForWebContents(
web_view_->GetWebContents());
web_view_->EnableSizingFromWebContents(kMinSize, kMaxSize);
web_view_->LoadInitialURL(GURL(chrome::kChromeUITabSearchURL));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment