Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(140)

Unified Diff: components/mus/example/mock_sysui/mock_sysui.cc

Issue 1469733004: Moves components/mus/examples into mash (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: git add Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « components/mus/example/mock_sysui/mock_sysui.h ('k') | components/mus/example/views_examples/BUILD.gn » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/mus/example/mock_sysui/mock_sysui.cc
diff --git a/components/mus/example/mock_sysui/mock_sysui.cc b/components/mus/example/mock_sysui/mock_sysui.cc
deleted file mode 100644
index 6a0a67f95e0e2fa13d91df3dddd6f2a08f6f98ae..0000000000000000000000000000000000000000
--- a/components/mus/example/mock_sysui/mock_sysui.cc
+++ /dev/null
@@ -1,110 +0,0 @@
-// Copyright 2015 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 "components/mus/example/mock_sysui/mock_sysui.h"
-
-#include "components/mus/public/cpp/property_type_converters.h"
-#include "mash/wm/public/interfaces/container.mojom.h"
-#include "mojo/application/public/cpp/application_connection.h"
-#include "mojo/application/public/cpp/application_impl.h"
-#include "ui/gfx/canvas.h"
-#include "ui/views/mus/aura_init.h"
-#include "ui/views/mus/native_widget_mus.h"
-#include "ui/views/mus/window_manager_connection.h"
-#include "ui/views/widget/widget_delegate.h"
-
-namespace {
-
-class DesktopBackground : public views::WidgetDelegateView {
- public:
- static void Create(mojo::Shell* shell) {
- views::Widget* widget = new views::Widget;
- views::Widget::InitParams params(
- views::Widget::InitParams::TYPE_WINDOW_FRAMELESS);
- params.delegate = new DesktopBackground;
-
- std::map<std::string, std::vector<uint8_t>> properties;
- properties[mash::wm::mojom::kWindowContainer_Property] =
- mojo::TypeConverter<const std::vector<uint8_t>, int32_t>::Convert(
- mash::wm::mojom::CONTAINER_USER_BACKGROUND);
- mus::Window* window =
- views::WindowManagerConnection::Get()->NewWindow(properties);
- params.native_widget = new views::NativeWidgetMus(
- widget, shell, window, mus::mojom::SURFACE_TYPE_DEFAULT);
- widget->Init(params);
- widget->Show();
- }
-
- private:
- DesktopBackground() {}
- ~DesktopBackground() override {}
-
- // Overridden from views::View:
- void OnPaint(gfx::Canvas* canvas) override {
- canvas->FillRect(GetLocalBounds(), SK_ColorRED);
- }
-
- // Overridden from views::WidgetDelegate:
- views::View* GetContentsView() override { return this; }
-
- DISALLOW_COPY_AND_ASSIGN(DesktopBackground);
-};
-
-class Shelf : public views::WidgetDelegateView {
- public:
- static void Create(mojo::Shell* shell) {
- views::Widget* widget = new views::Widget;
- views::Widget::InitParams params(
- views::Widget::InitParams::TYPE_WINDOW_FRAMELESS);
- params.delegate = new Shelf;
-
- std::map<std::string, std::vector<uint8_t>> properties;
- properties[mash::wm::mojom::kWindowContainer_Property] =
- mojo::TypeConverter<const std::vector<uint8_t>, int32_t>::Convert(
- mash::wm::mojom::CONTAINER_USER_SHELF);
- mus::Window* window =
- views::WindowManagerConnection::Get()->NewWindow(properties);
- params.native_widget = new views::NativeWidgetMus(
- widget, shell, window, mus::mojom::SURFACE_TYPE_DEFAULT);
- widget->Init(params);
- widget->Show();
- }
-
- private:
- Shelf() {}
- ~Shelf() override {}
-
- // Overridden from views::View:
- void OnPaint(gfx::Canvas* canvas) override {
- canvas->FillRect(GetLocalBounds(), SK_ColorYELLOW);
- }
- gfx::Size GetPreferredSize() const override { return gfx::Size(1, 48); }
-
- // Overridden from views::WidgetDelegate:
- views::View* GetContentsView() override { return this; }
-
- DISALLOW_COPY_AND_ASSIGN(Shelf);
-};
-
-} // namespace
-
-MockSysUI::MockSysUI() {}
-
-MockSysUI::~MockSysUI() {
-}
-
-void MockSysUI::Initialize(mojo::ApplicationImpl* app) {
- tracing_.Initialize(app);
-
- aura_init_.reset(new views::AuraInit(app, "views_mus_resources.pak"));
- views::WindowManagerConnection::Create(app);
-
- DesktopBackground::Create(app->shell());
- Shelf::Create(app->shell());
-}
-
-bool MockSysUI::ConfigureIncomingConnection(
- mojo::ApplicationConnection* connection) {
- return false;
-}
« no previous file with comments | « components/mus/example/mock_sysui/mock_sysui.h ('k') | components/mus/example/views_examples/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698