Commit 18be5ab8 authored by James Cook's avatar James Cook Committed by Commit Bot

views: Extract MusViewsDelegate to its own file

I always have trouble finding it in aura_init.cc. Also, it will get
slightly more complex in a follow-up CL.

Make ViewsDelegate have default implementations for its last two
pure-virtual methods, since it has default impls for all the other
ones.

Bug: none
Change-Id: I544872bdbc8668c99c20c7759c25185df4ba6433
Reviewed-on: https://chromium-review.googlesource.com/1114215Reviewed-by: default avatarMichael Wasserman <msw@chromium.org>
Commit-Queue: James Cook <jamescook@chromium.org>
Cr-Commit-Position: refs/heads/master@{#570229}
parent 7a6346e3
...@@ -24,6 +24,8 @@ jumbo_component("mus") { ...@@ -24,6 +24,8 @@ jumbo_component("mus") {
"mus_client_observer.h", "mus_client_observer.h",
"mus_export.h", "mus_export.h",
"mus_property_mirror.h", "mus_property_mirror.h",
"mus_views_delegate.cc",
"mus_views_delegate.h",
"pointer_watcher_event_router.cc", "pointer_watcher_event_router.cc",
"pointer_watcher_event_router.h", "pointer_watcher_event_router.h",
"screen_mus.cc", "screen_mus.cc",
......
...@@ -18,34 +18,11 @@ ...@@ -18,34 +18,11 @@
#include "ui/base/material_design/material_design_controller.h" #include "ui/base/material_design/material_design_controller.h"
#include "ui/base/resource/resource_bundle.h" #include "ui/base/resource/resource_bundle.h"
#include "ui/base/ui_base_paths.h" #include "ui/base/ui_base_paths.h"
#include "ui/views/layout/layout_provider.h"
#include "ui/views/mus/mus_client.h" #include "ui/views/mus/mus_client.h"
#include "ui/views/views_delegate.h" #include "ui/views/mus/mus_views_delegate.h"
namespace views { namespace views {
namespace {
class MusViewsDelegate : public ViewsDelegate {
public:
MusViewsDelegate() {}
~MusViewsDelegate() override {}
private:
#if defined(OS_WIN)
HICON GetSmallWindowIcon() const override { return nullptr; }
#endif
void OnBeforeWidgetInit(
Widget::InitParams* params,
internal::NativeWidgetDelegate* delegate) override {}
LayoutProvider layout_provider_;
DISALLOW_COPY_AND_ASSIGN(MusViewsDelegate);
};
} // namespace
AuraInit::InitParams::InitParams() : resource_file("views_mus_resources.pak") {} AuraInit::InitParams::InitParams() : resource_file("views_mus_resources.pak") {}
AuraInit::InitParams::~InitParams() = default; AuraInit::InitParams::~InitParams() = default;
......
// Copyright 2018 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 "ui/views/mus/mus_views_delegate.h"
namespace views {
MusViewsDelegate::MusViewsDelegate() = default;
MusViewsDelegate::~MusViewsDelegate() = default;
} // namespace views
// Copyright 2018 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 UI_VIEWS_MUS_MUS_VIEWS_DELEGATE_H_
#define UI_VIEWS_MUS_MUS_VIEWS_DELEGATE_H_
#include "base/macros.h"
#include "ui/views/layout/layout_provider.h"
#include "ui/views/mus/mus_export.h"
#include "ui/views/views_delegate.h"
namespace views {
class VIEWS_MUS_EXPORT MusViewsDelegate : public ViewsDelegate {
public:
MusViewsDelegate();
~MusViewsDelegate() override;
private:
LayoutProvider layout_provider_;
DISALLOW_COPY_AND_ASSIGN(MusViewsDelegate);
};
} // namespace views
#endif // UI_VIEWS_MUS_MUS_VIEWS_DELEGATE_H_
...@@ -80,6 +80,10 @@ HICON ViewsDelegate::GetDefaultWindowIcon() const { ...@@ -80,6 +80,10 @@ HICON ViewsDelegate::GetDefaultWindowIcon() const {
return nullptr; return nullptr;
} }
HICON ViewsDelegate::GetSmallWindowIcon() const {
return nullptr;
}
bool ViewsDelegate::IsWindowInMetro(gfx::NativeWindow window) const { bool ViewsDelegate::IsWindowInMetro(gfx::NativeWindow window) const {
return false; return false;
} }
...@@ -100,6 +104,10 @@ void ViewsDelegate::AddRef() { ...@@ -100,6 +104,10 @@ void ViewsDelegate::AddRef() {
void ViewsDelegate::ReleaseRef() { void ViewsDelegate::ReleaseRef() {
} }
void ViewsDelegate::OnBeforeWidgetInit(
Widget::InitParams* params,
internal::NativeWidgetDelegate* delegate) {}
base::TimeDelta ViewsDelegate::GetTextfieldPasswordRevealDuration() { base::TimeDelta ViewsDelegate::GetTextfieldPasswordRevealDuration() {
return base::TimeDelta(); return base::TimeDelta();
} }
......
...@@ -151,7 +151,7 @@ class VIEWS_EXPORT ViewsDelegate { ...@@ -151,7 +151,7 @@ class VIEWS_EXPORT ViewsDelegate {
// Retrieves the default window icon to use for windows if none is specified. // Retrieves the default window icon to use for windows if none is specified.
virtual HICON GetDefaultWindowIcon() const; virtual HICON GetDefaultWindowIcon() const;
// Retrieves the small window icon to use for windows if none is specified. // Retrieves the small window icon to use for windows if none is specified.
virtual HICON GetSmallWindowIcon() const = 0; virtual HICON GetSmallWindowIcon() const;
// Returns true if the window passed in is in the Windows 8 metro // Returns true if the window passed in is in the Windows 8 metro
// environment. // environment.
virtual bool IsWindowInMetro(gfx::NativeWindow window) const; virtual bool IsWindowInMetro(gfx::NativeWindow window) const;
...@@ -171,7 +171,7 @@ class VIEWS_EXPORT ViewsDelegate { ...@@ -171,7 +171,7 @@ class VIEWS_EXPORT ViewsDelegate {
// Gives the platform a chance to modify the properties of a Widget. // Gives the platform a chance to modify the properties of a Widget.
virtual void OnBeforeWidgetInit(Widget::InitParams* params, virtual void OnBeforeWidgetInit(Widget::InitParams* params,
internal::NativeWidgetDelegate* delegate) = 0; internal::NativeWidgetDelegate* delegate);
// Returns the password reveal duration for Textfield. // Returns the password reveal duration for Textfield.
virtual base::TimeDelta GetTextfieldPasswordRevealDuration(); virtual base::TimeDelta GetTextfieldPasswordRevealDuration();
......
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