forked from chromium/chromium
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[tab search] Add entrypoint to the ChromeOS browser frame
This CL adds an option to position the tab search entrypoint besides the browser frame caption buttons on ChromeOS. If enabled this will replace the tab search entrypoint in the tab strip for ChromeOS platforms. This new entrypoint will be gated behind the kChromeOSTabSearchCaptionButton feature flag. Bug: 1227272 Change-Id: Ib91406f40830770a6eb985cf2e2533c4f74ed436 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3012061 Reviewed-by: Xiaoqian Dai <xdai@chromium.org> Reviewed-by: Mitsuru Oshima <oshima@chromium.org> Reviewed-by: Scott Violet <sky@chromium.org> Commit-Queue: Thomas Lukaszewicz <tluk@chromium.org> Cr-Commit-Position: refs/heads/master@{#904826}
- Loading branch information
tom
authored and
Chromium LUCI CQ
committed
Jul 23, 2021
1 parent
548719c
commit ba90ace
Showing
16 changed files
with
206 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
chrome/browser/ui/views/frame/tab_search_frame_caption_button.cc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
// Copyright 2021 The Chromium Authors. All rights reserved. | ||
// 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/tab_search_frame_caption_button.h" | ||
|
||
#include "chrome/browser/profiles/profile.h" | ||
#include "chrome/browser/ui/browser.h" | ||
#include "chrome/browser/ui/ui_features.h" | ||
#include "chrome/browser/ui/views/tab_search_bubble_host.h" | ||
#include "chrome/grit/generated_resources.h" | ||
#include "components/vector_icons/vector_icons.h" | ||
#include "ui/base/hit_test.h" | ||
#include "ui/base/l10n/l10n_util.h" | ||
#include "ui/base/metadata/metadata_impl_macros.h" | ||
|
||
TabSearchFrameCaptionButton::TabSearchFrameCaptionButton(Profile* profile) | ||
: FrameCaptionButton(views::Button::PressedCallback(), | ||
views::CAPTION_BUTTON_ICON_CUSTOM, | ||
HTCLIENT), | ||
tab_search_bubble_host_( | ||
std::make_unique<TabSearchBubbleHost>(this, profile)) { | ||
SetImage(views::CAPTION_BUTTON_ICON_CUSTOM, | ||
views::FrameCaptionButton::Animate::kNo, | ||
vector_icons::kCaretDownIcon); | ||
SetTooltipText(l10n_util::GetStringUTF16(IDS_ACCNAME_TAB_SEARCH)); | ||
} | ||
|
||
TabSearchFrameCaptionButton::~TabSearchFrameCaptionButton() = default; | ||
|
||
// static. | ||
bool TabSearchFrameCaptionButton::IsTabSearchCaptionButtonEnabled( | ||
Browser* browser) { | ||
return browser->is_type_normal() && | ||
base::FeatureList::IsEnabled( | ||
features::kChromeOSTabSearchCaptionButton); | ||
} | ||
|
||
BEGIN_METADATA(TabSearchFrameCaptionButton, views::FrameCaptionButton) | ||
END_METADATA |
34 changes: 34 additions & 0 deletions
34
chrome/browser/ui/views/frame/tab_search_frame_caption_button.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
// Copyright 2021 The Chromium Authors. All rights reserved. | ||
// 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_TAB_SEARCH_FRAME_CAPTION_BUTTON_H_ | ||
#define CHROME_BROWSER_UI_VIEWS_FRAME_TAB_SEARCH_FRAME_CAPTION_BUTTON_H_ | ||
|
||
#include "ui/base/metadata/metadata_header_macros.h" | ||
#include "ui/views/window/frame_caption_button.h" | ||
|
||
class Browser; | ||
class Profile; | ||
class TabSearchBubbleHost; | ||
|
||
class TabSearchFrameCaptionButton : public views::FrameCaptionButton { | ||
public: | ||
METADATA_HEADER(TabSearchFrameCaptionButton); | ||
explicit TabSearchFrameCaptionButton(Profile* profile); | ||
TabSearchFrameCaptionButton(const TabSearchFrameCaptionButton&) = delete; | ||
TabSearchFrameCaptionButton& operator=(const TabSearchFrameCaptionButton&) = | ||
delete; | ||
~TabSearchFrameCaptionButton() override; | ||
|
||
static bool IsTabSearchCaptionButtonEnabled(Browser* browser); | ||
|
||
TabSearchBubbleHost* tab_search_bubble_host() { | ||
return tab_search_bubble_host_.get(); | ||
} | ||
|
||
private: | ||
std::unique_ptr<TabSearchBubbleHost> tab_search_bubble_host_; | ||
}; | ||
|
||
#endif // CHROME_BROWSER_UI_VIEWS_FRAME_TAB_SEARCH_FRAME_CAPTION_BUTTON_H_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.