Commit fdf6ef00 authored by David Bienvenu's avatar David Bienvenu Committed by Commit Bot

remove DISALLOW_COPY_AND_ASSIGN from glass_browser_frame_view.*

Also some minor style fixes; no functional changes.

Change-Id: I0868e612ae5452a0f838d8f7d4717f61d3c6862f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2351458
Commit-Queue: David Bienvenu <davidbienvenu@chromium.org>
Reviewed-by: default avatarPeter Boström <pbos@chromium.org>
Cr-Commit-Position: refs/heads/master@{#797508}
parent 19fd80ba
...@@ -5,6 +5,9 @@ ...@@ -5,6 +5,9 @@
#include "chrome/browser/ui/views/frame/glass_browser_frame_view.h" #include "chrome/browser/ui/views/frame/glass_browser_frame_view.h"
#include <dwmapi.h> #include <dwmapi.h>
#include <algorithm>
#include <memory>
#include <utility> #include <utility>
#include "base/trace_event/common/trace_event_common.h" #include "base/trace_event/common/trace_event_common.h"
...@@ -82,11 +85,7 @@ SkColor GlassBrowserFrameView::GetReadableFeatureColor( ...@@ -82,11 +85,7 @@ SkColor GlassBrowserFrameView::GetReadableFeatureColor(
GlassBrowserFrameView::GlassBrowserFrameView(BrowserFrame* frame, GlassBrowserFrameView::GlassBrowserFrameView(BrowserFrame* frame,
BrowserView* browser_view) BrowserView* browser_view)
: BrowserNonClientFrameView(frame, browser_view), : BrowserNonClientFrameView(frame, browser_view) {
window_icon_(nullptr),
window_title_(nullptr),
throbber_running_(false),
throbber_frame_(0) {
// We initialize all fields despite some of them being unused in some modes, // We initialize all fields despite some of them being unused in some modes,
// since it's possible for modes to flip dynamically (e.g. if the user enables // since it's possible for modes to flip dynamically (e.g. if the user enables
// a high-contrast theme). Throbber icons are only used when ShowSystemIcon() // a high-contrast theme). Throbber icons are only used when ShowSystemIcon()
...@@ -135,8 +134,7 @@ GlassBrowserFrameView::GlassBrowserFrameView(BrowserFrame* frame, ...@@ -135,8 +134,7 @@ GlassBrowserFrameView::GlassBrowserFrameView(BrowserFrame* frame,
browser_view->browser()->is_focus_mode() ? 0 : kTopResizeFrameArea; browser_view->browser()->is_focus_mode() ? 0 : kTopResizeFrameArea;
} }
GlassBrowserFrameView::~GlassBrowserFrameView() { GlassBrowserFrameView::~GlassBrowserFrameView() = default;
}
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
// GlassBrowserFrameView, BrowserNonClientFrameView implementation: // GlassBrowserFrameView, BrowserNonClientFrameView implementation:
...@@ -564,9 +562,6 @@ SkColor GlassBrowserFrameView::GetTitlebarColor() const { ...@@ -564,9 +562,6 @@ SkColor GlassBrowserFrameView::GetTitlebarColor() const {
void GlassBrowserFrameView::PaintTitlebar(gfx::Canvas* canvas) const { void GlassBrowserFrameView::PaintTitlebar(gfx::Canvas* canvas) const {
TRACE_EVENT0("views.frame", "GlassBrowserFrameView::PaintTitlebar"); TRACE_EVENT0("views.frame", "GlassBrowserFrameView::PaintTitlebar");
cc::PaintFlags flags;
gfx::ScopedCanvas scoped_canvas(canvas);
float scale = canvas->UndoDeviceScaleFactor();
// This is the pixel-accurate version of WindowTopY(). Scaling the DIP values // This is the pixel-accurate version of WindowTopY(). Scaling the DIP values
// here compounds precision error, which exposes unpainted client area. When // here compounds precision error, which exposes unpainted client area. When
// restored it uses the system dsf instead of the per-monitor dsf to match // restored it uses the system dsf instead of the per-monitor dsf to match
...@@ -595,6 +590,9 @@ void GlassBrowserFrameView::PaintTitlebar(gfx::Canvas* canvas) const { ...@@ -595,6 +590,9 @@ void GlassBrowserFrameView::PaintTitlebar(gfx::Canvas* canvas) const {
const int color_id = ShouldPaintAsActive() const int color_id = ShouldPaintAsActive()
? ThemeProperties::COLOR_ACCENT_BORDER_ACTIVE ? ThemeProperties::COLOR_ACCENT_BORDER_ACTIVE
: ThemeProperties::COLOR_ACCENT_BORDER_INACTIVE; : ThemeProperties::COLOR_ACCENT_BORDER_INACTIVE;
gfx::ScopedCanvas scoped_canvas(canvas);
float scale = canvas->UndoDeviceScaleFactor();
cc::PaintFlags flags;
flags.setColor(color_utils::GetResultingPaintColor( flags.setColor(color_utils::GetResultingPaintColor(
GetThemeProvider()->GetColor(color_id), titlebar_color)); GetThemeProvider()->GetColor(color_id), titlebar_color));
canvas->DrawRect(gfx::RectF(0, 0, width() * scale, y), flags); canvas->DrawRect(gfx::RectF(0, 0, width() * scale, y), flags);
...@@ -638,7 +636,6 @@ void GlassBrowserFrameView::LayoutTitleBar() { ...@@ -638,7 +636,6 @@ void GlassBrowserFrameView::LayoutTitleBar() {
if (!ShowCustomIcon() && !ShowCustomTitle()) if (!ShowCustomIcon() && !ShowCustomTitle())
return; return;
gfx::Rect window_icon_bounds;
const int icon_size = const int icon_size =
display::win::ScreenWin::GetSystemMetricsInDIP(SM_CYSMICON); display::win::ScreenWin::GetSystemMetricsInDIP(SM_CYSMICON);
const int titlebar_visual_height = const int titlebar_visual_height =
...@@ -654,7 +651,8 @@ void GlassBrowserFrameView::LayoutTitleBar() { ...@@ -654,7 +651,8 @@ void GlassBrowserFrameView::LayoutTitleBar() {
int next_trailing_x = MinimizeButtonX(); int next_trailing_x = MinimizeButtonX();
const int y = window_top + (titlebar_visual_height - icon_size) / 2; const int y = window_top + (titlebar_visual_height - icon_size) / 2;
window_icon_bounds = gfx::Rect(next_leading_x, y, icon_size, icon_size); const gfx::Rect window_icon_bounds =
gfx::Rect(next_leading_x, y, icon_size, icon_size);
constexpr int kIconTitleSpacing = 5; constexpr int kIconTitleSpacing = 5;
if (ShowCustomIcon()) { if (ShowCustomIcon()) {
......
...@@ -31,6 +31,8 @@ class GlassBrowserFrameView : public BrowserNonClientFrameView, ...@@ -31,6 +31,8 @@ class GlassBrowserFrameView : public BrowserNonClientFrameView,
// Constructs a non-client view for an BrowserFrame. // Constructs a non-client view for an BrowserFrame.
GlassBrowserFrameView(BrowserFrame* frame, BrowserView* browser_view); GlassBrowserFrameView(BrowserFrame* frame, BrowserView* browser_view);
GlassBrowserFrameView(const GlassBrowserFrameView&) = delete;
GlassBrowserFrameView& operator=(const GlassBrowserFrameView&) = delete;
~GlassBrowserFrameView() override; ~GlassBrowserFrameView() override;
// BrowserNonClientFrameView: // BrowserNonClientFrameView:
...@@ -74,7 +76,7 @@ class GlassBrowserFrameView : public BrowserNonClientFrameView, ...@@ -74,7 +76,7 @@ class GlassBrowserFrameView : public BrowserNonClientFrameView,
SkColor GetTitlebarColor() const; SkColor GetTitlebarColor() const;
views::Label* window_title_for_testing() { return window_title_; } const views::Label* window_title_for_testing() const { return window_title_; }
protected: protected:
// views::View: // views::View:
...@@ -156,8 +158,8 @@ class GlassBrowserFrameView : public BrowserNonClientFrameView, ...@@ -156,8 +158,8 @@ class GlassBrowserFrameView : public BrowserNonClientFrameView,
base::win::ScopedHICON big_window_icon_; base::win::ScopedHICON big_window_icon_;
// Icon and title. Only used when custom-drawing the titlebar for popups. // Icon and title. Only used when custom-drawing the titlebar for popups.
TabIconView* window_icon_; TabIconView* window_icon_ = nullptr;
views::Label* window_title_; views::Label* window_title_ = nullptr;
// The container holding the caption buttons (minimize, maximize, close, etc.) // The container holding the caption buttons (minimize, maximize, close, etc.)
// //
...@@ -170,10 +172,10 @@ class GlassBrowserFrameView : public BrowserNonClientFrameView, ...@@ -170,10 +172,10 @@ class GlassBrowserFrameView : public BrowserNonClientFrameView,
GlassBrowserCaptionButtonContainer* caption_button_container_; GlassBrowserCaptionButtonContainer* caption_button_container_;
// Whether or not the window throbber is currently animating. // Whether or not the window throbber is currently animating.
bool throbber_running_; bool throbber_running_ = false;
// The index of the current frame of the throbber animation. // The index of the current frame of the throbber animation.
int throbber_frame_; int throbber_frame_ = 0;
// How much extra space to reserve in non-maximized windows for a drag handle. // How much extra space to reserve in non-maximized windows for a drag handle.
int drag_handle_padding_; int drag_handle_padding_;
...@@ -181,8 +183,6 @@ class GlassBrowserFrameView : public BrowserNonClientFrameView, ...@@ -181,8 +183,6 @@ class GlassBrowserFrameView : public BrowserNonClientFrameView,
static const int kThrobberIconCount = 24; static const int kThrobberIconCount = 24;
static HICON throbber_icons_[kThrobberIconCount]; static HICON throbber_icons_[kThrobberIconCount];
static void InitThrobberIcons(); static void InitThrobberIcons();
DISALLOW_COPY_AND_ASSIGN(GlassBrowserFrameView);
}; };
#endif // CHROME_BROWSER_UI_VIEWS_FRAME_GLASS_BROWSER_FRAME_VIEW_H_ #endif // CHROME_BROWSER_UI_VIEWS_FRAME_GLASS_BROWSER_FRAME_VIEW_H_
...@@ -19,6 +19,10 @@ ...@@ -19,6 +19,10 @@
class WebAppGlassBrowserFrameViewTest : public InProcessBrowserTest { class WebAppGlassBrowserFrameViewTest : public InProcessBrowserTest {
public: public:
WebAppGlassBrowserFrameViewTest() = default; WebAppGlassBrowserFrameViewTest() = default;
WebAppGlassBrowserFrameViewTest(const WebAppGlassBrowserFrameViewTest&) =
delete;
WebAppGlassBrowserFrameViewTest& operator=(
const WebAppGlassBrowserFrameViewTest&) = delete;
~WebAppGlassBrowserFrameViewTest() override = default; ~WebAppGlassBrowserFrameViewTest() override = default;
GURL GetAppURL() { return GURL("https://test.org"); } GURL GetAppURL() { return GURL("https://test.org"); }
...@@ -67,9 +71,6 @@ class WebAppGlassBrowserFrameViewTest : public InProcessBrowserTest { ...@@ -67,9 +71,6 @@ class WebAppGlassBrowserFrameViewTest : public InProcessBrowserTest {
BrowserView* browser_view_ = nullptr; BrowserView* browser_view_ = nullptr;
GlassBrowserFrameView* glass_frame_view_ = nullptr; GlassBrowserFrameView* glass_frame_view_ = nullptr;
WebAppFrameToolbarView* web_app_frame_toolbar_ = nullptr; WebAppFrameToolbarView* web_app_frame_toolbar_ = nullptr;
private:
DISALLOW_COPY_AND_ASSIGN(WebAppGlassBrowserFrameViewTest);
}; };
IN_PROC_BROWSER_TEST_F(WebAppGlassBrowserFrameViewTest, ThemeColor) { IN_PROC_BROWSER_TEST_F(WebAppGlassBrowserFrameViewTest, ThemeColor) {
......
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