Commit 49d1cf7f authored by Sean Topping's avatar Sean Topping Committed by Commit Bot

[Chromecast] Introduce MediaControlUi

Adds MediaControlUi, which can be used to enable a simple touch UI for
media apps without a touch-supported UI. Some other changes are included
in this CL to simplify internal code as a result of this change:

* Remove CastWindowManager from CastContentWindow public API.
* Rename CastWindowManager::SetWindowId() to SetZOrder().
* Move CastContentWindow from "shell" namespace to "chromecast".

Merge-With: eureka-internal/316519

Bug: internal b/137663169
Test: CQ

Change-Id: I2d78e73162bb30a652f591b5def651468e44eaf6
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1817146Reviewed-by: default avatarScott Violet <sky@chromium.org>
Reviewed-by: default avatarKen Rockot <rockot@google.com>
Reviewed-by: default avatarSimeon Anfinrud <sanfin@chromium.org>
Reviewed-by: default avatarYuchen Liu <yucliu@chromium.org>
Commit-Queue: Sean Topping <seantopping@chromium.org>
Cr-Commit-Position: refs/heads/master@{#708712}
parent b35483a6
......@@ -210,6 +210,7 @@ cast_source_set("browser") {
"android/cast_content_window_android.cc",
"android/cast_content_window_android.h",
"android/cast_metrics_helper_android.cc",
"android/cast_web_contents_manager_android.cc",
]
deps += [
":jni_headers",
......@@ -245,9 +246,13 @@ cast_source_set("browser") {
sources += [
"cast_content_window_aura.cc",
"cast_content_window_aura.h",
"cast_web_contents_manager_aura.cc",
]
deps += [ "//ui/views:views" ]
deps += [
"//chromecast/ui:media_control_ui",
"//ui/views:views",
]
}
if (!is_fuchsia) {
......@@ -443,6 +448,7 @@ cast_source_set("public") {
deps = [
"//base",
"//chromecast/graphics",
"//chromecast/ui/mojom",
"//content/public/common",
"//ui/events",
"//url",
......
......@@ -12,6 +12,7 @@ include_rules = [
"+chromecast/metrics",
"+chromecast/net",
"+chromecast/service",
"+chromecast/ui",
"+components/cdm/browser",
"+components/crash",
"+components/download/public/common",
......
......@@ -19,7 +19,7 @@ import org.chromium.content_public.browser.WebContents;
* <p>
* See chromecast/browser/cast_content_window_android.* for the native half.
*/
@JNINamespace("chromecast::shell")
@JNINamespace("chromecast")
public class CastContentWindowAndroid implements CastWebContentsComponent.OnComponentClosedHandler,
CastWebContentsComponent.SurfaceEventHandler {
private static final String TAG = "CastContentWindow";
......
......@@ -19,8 +19,6 @@ namespace chromecast {
using base::android::ConvertUTF8ToJavaString;
namespace shell {
namespace {
base::android::ScopedJavaLocalRef<jobject> CreateJavaWindow(
......@@ -39,12 +37,6 @@ base::android::ScopedJavaLocalRef<jobject> CreateJavaWindow(
} // namespace
// static
std::unique_ptr<CastContentWindow> CastContentWindow::Create(
const CastContentWindow::CreateParams& params) {
return base::WrapUnique(new CastContentWindowAndroid(params));
}
CastContentWindowAndroid::CastContentWindowAndroid(
const CastContentWindow::CreateParams& params)
: delegate_(params.delegate),
......@@ -63,14 +55,13 @@ CastContentWindowAndroid::~CastContentWindowAndroid() {
}
void CastContentWindowAndroid::CreateWindowForWebContents(
content::WebContents* web_contents,
CastWindowManager* /* window_manager */,
CastWindowManager::WindowId /* z_order */,
CastWebContents* cast_web_contents,
mojom::ZOrder /* z_order */,
VisibilityPriority visibility_priority) {
DCHECK(web_contents);
DCHECK(cast_web_contents);
JNIEnv* env = base::android::AttachCurrentThread();
base::android::ScopedJavaLocalRef<jobject> java_web_contents =
web_contents->GetJavaWebContents();
cast_web_contents->web_contents()->GetJavaWebContents();
Java_CastContentWindowAndroid_createWindowForWebContents(
env, java_window_, java_web_contents,
......@@ -141,5 +132,5 @@ base::android::ScopedJavaLocalRef<jstring> CastContentWindowAndroid::GetId(
const base::android::JavaParamRef<jobject>& jcaller) {
return ConvertUTF8ToJavaString(env, delegate_->GetId());
}
} // namespace shell
} // namespace chromecast
......@@ -16,19 +16,19 @@ class WebContents;
} // namespace content
namespace chromecast {
namespace shell {
// Android implementation of CastContentWindow, which displays WebContents in
// CastWebContentsActivity.
class CastContentWindowAndroid : public CastContentWindow {
public:
explicit CastContentWindowAndroid(
const CastContentWindow::CreateParams& params);
~CastContentWindowAndroid() override;
// CastContentWindow implementation:
void CreateWindowForWebContents(
content::WebContents* web_contents,
CastWindowManager* window_manager,
CastWindowManager::WindowId z_order,
CastWebContents* cast_web_contents,
mojom::ZOrder z_order,
VisibilityPriority visibility_priority) override;
void GrantScreenAccess() override;
void RevokeScreenAccess() override;
......@@ -53,18 +53,12 @@ class CastContentWindowAndroid : public CastContentWindow {
const base::android::JavaParamRef<jobject>& jcaller);
private:
friend class CastContentWindow;
// This class should only be instantiated by CastContentWindow::Create.
CastContentWindowAndroid(const CastContentWindow::CreateParams& params);
CastContentWindow::Delegate* const delegate_;
base::android::ScopedJavaGlobalRef<jobject> java_window_;
DISALLOW_COPY_AND_ASSIGN(CastContentWindowAndroid);
};
} // namespace shell
} // namespace chromecast
#endif // CHROMECAST_BROWSER_ANDROID_CAST_CONTENT_WINDOW_ANDROID_H_
// Copyright 2019 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 "chromecast/browser/cast_web_contents_manager.h"
#include <memory>
#include "chromecast/browser/android/cast_content_window_android.h"
namespace chromecast {
std::unique_ptr<CastContentWindow> CastWebContentsManager::CreateWindow(
const CastContentWindow::CreateParams& params) {
return std::make_unique<CastContentWindowAndroid>(params);
}
} // namespace chromecast
......@@ -7,7 +7,6 @@
#include "chromecast/base/chromecast_switches.h"
namespace chromecast {
namespace shell {
namespace {
constexpr int kDefaultBackGestureHorizontalThreshold = 80;
......@@ -117,5 +116,4 @@ void CastContentGestureHandler::HandleTapGesture(
delegate_->ConsumeGesture(GestureType::TAP);
}
} // namespace shell
} // namespace chromecast
......@@ -12,8 +12,6 @@
namespace chromecast {
namespace shell {
// Receives root window level gestures, interprets them, and hands them to the
// CastContentWindow::Delegate.
class CastContentGestureHandler : public CastGestureHandler {
......@@ -47,7 +45,6 @@ class CastContentGestureHandler : public CastGestureHandler {
base::ElapsedTimer current_swipe_time_;
};
} // namespace shell
} // namespace chromecast
#endif // CHROMECAST_BROWSER_CAST_CONTENT_GESTURE_HANDLER_H_
......@@ -18,7 +18,6 @@ using testing::SetArgPointee;
using testing::WithArg;
namespace chromecast {
namespace shell {
namespace {
......@@ -255,5 +254,5 @@ TEST_F(CastContentGestureHandlerTest, VerifySimpleRightSuccess) {
dispatcher_.HandleSideSwipe(CastSideSwipeEvent::END,
CastSideSwipeOrigin::LEFT, kRightGestureEndPoint);
}
} // namespace shell
} // namespace chromecast
......@@ -5,13 +5,14 @@
#include "chromecast/browser/cast_content_window.h"
namespace chromecast {
namespace shell {
CastContentWindow::CastContentWindow() = default;
CastContentWindow::~CastContentWindow() = default;
CastContentWindow::CreateParams::CreateParams() = default;
CastContentWindow::CreateParams::CreateParams(const CreateParams& other) =
default;
void CastContentWindow::AddObserver(Observer* observer) {
observer_list_.AddObserver(observer);
......@@ -21,5 +22,8 @@ void CastContentWindow::RemoveObserver(Observer* observer) {
observer_list_.RemoveObserver(observer);
}
} // namespace shell
mojom::MediaControlUi* CastContentWindow::media_controls() {
return nullptr;
}
} // namespace chromecast
......@@ -12,13 +12,13 @@
#include "base/memory/ref_counted.h"
#include "base/observer_list.h"
#include "base/observer_list_types.h"
#include "chromecast/graphics/cast_window_manager.h"
#include "chromecast/browser/cast_web_contents.h"
#include "chromecast/graphics/gestures/cast_gesture_handler.h"
#include "content/public/browser/web_contents.h"
#include "chromecast/ui/mojom/media_control_ui.mojom.h"
#include "chromecast/ui/mojom/ui_service.mojom.h"
#include "ui/events/event.h"
namespace chromecast {
namespace shell {
// Describes visual context of the window within the UI.
// GENERATED_JAVA_ENUM_PACKAGE: org.chromium.chromecast.shell
......@@ -146,6 +146,7 @@ class CastContentWindow {
CastGestureHandler::Priority::NONE;
CreateParams();
CreateParams(const CreateParams& other);
};
class Observer : public base::CheckedObserver {
......@@ -157,23 +158,18 @@ class CastContentWindow {
~Observer() override {}
};
// Creates the platform specific CastContentWindow. |delegate| should outlive
// the created CastContentWindow.
static std::unique_ptr<CastContentWindow> Create(const CreateParams& params);
CastContentWindow();
virtual ~CastContentWindow();
// Creates a full-screen window for |web_contents| and displays it if screen
// access has been granted.
// |web_contents| should outlive this CastContentWindow.
// |window_manager| should outlive this CastContentWindow.
// Creates a full-screen window for |cast_web_contents| and displays it if
// screen access has been granted. |cast_web_contents| must outlive the
// CastContentWindow. |z_order| is provided so that windows which share the
// same parent have a well-defined order.
// TODO(seantopping): This method probably shouldn't exist; this class should
// use RAII instead.
virtual void CreateWindowForWebContents(
content::WebContents* web_contents,
CastWindowManager* window_manager,
CastWindowManager::WindowId z_order,
CastWebContents* cast_web_contents,
mojom::ZOrder z_order,
VisibilityPriority visibility_priority) = 0;
// Allows the window to be shown on the screen. The window cannot be shown on
......@@ -209,6 +205,9 @@ class CastContentWindow {
// screen.
virtual void RequestMoveOut() = 0;
// Media control interface. Non-null on Aura platforms.
virtual mojom::MediaControlUi* media_controls();
// Observer interface:
void AddObserver(Observer* observer);
void RemoveObserver(Observer* observer);
......@@ -217,7 +216,6 @@ class CastContentWindow {
base::ObserverList<Observer> observer_list_;
};
} // namespace shell
} // namespace chromecast
#endif // CHROMECAST_BROWSER_CAST_CONTENT_WINDOW_H_
......@@ -10,13 +10,13 @@
#include "base/memory/ptr_util.h"
#include "chromecast/chromecast_buildflags.h"
#include "chromecast/graphics/cast_window_manager.h"
#include "chromecast/ui/media_control_ui.h"
#include "content/public/browser/web_contents.h"
#include "ui/aura/window.h"
#include "ui/display/display.h"
#include "ui/display/screen.h"
namespace chromecast {
namespace shell {
class TouchBlocker : public ui::EventHandler, public aura::WindowObserver {
public:
......@@ -69,15 +69,11 @@ class TouchBlocker : public ui::EventHandler, public aura::WindowObserver {
DISALLOW_COPY_AND_ASSIGN(TouchBlocker);
};
// static
std::unique_ptr<CastContentWindow> CastContentWindow::Create(
const CastContentWindow::CreateParams& params) {
return base::WrapUnique(new CastContentWindowAura(params));
}
CastContentWindowAura::CastContentWindowAura(
const CastContentWindow::CreateParams& params)
const CastContentWindow::CreateParams& params,
CastWindowManager* window_manager)
: delegate_(params.delegate),
window_manager_(window_manager),
gesture_dispatcher_(
std::make_unique<CastContentGestureHandler>(delegate_)),
gesture_priority_(params.gesture_priority),
......@@ -88,6 +84,7 @@ CastContentWindowAura::CastContentWindowAura(
}
CastContentWindowAura::~CastContentWindowAura() {
CastWebContents::Observer::Observe(nullptr);
if (window_manager_) {
window_manager_->RemoveGestureHandler(gesture_dispatcher_.get());
}
......@@ -97,22 +94,23 @@ CastContentWindowAura::~CastContentWindowAura() {
}
void CastContentWindowAura::CreateWindowForWebContents(
content::WebContents* web_contents,
CastWindowManager* window_manager,
CastWindowManager::WindowId z_order,
CastWebContents* cast_web_contents,
mojom::ZOrder z_order,
VisibilityPriority visibility_priority) {
DCHECK(web_contents);
window_manager_ = window_manager;
DCHECK(window_manager_);
window_ = web_contents->GetNativeView();
DCHECK(cast_web_contents);
DCHECK(window_manager_) << "A CastWindowManager must be provided before "
<< "creating a window for WebContents.";
CastWebContents::Observer::Observe(cast_web_contents);
window_ = cast_web_contents->web_contents()->GetNativeView();
if (!window_->HasObserver(this)) {
window_->AddObserver(this);
}
window_manager_->SetWindowId(window_, z_order);
window_manager_->SetZOrder(window_, z_order);
window_manager_->AddWindow(window_);
window_manager_->AddGestureHandler(gesture_dispatcher_.get());
touch_blocker_ = std::make_unique<TouchBlocker>(window_, !is_touch_enabled_);
media_controls_ = std::make_unique<MediaControlUi>(window_manager_);
if (has_screen_access_) {
window_->Show();
......@@ -150,6 +148,16 @@ void CastContentWindowAura::EnableTouchInput(bool enabled) {
}
}
mojom::MediaControlUi* CastContentWindowAura::media_controls() {
return media_controls_.get();
}
void CastContentWindowAura::MainFrameResized(const gfx::Rect& bounds) {
if (media_controls_) {
media_controls_->SetBounds(bounds);
}
}
void CastContentWindowAura::RequestVisibility(
VisibilityPriority visibility_priority) {}
......@@ -180,5 +188,4 @@ void CastContentWindowAura::OnWindowDestroyed(aura::Window* window) {
window_ = nullptr;
}
} // namespace shell
} // namespace chromecast
......@@ -8,32 +8,29 @@
#include "base/macros.h"
#include "chromecast/browser/cast_content_gesture_handler.h"
#include "chromecast/browser/cast_content_window.h"
#include "chromecast/ui/media_control_ui.h"
#include "ui/aura/window_observer.h"
namespace aura {
class Window;
} // namespace aura
namespace content {
class WebContents;
} // namespace content
namespace chromecast {
namespace shell {
class TouchBlocker;
class CastContentWindowAura : public CastContentWindow,
public CastWebContents::Observer,
public aura::WindowObserver {
public:
explicit CastContentWindowAura(const CastContentWindow::CreateParams& params);
CastContentWindowAura(const CastContentWindow::CreateParams& params,
CastWindowManager* window_manager);
~CastContentWindowAura() override;
// CastContentWindow implementation:
void CreateWindowForWebContents(
content::WebContents* web_contents,
CastWindowManager* window_manager,
CastWindowManager::WindowId z_order,
CastWebContents* cast_web_contents,
mojom::ZOrder z_order,
VisibilityPriority visibility_priority) override;
void GrantScreenAccess() override;
void RevokeScreenAccess() override;
......@@ -43,6 +40,10 @@ class CastContentWindowAura : public CastContentWindow,
void NotifyVisibilityChange(VisibilityType visibility_type) override;
void RequestMoveOut() override;
void EnableTouchInput(bool enabled) override;
mojom::MediaControlUi* media_controls() override;
// CastWebContents::Observer implementation:
void MainFrameResized(const gfx::Rect& bounds) override;
// aura::WindowObserver implementation:
void OnWindowVisibilityChanged(aura::Window* window, bool visible) override;
......@@ -50,6 +51,7 @@ class CastContentWindowAura : public CastContentWindow,
private:
CastContentWindow::Delegate* const delegate_;
CastWindowManager* const window_manager_;
// Utility class for detecting and dispatching gestures to delegates.
std::unique_ptr<CastContentGestureHandler> gesture_dispatcher_;
......@@ -58,15 +60,14 @@ class CastContentWindowAura : public CastContentWindow,
const bool is_touch_enabled_;
std::unique_ptr<TouchBlocker> touch_blocker_;
// TODO(seantopping): Inject in constructor.
CastWindowManager* window_manager_ = nullptr;
std::unique_ptr<MediaControlUi> media_controls_;
aura::Window* window_;
bool has_screen_access_;
DISALLOW_COPY_AND_ASSIGN(CastContentWindowAura);
};
} // namespace shell
} // namespace chromecast
#endif // CHROMECAST_BROWSER_CAST_CONTENT_WINDOW_AURA_H_
......@@ -25,9 +25,11 @@ namespace chromecast {
CastWebContentsManager::CastWebContentsManager(
content::BrowserContext* browser_context,
CastWebViewFactory* web_view_factory)
CastWebViewFactory* web_view_factory,
CastWindowManager* window_manager)
: browser_context_(browser_context),
web_view_factory_(web_view_factory),
window_manager_(window_manager),
task_runner_(base::SequencedTaskRunnerHandle::Get()),
weak_factory_(this) {
DCHECK(browser_context_);
......
......@@ -26,6 +26,7 @@ class WebContents;
namespace chromecast {
class CastWebViewFactory;
class CastWindowManager;
// This class dispenses CastWebView objects which are used to wrap WebContents
// in cast_shell. This class can take ownership of a WebContents instance when
......@@ -35,7 +36,8 @@ class CastWebViewFactory;
class CastWebContentsManager {
public:
CastWebContentsManager(content::BrowserContext* browser_context,
CastWebViewFactory* web_view_factory);
CastWebViewFactory* web_view_factory,
CastWindowManager* window_manager);
~CastWebContentsManager();
std::unique_ptr<CastWebView> CreateWebView(
......@@ -47,6 +49,9 @@ class CastWebContentsManager {
const CastWebView::CreateParams& params,
const GURL& initial_url);
std::unique_ptr<CastContentWindow> CreateWindow(
const CastContentWindow::CreateParams& params);
// Take ownership of |web_contents| and delete after |time_delta|, or sooner
// if necessary.
void DelayWebContentsDeletion(
......@@ -58,6 +63,7 @@ class CastWebContentsManager {
content::BrowserContext* const browser_context_;
CastWebViewFactory* const web_view_factory_;
CastWindowManager* const window_manager_;
base::flat_set<std::unique_ptr<content::WebContents>> expiring_web_contents_;
const scoped_refptr<base::SequencedTaskRunner> task_runner_;
......
// Copyright 2019 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 "chromecast/browser/cast_web_contents_manager.h"
#include <memory>
#include "chromecast/browser/cast_content_window_aura.h"
namespace chromecast {
std::unique_ptr<CastContentWindow> CastWebContentsManager::CreateWindow(
const CastContentWindow::CreateParams& params) {
return std::make_unique<CastContentWindowAura>(params, window_manager_);
}
} // namespace chromecast
......@@ -15,22 +15,18 @@
#include "base/values.h"
#include "chromecast/browser/cast_content_window.h"
#include "chromecast/browser/cast_web_contents.h"
#include "chromecast/graphics/cast_window_manager.h"
#include "chromecast/ui/mojom/ui_service.mojom.h"
#include "content/public/browser/bluetooth_chooser.h"
#include "content/public/browser/web_contents.h"
#include "url/gurl.h"
namespace chromecast {
class CastWindowManager;
using shell::VisibilityPriority;
// A simplified interface for loading and displaying WebContents in cast_shell.
class CastWebView {
public:
class Delegate : public CastWebContents::Delegate,
public shell::CastContentWindow::Delegate {
public CastContentWindow::Delegate {
public:
// Invoked by CastWebView when WebContentsDelegate::RunBluetoothChooser is
// called. Returns a BluetoothChooser, a class used to solicit bluetooth
......@@ -65,7 +61,7 @@ class CastWebView {
CastWebContents::InitParams web_contents_params;
// Parameters for creating the content window for this CastWebView.
shell::CastContentWindow::CreateParams window_params;
CastContentWindow::CreateParams window_params;
// Identifies the activity that is hosted by this CastWebView.
std::string activity_id = "";
......@@ -90,7 +86,7 @@ class CastWebView {
CastWebView();
virtual ~CastWebView();
virtual shell::CastContentWindow* window() const = 0;
virtual CastContentWindow* window() const = 0;
virtual content::WebContents* web_contents() const = 0;
......@@ -109,8 +105,7 @@ class CastWebView {
// Adds the page to the window manager and makes it visible to the user if
// |is_visible| is true. |z_order| determines how this window is layered in
// relationt other windows (higher value == more foreground).
virtual void InitializeWindow(CastWindowManager* window_manager,
CastWindowManager::WindowId z_order,
virtual void InitializeWindow(mojom::ZOrder z_order,
VisibilityPriority initial_priority) = 0;
// Allows the page to be shown on the screen. The page cannot be shown on the
......
......@@ -55,7 +55,7 @@ CastWebViewDefault::CastWebViewDefault(
CastWebContentsManager* web_contents_manager,
content::BrowserContext* browser_context,
scoped_refptr<content::SiteInstance> site_instance,
std::unique_ptr<shell::CastContentWindow> cast_content_window)
std::unique_ptr<CastContentWindow> cast_content_window)
: web_contents_manager_(web_contents_manager),
browser_context_(browser_context),
site_instance_(std::move(site_instance)),
......@@ -66,7 +66,7 @@ CastWebViewDefault::CastWebViewDefault(
cast_web_contents_(web_contents_.get(), params.web_contents_params),
window_(cast_content_window
? std::move(cast_content_window)
: shell::CastContentWindow::Create(params.window_params)),
: web_contents_manager->CreateWindow(params.window_params)),
resize_window_when_navigation_starts_(true) {
DCHECK(delegate_);
DCHECK(web_contents_manager_);
......@@ -90,7 +90,7 @@ CastWebViewDefault::CastWebViewDefault(
CastWebViewDefault::~CastWebViewDefault() {}
shell::CastContentWindow* CastWebViewDefault::window() const {
CastContentWindow* CastWebViewDefault::window() const {
return window_.get();
}
......@@ -127,13 +127,11 @@ void CastWebViewDefault::CloseContents(content::WebContents* source) {
cast_web_contents_.Stop(net::OK);
}
void CastWebViewDefault::InitializeWindow(CastWindowManager* window_manager,
CastWindowManager::WindowId z_order,
void CastWebViewDefault::InitializeWindow(mojom::ZOrder z_order,
VisibilityPriority initial_priority) {
DCHECK(window_manager);
DCHECK(window_);
window_->CreateWindowForWebContents(web_contents_.get(), window_manager,
z_order, initial_priority);
window_->CreateWindowForWebContents(&cast_web_contents_, z_order,
initial_priority);
web_contents_->Focus();
}
......
......@@ -26,7 +26,6 @@ class SiteInstance;
namespace chromecast {
class CastWebContentsManager;
class CastWindowManager;
// A simplified interface for loading and displaying WebContents in cast_shell.
class CastWebViewDefault : public CastWebView,
......@@ -34,22 +33,23 @@ class CastWebViewDefault : public CastWebView,
content::WebContentsDelegate {
public:
// |web_contents_manager| and |browser_context| should outlive this object.
// If |cast_content_window| is not provided, an instance will be constructed
// from |web_contents_manager|.
CastWebViewDefault(
const CreateParams& params,
CastWebContentsManager* web_contents_manager,
content::BrowserContext* browser_context,
scoped_refptr<content::SiteInstance> site_instance,
std::unique_ptr<shell::CastContentWindow> cast_content_window = nullptr);
std::unique_ptr<CastContentWindow> cast_content_window = nullptr);
~CastWebViewDefault() override;
// CastWebView implementation:
shell::CastContentWindow* window() const override;
CastContentWindow* window() const override;
content::WebContents* web_contents() const override;
CastWebContents* cast_web_contents() override;
void LoadUrl(GURL url) override;
void ClosePage(const base::TimeDelta& shutdown_delay) override;
void InitializeWindow(CastWindowManager* window_manager,
CastWindowManager::WindowId z_order,
void InitializeWindow(mojom::ZOrder z_order,
VisibilityPriority initial_priority) override;
void GrantScreenAccess() override;
void RevokeScreenAccess() override;
......@@ -91,7 +91,7 @@ class CastWebViewDefault : public CastWebView,
std::unique_ptr<content::WebContents> web_contents_;
CastWebContentsImpl cast_web_contents_;
std::unique_ptr<shell::CastContentWindow> window_;
std::unique_ptr<CastContentWindow> window_;
bool resize_window_when_navigation_starts_;
base::TimeDelta shutdown_delay_;
......
......@@ -9,7 +9,6 @@
#include "base/logging.h"
#include "chromecast/browser/cast_content_window_aura.h"
#include "chromecast/browser/cast_extension_host.h"
#include "chromecast/graphics/cast_window_manager.h"
#include "content/public/browser/render_view_host.h"
#include "content/public/browser/render_widget_host.h"
#include "content/public/browser/render_widget_host_view.h"
......@@ -19,12 +18,12 @@ namespace chromecast {
ExtensionPage::ExtensionPage(
const CastWebContents::InitParams& init_params,
const shell::CastContentWindow::CreateParams& window_params,
const CastContentWindow::CreateParams& window_params,
std::unique_ptr<CastExtensionHost> extension_host,
CastWindowManager* window_manager)
: window_(std::make_unique<shell::CastContentWindowAura>(window_params)),
: window_(std::make_unique<CastContentWindowAura>(window_params,
window_manager)),
extension_host_(std::move(extension_host)),
window_manager_(window_manager),
cast_web_contents_(extension_host_->host_contents(), init_params) {
content::WebContentsObserver::Observe(web_contents());
}
......@@ -48,8 +47,8 @@ void ExtensionPage::Launch() {
void ExtensionPage::InitializeWindow() {
window_->GrantScreenAccess();
window_->CreateWindowForWebContents(
web_contents(), window_manager_, CastWindowManager::APP,
chromecast::shell::VisibilityPriority::STICKY_ACTIVITY);
&cast_web_contents_, mojom::ZOrder::APP,
chromecast::VisibilityPriority::STICKY_ACTIVITY);
}
void ExtensionPage::RenderViewCreated(
......
......@@ -12,10 +12,8 @@
#include "content/public/browser/web_contents_observer.h"
namespace chromecast {
namespace shell {
class CastContentWindowAura;
} // namespace shell
class CastContentWindowAura;
class CastExtensionHost;
class CastWindowManager;
......@@ -23,10 +21,9 @@ class CastWindowManager;
class ExtensionPage : public content::WebContentsObserver {
public:
ExtensionPage(const CastWebContents::InitParams& init_params,
const shell::CastContentWindow::CreateParams& window_params,
const CastContentWindow::CreateParams& window_params,
std::unique_ptr<CastExtensionHost> extension_host,
CastWindowManager* window_manager);
~ExtensionPage() override;
content::WebContents* web_contents() const;
......@@ -39,9 +36,8 @@ class ExtensionPage : public content::WebContentsObserver {
// WebContentsObserver implementation:
void RenderViewCreated(content::RenderViewHost* render_view_host) override;
const std::unique_ptr<shell::CastContentWindowAura> window_;
const std::unique_ptr<CastContentWindowAura> window_;
const std::unique_ptr<CastExtensionHost> extension_host_;
CastWindowManager* window_manager_;
CastWebContentsImpl cast_web_contents_;
scoped_refptr<content::SiteInstance> site_instance_;
......
......@@ -43,12 +43,11 @@ CastServiceSimple::CastServiceSimple(content::BrowserContext* browser_context,
PrefService* pref_service,
CastWindowManager* window_manager)
: CastService(browser_context, pref_service),
window_manager_(window_manager),
web_view_factory_(std::make_unique<CastWebViewFactory>(browser_context)),
web_contents_manager_(
std::make_unique<CastWebContentsManager>(browser_context,
web_view_factory_.get())) {
DCHECK(window_manager_);
web_view_factory_.get(),
window_manager)) {
shell::CastBrowserProcess::GetInstance()->SetWebViewFactory(
web_view_factory_.get());
}
......@@ -79,8 +78,8 @@ void CastServiceSimple::StartInternal() {
cast_web_view_->LoadUrl(startup_url_);
cast_web_view_->GrantScreenAccess();
cast_web_view_->InitializeWindow(
window_manager_, CastWindowManager::APP,
chromecast::shell::VisibilityPriority::STICKY_ACTIVITY);
::chromecast::mojom::ZOrder::APP,
chromecast::VisibilityPriority::STICKY_ACTIVITY);
}
void CastServiceSimple::StopInternal() {
......
......@@ -43,7 +43,6 @@ class CastServiceSimple : public CastService, public CastWebView::Delegate {
std::string GetId() override;
private:
CastWindowManager* const window_manager_;
const std::unique_ptr<CastWebViewFactory> web_view_factory_;
const std::unique_ptr<CastWebContentsManager> web_contents_manager_;
std::unique_ptr<CastWebView> cast_web_view_;
......
......@@ -49,7 +49,7 @@ void CastBrowserTest::PreRunTestOnMainThread() {
CastBrowserProcess::GetInstance()->browser_context());
web_contents_manager_ = std::make_unique<CastWebContentsManager>(
CastBrowserProcess::GetInstance()->browser_context(),
web_view_factory_.get());
web_view_factory_.get(), nullptr /* window_manager */);
}
void CastBrowserTest::PostRunTestOnMainThread() {
......
......@@ -21,6 +21,10 @@ cast_source_set("graphics") {
"//ui/gfx",
]
public_deps = [
"//chromecast/ui/mojom",
]
if (use_aura) {
sources += [
"accessibility/accessibility_cursor_ring_layer.cc",
......
include_rules = [
"+chromecast/ui",
"+components/viz/common/frame_sinks",
"+ui/aura",
"+ui/base",
......
......@@ -34,8 +34,7 @@ TEST_F(CastViewsTest, ProgressBar) {
widget->Init(std::move(params));
widget->SetOpacity(0.6);
widget->SetContentsView(progress_bar);
window_manager->SetWindowId(widget->GetNativeView(),
CastWindowManager::VOLUME);
window_manager->SetZOrder(widget->GetNativeView(), mojom::ZOrder::VOLUME);
widget->Show();
EXPECT_TRUE(progress_bar->GetWidget());
......
......@@ -9,6 +9,7 @@
#include <vector>
#include "base/macros.h"
#include "chromecast/ui/mojom/ui_service.mojom.h"
#include "ui/gfx/native_widget_types.h"
namespace ui {
......@@ -66,8 +67,9 @@ class CastWindowManager {
// causing it to initialize.
virtual void AddWindow(gfx::NativeView window) = 0;
// Sets a window's ID.
virtual void SetWindowId(gfx::NativeView window, WindowId window_id) = 0;
// Sets the Z order for the window. This allows windows with the same parent
// to stack in a well-defined order.
virtual void SetZOrder(gfx::NativeView window, mojom::ZOrder z_order) = 0;
// Return the root window that holds all top-level windows.
virtual gfx::NativeView GetRootWindow() = 0;
......
......@@ -294,9 +294,12 @@ void CastWindowManagerAura::TearDown() {
window_tree_host_.reset();
}
void CastWindowManagerAura::SetWindowId(gfx::NativeView window,
WindowId window_id) {
window->set_id(window_id);
void CastWindowManagerAura::SetZOrder(gfx::NativeView window,
mojom::ZOrder z_order) {
// Use aura::Window ID to maintain z-order. When the window's visibility
// changes, we stack sibling windows based on this ID. Windows with higher
// IDs are stacked on top.
window->set_id(static_cast<int>(z_order));
}
void CastWindowManagerAura::InjectEvent(ui::Event* event) {
......
......@@ -44,7 +44,7 @@ class CastWindowManagerAura : public CastWindowManager,
void AddWindow(gfx::NativeView window) override;
gfx::NativeView GetRootWindow() override;
std::vector<WindowId> GetWindowOrder() override;
void SetWindowId(gfx::NativeView window, WindowId window_id) override;
void SetZOrder(gfx::NativeView window, mojom::ZOrder z_order) override;
void InjectEvent(ui::Event* event) override;
void AddObserver(Observer* observer) override;
void RemoveObserver(Observer* observer) override;
......
......@@ -25,8 +25,8 @@ CastWindowManagerDefault::GetWindowOrder() {
}
void CastWindowManagerDefault::InjectEvent(ui::Event* event) {}
void CastWindowManagerDefault::SetWindowId(gfx::NativeView window,
WindowId window_id) {}
void CastWindowManagerDefault::SetZOrder(gfx::NativeView window,
mojom::ZOrder z_order) {}
void CastWindowManagerDefault::AddObserver(Observer* observer) {}
void CastWindowManagerDefault::RemoveObserver(Observer* observer) {}
......
......@@ -20,7 +20,7 @@ class CastWindowManagerDefault : public CastWindowManager {
// CastWindowManager implementation:
void TearDown() override;
void AddWindow(gfx::NativeView window) override;
void SetWindowId(gfx::NativeView window, WindowId window_id) override;
void SetZOrder(gfx::NativeView window, mojom::ZOrder z_order) override;
gfx::NativeView GetRootWindow() override;
std::vector<WindowId> GetWindowOrder() override;
void InjectEvent(ui::Event* event) override;
......
......@@ -8,6 +8,7 @@
#include "base/threading/thread_checker.h"
#include "chromecast/graphics/cast_window_manager.h"
#include "chromecast/ui/mojom/ui_service.mojom.h"
#include "ui/aura/window.h"
#include "ui/gfx/canvas.h"
#include "ui/views/layout/layout_provider.h"
......@@ -93,7 +94,7 @@ RoundedWindowCornersAura::RoundedWindowCornersAura(
add_view(kCornerRadius, false, true);
add_view(kCornerRadius, true, true);
widget_.reset(new views::Widget);
widget_ = std::make_unique<views::Widget>();
views::Widget::InitParams params(views::Widget::InitParams::TYPE_POPUP);
params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET;
params.context = window_manager->GetRootWindow();
......@@ -104,8 +105,8 @@ RoundedWindowCornersAura::RoundedWindowCornersAura(
widget_->SetContentsView(main_view.release());
widget_->GetNativeWindow()->SetName("RoundCorners");
window_manager->SetWindowId(widget_->GetNativeView(),
CastWindowManager::CORNERS_OVERLAY);
window_manager->SetZOrder(widget_->GetNativeView(),
mojom::ZOrder::CORNERS_OVERLAY);
widget_->Show();
}
......
# Copyright 2019 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.
import("//chromecast/chromecast.gni")
import("//components/vector_icons/vector_icons.gni")
cast_source_set("media_control_ui") {
sources = [
"media_control_ui.cc",
"media_control_ui.h",
]
deps = [
":vector_icons",
"//base",
"//chromecast/base",
"//chromecast/graphics",
"//chromecast/ui/mojom",
"//ui/aura:aura",
"//ui/views",
]
}
# Rules for generating vector icon source files.
# Adapted from //components/vector_icons/BUILD.gn
aggregate_vector_icons("media_controls_vector_icons") {
icon_directory = "vector_icons"
icons = [
"back30.icon",
"forward30.icon",
"next.icon",
"pause.icon",
"play.icon",
"previous.icon",
]
}
static_library("vector_icons") {
sources = get_target_outputs(":media_controls_vector_icons")
deps = [
":media_controls_vector_icons",
"//base",
"//skia",
"//ui/gfx",
]
}
include_rules = [
"+chromecast/graphics",
"+mojo/public",
"+ui/aura",
"+ui/gfx",
"+ui/views",
]
seantopping@chromium.org
This diff is collapsed.
// Copyright 2019 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 CHROMECAST_UI_MEDIA_CONTROL_UI_H_
#define CHROMECAST_UI_MEDIA_CONTROL_UI_H_
#include <memory>
#include "base/memory/weak_ptr.h"
#include "base/sequence_checker.h"
#include "base/time/time.h"
#include "base/timer/timer.h"
#include "chromecast/ui/mojom/media_control_ui.mojom.h"
#include "chromecast/ui/vector_icons.h"
#include "mojo/public/cpp/bindings/remote.h"
#include "ui/views/controls/button/button.h"
#include "ui/views/controls/button/image_button.h"
#include "ui/views/controls/label.h"
#include "ui/views/controls/progress_bar.h"
#include "ui/views/layout/layout_provider.h"
#include "ui/views/widget/widget.h"
namespace chromecast {
class CastWindowManager;
// Provides a simple touch-based media UI for Aura platforms. This is used to
// enable simple touch support for media apps which are not yet touch-enabled.
// This class uses ui::views primitives to draw the UI.
class MediaControlUi : public mojom::MediaControlUi,
public views::ButtonListener {
public:
explicit MediaControlUi(CastWindowManager* window_manager);
~MediaControlUi() override;
void SetBounds(const gfx::Rect& new_bounds);
// mojom::MediaControlUi implementation:
void SetClient(
mojo::PendingRemote<mojom::MediaControlClient> client) override;
void SetAttributes(mojom::MediaControlUiAttributesPtr attributes) override;
private:
// Only shows the media control widget if the media app window is full screen.
void MaybeShowWidget();
void ShowMediaControls(bool visible);
bool visible() const;
void OnTapped();
std::unique_ptr<views::ImageButton> CreateImageButton(
const gfx::VectorIcon& icon,
int height);
// Place elements in the locations specified by the UI spec.
// In this case, using views::LayoutManager is more difficult since we care
// about the position of each specific button, not the positions of view
// children in general.
void LayoutElements();
// Update the media time progress bar.
void UpdateMediaTime();
// views::ButtonListener implementation:
void ButtonPressed(views::Button* sender, const ui::Event& event) override;
CastWindowManager* const window_manager_;
mojo::Remote<mojom::MediaControlClient> client_;
// This must be true to enable media overlay.
bool app_is_fullscreen_;
// UI components
std::unique_ptr<views::Widget> widget_;
std::unique_ptr<views::View> touch_view_;
std::unique_ptr<views::View> view_;
// Controls
std::unique_ptr<views::ImageButton> btn_previous_;
std::unique_ptr<views::ImageButton> btn_play_pause_;
std::unique_ptr<views::ImageButton> btn_next_;
std::unique_ptr<views::ImageButton> btn_replay30_;
std::unique_ptr<views::ImageButton> btn_forward30_;
// Labels
std::unique_ptr<views::Label> lbl_meta_;
std::unique_ptr<views::Label> lbl_title_;
// Progress
std::unique_ptr<views::ProgressBar> progress_bar_;
bool is_paused_;
double media_duration_;
// Last media playback time reported from the app.
double last_media_time_;
// The absolute time that |last_media_time_| was reported. This is used to
// extrapolate the current media playback time as time progresses.
base::TimeTicks last_media_timestamp_;
base::RepeatingTimer media_time_update_timer_;
views::LayoutProvider layout_provider_;
SEQUENCE_CHECKER(sequence_checker_);
base::WeakPtrFactory<MediaControlUi> weak_factory_;
DISALLOW_COPY_AND_ASSIGN(MediaControlUi);
};
} // namespace chromecast
#endif // CHROMECAST_UI_MEDIA_CONTROL_UI_H_
# Copyright 2019 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.
import("//mojo/public/tools/bindings/mojom.gni")
mojom("mojom") {
sources = [
"media_control_ui.mojom",
"ui_service.mojom",
]
}
per-file *.mojom=set noparent
per-file *.mojom=file://ipc/SECURITY_OWNERS
// Copyright 2019 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.
module chromecast.mojom;
// API for a touch-based media overlay UI. The client receives commands that
// are triggered from the UI. The client may also set various attributes on
// the UI, so that only relevant controls are visible to the user.
interface MediaControlUi {
// Set a client for the UI.
SetClient(pending_remote<MediaControlClient> client);
// Update the UI to match the new attributes.
SetAttributes(MediaControlUiAttributes attributes);
};
enum MediaCommand {
TOGGLE_PLAY_PAUSE,
NEXT,
PREVIOUS,
FORWARD_30_SECONDS,
REPLAY_30_SECONDS,
};
// Endpoint for plumbing media commands invoked by the UI.
interface MediaControlClient {
// Executes a media command on behalf of the UI. These commands are only
// triggered by user interaction via the touch-based UI.
Execute(MediaCommand command);
};
struct MediaControlUiAttributes {
// UI attributes.
bool show_seek;
bool show_next;
bool show_previous;
// Media attributes.
string title;
string metadata;
double current_time;
double duration;
bool is_playing;
bool is_paused;
};
// Copyright 2019 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.
module chromecast.mojom;
enum ZOrder {
// Base layer for web-based system UI, or for regular apps on Chromecast.
APP = -1,
// If the main system UI is web-based, then apps running in this layer won't
// be managed by the system web UI.
UNMANAGED_APP = 0,
// Diagnostic overlay for debugging.
DEBUG_OVERLAY = 1,
// Overlay apps with transparent backgrounds.
INFO_OVERLAY = 2,
// Unused.
SOFT_KEYBOARD = 3,
// Volume bar overlay.
VOLUME = 4,
// Touch-based media controls.
MEDIA_INFO = 5,
// Touch-based settings UI.
SETTINGS = 6,
// Boot animation.
BOOT_ANIMATION_OVERLAY = 7,
// Rounded corners for select devices.
CORNERS_OVERLAY = 8,
};
MOVE_TO, 4, 24,
R_ARC_TO, 1.5f, 1.5f, 0, 0, 1, 3, 0,
R_CUBIC_TO, 0, 9.39f, 7.61f, 17, 17, 17,
R_CUBIC_TO, 9.39f, 0, 17, -7.61f, 17, -17,
CUBIC_TO_SHORTHAND, 33.39f, 7, 24, 7,
R_H_LINE_TO, -3.5f,
R_ARC_TO, 1.5f, 1.5f, 0, 0, 1, 0, -3,
H_LINE_TO, 24,
R_CUBIC_TO, 11.05f, 0, 20, 8.95f, 20, 20,
R_CUBIC_TO, 0, 11.05f, -8.95f, 20, -20, 20,
CUBIC_TO_SHORTHAND, 4, 35.05f, 4, 24,
CLOSE,
MOVE_TO, 20.62f, 5.5f,
R_LINE_TO, 2.94f, 2.94f,
R_ARC_TO, 1.5f, 1.5f, 0, 0, 1, -2.12f, 2.12f,
R_LINE_TO, -4, -4,
R_ARC_TO, 1.5f, 1.5f, 0, 0, 1, 0, -2.12f,
R_LINE_TO, 4, -4,
R_ARC_TO, 1.5f, 1.5f, 0, 0, 1, 2.12f, 2.12f,
LINE_TO, 20.62f, 5.5f,
CLOSE,
MOVE_TO, 18.31f, 30.27f,
R_ARC_TO, 4.67f, 4.67f, 0, 0, 1, -2.76f, -0.8f,
ARC_TO, 4.15f, 4.15f, 0, 0, 1, 14, 27.14f,
R_LINE_TO, 2.43f, -1,
R_CUBIC_TO, 0.1f, 0.96f, 0.94f, 1.67f, 1.9f, 1.62f,
R_ARC_TO, 1.7f, 1.7f, 0, 0, 0, 1.07f, -0.36f,
R_ARC_TO, 1.15f, 1.15f, 0, 0, 0, 0.46f, -1,
R_CUBIC_TO, 0, -0.92f, -0.67f, -1.38f, -2, -1.38f,
R_H_LINE_TO, -1,
R_V_LINE_TO, -2.23f,
R_H_LINE_TO, 0.94f,
R_CUBIC_TO, 0.2f, 0, 0.4f, -0.02f, 0.59f, -0.07f,
R_CUBIC_TO, 0.18f, -0.04f, 0.36f, -0.11f, 0.52f, -0.21f,
R_ARC_TO, 1.07f, 1.07f, 0, 0, 0, 0.37f, -0.38f,
R_ARC_TO, 1.19f, 1.19f, 0, 0, 0, 0.14f, -0.59f,
R_CUBIC_TO, 0, -0.29f, -0.12f, -0.57f, -0.33f, -0.78f,
R_ARC_TO, 1.23f, 1.23f, 0, 0, 0, -0.93f, -0.34f,
R_ARC_TO, 1.45f, 1.45f, 0, 0, 0, -1, 0.36f,
R_ARC_TO, 1.79f, 1.79f, 0, 0, 0, -0.52f, 0.85f,
R_LINE_TO, -2.33f, -1,
R_ARC_TO, 4.21f, 4.21f, 0, 0, 1, 0.48f, -0.92f,
R_CUBIC_TO, 0.22f, -0.31f, 0.49f, -0.59f, 0.8f, -0.82f,
R_ARC_TO, 4.17f, 4.17f, 0, 0, 1, 1.14f, -0.59f,
R_ARC_TO, 4.47f, 4.47f, 0, 0, 1, 1.49f, -0.23f,
R_ARC_TO, 4.9f, 4.9f, 0, 0, 1, 1.57f, 0.24f,
ARC_TO, 3.74f, 3.74f, 0, 0, 1, 21, 19,
R_CUBIC_TO, 0.32f, 0.27f, 0.58f, 0.62f, 0.76f, 1,
R_CUBIC_TO, 0.16f, 0.36f, 0.25f, 0.76f, 0.24f, 1.16f,
R_ARC_TO, 3.25f, 3.25f, 0, 0, 1, -0.46f, 1.7f,
R_ARC_TO, 2.54f, 2.54f, 0, 0, 1, -0.46f, 0.56f,
R_ARC_TO, 2.11f, 2.11f, 0, 0, 1, -0.51f, 0.35f,
R_V_LINE_TO, 0.17f,
R_ARC_TO, 3, 3, 0, 0, 1, 1.34f, 1,
R_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IC_TO, 0.09f, 0.41f, 0.25f, 0.81f, 0.47f, 1.17f,
R_CUBIC_TO, 0.2f, 0.31f, 0.46f, 0.57f, 0.77f, 0.77f,
R_ARC_TO, 1.9f, 1.9f, 0, 0, 0, 1.06f, 0.28f,
CLOSE
MOVE_TO, 41, 24,
R_ARC_TO, 1.5f, 1.5f, 0, 0, 1, 3, 0,
R_CUBIC_TO, 0, 11.05f, -8.95f, 20, -20, 20,
CUBIC_TO_SHORTHAND, 4, 35.05f, 4, 24,
CUBIC_TO_SHORTHAND, 12.95f, 4, 24, 4,
R_H_LINE_TO, 3.5f,
R_ARC_TO, 1.5f, 1.5f, 0, 0, 1, 0, 3,
H_LINE_TO, 24,
CUBIC_TO, 14.61f, 7, 7, 14.61f, 7, 24,
R_CUBIC_TO, 0, 9.39f, 7.61f, 17, 17, 17,
R_CUBIC_TO, 9.39f, 0, 17, -7.61f, 17, -17,
CLOSE,
MOVE_TO, 24.44f, 2.56f,
ARC_TO, 1.5f, 1.5f, 0, 0, 1, 26.56f, 0.44f,
R_LINE_TO, 4, 4,
R_ARC_TO, 1.5f, 1.5f, 0, 0, 1, 0, 2.12f,
R_LINE_TO, -4, 4,
R_ARC_TO, 1.5f, 1.5f, 0, 0, 1, -2.12f, -2.12f,
R_LINE_TO, 2.94f, -2.94f,
R_LINE_TO, -2.94f, -2.94f,
CLOSE,
R_MOVE_TO, -6.13f, 27.71f,
R_ARC_TO, 4.67f, 4.67f, 0, 0, 1, -2.76f, -0.8f,
ARC_TO, 4.15f, 4.15f, 0, 0, 1, 14, 27.14f,
R_LINE_TO, 2.43f, -1,
R_CUBIC_TO, 0.1f, 0.96f, 0.94f, 1.67f, 1.9f, 1.62f,
R_ARC_TO, 1.7f, 1.7f, 0, 0, 0, 1.07f, -0.36f,
R_ARC_TO, 1.15f, 1.15f, 0, 0, 0, 0.46f, -1,
R_CUBIC_TO, 0, -0.92f, -0.67f, -1.38f, -2, -1.38f,
R_H_LINE_TO, -1,
R_V_LINE_TO, -2.23f,
R_H_LINE_TO, 0.94f,
R_CUBIC_TO, 0.2f, 0, 0.4f, -0.02f, 0.59f, -0.07f,
R_CUBIC_TO, 0.18f, -0.04f, 0.36f, -0.11f, 0.52f, -0.21f,
R_ARC_TO, 1.07f, 1.07f, 0, 0, 0, 0.37f, -0.38f,
R_ARC_TO, 1.19f, 1.19f, 0, 0, 0, 0.14f, -0.59f,
R_CUBIC_TO, 0, -0.29f, -0.12f, -0.57f, -0.33f, -0.78f,
R_ARC_TO, 1.23f, 1.23f, 0, 0, 0, -0.93f, -0.34f,
R_ARC_TO, 1.45f, 1.45f, 0, 0, 0, -1, 0.36f,
R_ARC_TO, 1.79f, 1.79f, 0, 0, 0, -0.52f, 0.85f,
R_LINE_TO, -2.33f, -1,
R_ARC_TO, 4.21f, 4.21f, 0, 0, 1, 0.48f, -0.92f,
R_CUBIC_TO, 0.22f, -0.31f, 0.49f, -0.59f, 0.8f, -0.82f,
R_ARC_TO, 4.17f, 4.17f, 0, 0, 1, 1.14f, -0.59f,
R_ARC_TO, 4.47f, 4.47f, 0, 0, 1, 1.49f, -0.23f,
R_ARC_TO, 4.9f, 4.9f, 0, 0, 1, 1.57f, 0.24f,
ARC_TO, 3.74f, 3.74f, 0, 0, 1, 21, 19,
R_CUBIC_TO, 0.32f, 0.27f, 0.58f, 0.62f, 0.76f, 1,
R_CUBIC_TO, 0.16f, 0.36f, 0.25f, 0.76f, 0.24f, 1.16f,
R_ARC_TO, 3.25f, 3.25f, 0, 0, 1, -0.46f, 1.7f,
R_ARC_TO, 2.54f, 2.54f, 0, 0, 1, -0.46f, 0.56f,
R_ARC_TO, 2.11f, 2.11f, 0, 0, 1, -0.51f, 0.35f,
R_V_LINE_TO, 0.17f,
R_ARC_TO, 3, 3, 0, 0, 1, 1.34f, 1,
R_ARC_TO, 3, 3, 0, 0, 1, 0.53f, 1.82f,
R_ARC_TO, 3.32f, 3.32f, 0, 0, 1, -0.29f, 1.39f,
R_ARC_TO, 3.21f, 3.21f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right 2019 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.
// vector_icons.cc.template is used to generate vector_icons.cc. Edit the former
// rather than the latter.
#include "chromecast/ui/vector_icons.h"
#include "base/logging.h"
#include "ui/gfx/vector_icon_types.h"
#include "components/vector_icons/cc_macros.h"
namespace chromecast {
namespace vector_icons {
using namespace gfx;
TEMPLATE_PLACEHOLDER
} // namespace vector_icons
} // namespace chromecast
// Copyright 2019 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.
// vector_icons.h.template is used to generate vector_icons.h. Edit the former
// rather than the latter.
#ifndef CHROMECAST_UI_VECTOR_ICONS_VECTOR_ICONS_H_
#define CHROMECAST_UI_VECTOR_ICONS_VECTOR_ICONS_H_
namespace gfx {
struct VectorIcon;
}
#define VECTOR_ICON_TEMPLATE_H(icon_name) \
extern const gfx::VectorIcon icon_name;
namespace chromecast {
namespace vector_icons {
TEMPLATE_PLACEHOLDER
} // namespace vector_icons
} // namespace chromecast
#undef VECTOR_ICON_TEMPLATE_H
#endif //CHROMECAST_UI_VECTOR_ICONS_VECTOR_ICONS_H_
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