| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "components/mus/example/views_examples/views_examples_application_deleg
ate.h" | 5 #include "components/mus/example/views_examples/views_examples_application_deleg
ate.h" |
| 6 | 6 |
| 7 #include "components/mus/example/common/mus_views_init.h" | 7 #include "components/mus/example/common/mus_views_init.h" |
| 8 #include "mojo/application/public/cpp/application_connection.h" | 8 #include "mojo/application/public/cpp/application_connection.h" |
| 9 #include "mojo/application/public/cpp/application_impl.h" | 9 #include "mojo/application/public/cpp/application_impl.h" |
| 10 #include "ui/views/examples/example_base.h" | 10 #include "ui/views/examples/example_base.h" |
| 11 #include "ui/views/examples/examples_window.h" | 11 #include "ui/views/examples/examples_window.h" |
| 12 #include "ui/views/widget/widget_delegate.h" | |
| 13 | 12 |
| 14 ViewsExamplesApplicationDelegate::ViewsExamplesApplicationDelegate() | 13 ViewsExamplesApplicationDelegate::ViewsExamplesApplicationDelegate() |
| 15 : app_(nullptr) {} | 14 : app_(nullptr) {} |
| 16 | 15 |
| 17 ViewsExamplesApplicationDelegate::~ViewsExamplesApplicationDelegate() { | 16 ViewsExamplesApplicationDelegate::~ViewsExamplesApplicationDelegate() { |
| 18 } | 17 } |
| 19 | 18 |
| 20 void ViewsExamplesApplicationDelegate::Initialize(mojo::ApplicationImpl* app) { | 19 void ViewsExamplesApplicationDelegate::Initialize(mojo::ApplicationImpl* app) { |
| 21 app_ = app; | 20 app_ = app; |
| 22 | 21 |
| 23 mus_views_init_.reset(new MUSViewsInit(app)); | 22 mus_views_init_.reset(new MUSViewsInit(app)); |
| 24 | 23 |
| 25 // TODO(sky): total hack! This is necessary as WindowTypeLauncherView is | |
| 26 // created before AuraInit. WindowTypeLauncherView uses resources that are | |
| 27 // configured by MUSViewsInit once a View is created. By creating a Widget | |
| 28 // here we ensure the necessary state has been setup. | |
| 29 views::Widget::CreateWindow(new views::WidgetDelegateView); | |
| 30 | |
| 31 views::examples::ShowExamplesWindow(views::examples::DO_NOTHING_ON_CLOSE, | 24 views::examples::ShowExamplesWindow(views::examples::DO_NOTHING_ON_CLOSE, |
| 32 nullptr, nullptr); | 25 nullptr, nullptr); |
| 33 } | 26 } |
| 34 | 27 |
| 35 bool ViewsExamplesApplicationDelegate::ConfigureIncomingConnection( | 28 bool ViewsExamplesApplicationDelegate::ConfigureIncomingConnection( |
| 36 mojo::ApplicationConnection* connection) { | 29 mojo::ApplicationConnection* connection) { |
| 37 return false; | 30 return false; |
| 38 } | 31 } |
| OLD | NEW |