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

Side by Side Diff: mash/wallpaper/wallpaper.cc

Issue 1675083002: Rename ApplicationDelegate to ShellClient (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@delegate
Patch Set: . Created 4 years, 10 months 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 unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "base/macros.h" 5 #include "base/macros.h"
6 #include "components/filesystem/public/cpp/prefs/pref_service_factory.h" 6 #include "components/filesystem/public/cpp/prefs/pref_service_factory.h"
7 #include "components/mus/public/cpp/property_type_converters.h" 7 #include "components/mus/public/cpp/property_type_converters.h"
8 #include "components/prefs/pref_registry_simple.h" 8 #include "components/prefs/pref_registry_simple.h"
9 #include "mash/wm/public/interfaces/container.mojom.h" 9 #include "mash/wm/public/interfaces/container.mojom.h"
10 #include "mojo/public/c/system/main.h" 10 #include "mojo/public/c/system/main.h"
11 #include "mojo/services/tracing/public/cpp/tracing_impl.h" 11 #include "mojo/services/tracing/public/cpp/tracing_impl.h"
12 #include "mojo/shell/public/cpp/application_connection.h"
13 #include "mojo/shell/public/cpp/application_delegate.h"
14 #include "mojo/shell/public/cpp/application_runner.h" 12 #include "mojo/shell/public/cpp/application_runner.h"
15 #include "mojo/shell/public/cpp/shell.h" 13 #include "mojo/shell/public/cpp/shell.h"
14 #include "mojo/shell/public/cpp/shell_client.h"
16 #include "ui/gfx/canvas.h" 15 #include "ui/gfx/canvas.h"
17 #include "ui/views/mus/aura_init.h" 16 #include "ui/views/mus/aura_init.h"
18 #include "ui/views/mus/native_widget_mus.h" 17 #include "ui/views/mus/native_widget_mus.h"
19 #include "ui/views/mus/window_manager_connection.h" 18 #include "ui/views/mus/window_manager_connection.h"
20 #include "ui/views/widget/widget_delegate.h" 19 #include "ui/views/widget/widget_delegate.h"
21 20
22 namespace mash { 21 namespace mash {
23 namespace wallpaper { 22 namespace wallpaper {
24 namespace { 23 namespace {
25 24
26 class Wallpaper : public views::WidgetDelegateView { 25 class Wallpaper : public views::WidgetDelegateView {
27 public: 26 public:
28 Wallpaper() {} 27 Wallpaper() {}
29 ~Wallpaper() override {} 28 ~Wallpaper() override {}
30 29
31 // Overridden from views::View: 30 // Overridden from views::View:
32 void OnPaint(gfx::Canvas* canvas) override { 31 void OnPaint(gfx::Canvas* canvas) override {
33 canvas->FillRect(GetLocalBounds(), SK_ColorRED); 32 canvas->FillRect(GetLocalBounds(), SK_ColorRED);
34 } 33 }
35 34
36 // Overridden from views::WidgetDelegate: 35 // Overridden from views::WidgetDelegate:
37 views::View* GetContentsView() override { return this; } 36 views::View* GetContentsView() override { return this; }
38 37
39 DISALLOW_COPY_AND_ASSIGN(Wallpaper); 38 DISALLOW_COPY_AND_ASSIGN(Wallpaper);
40 }; 39 };
41 40
42 class WallpaperApplicationDelegate : public mojo::ApplicationDelegate { 41 class WallpaperApplicationDelegate : public mojo::ShellClient {
43 public: 42 public:
44 WallpaperApplicationDelegate() {} 43 WallpaperApplicationDelegate() {}
45 ~WallpaperApplicationDelegate() override {} 44 ~WallpaperApplicationDelegate() override {}
46 45
47 void OnLoaded(bool whatever) { 46 void OnLoaded(bool whatever) {
48 // TODO(erg): Now do something with this result. 47 // TODO(erg): Now do something with this result.
49 } 48 }
50 49
51 private: 50 private:
52 // mojo::ApplicationDelegate: 51 // mojo::ShellClient:
53 void Initialize(mojo::Shell* shell, const std::string& url, 52 void Initialize(mojo::Shell* shell, const std::string& url,
54 uint32_t id) override { 53 uint32_t id) override {
55 tracing_.Initialize(shell, url); 54 tracing_.Initialize(shell, url);
56 55
57 aura_init_.reset(new views::AuraInit(shell, "views_mus_resources.pak")); 56 aura_init_.reset(new views::AuraInit(shell, "views_mus_resources.pak"));
58 views::WindowManagerConnection::Create(shell); 57 views::WindowManagerConnection::Create(shell);
59 58
60 scoped_refptr<PrefRegistrySimple> registry = new PrefRegistrySimple; 59 scoped_refptr<PrefRegistrySimple> registry = new PrefRegistrySimple;
61 registry->RegisterStringPref("filename", "", 0); 60 registry->RegisterStringPref("filename", "", 0);
62 pref_service_ = filesystem::CreatePrefService(shell, registry.get()); 61 pref_service_ = filesystem::CreatePrefService(shell, registry.get());
(...skipping 26 matching lines...) Expand all
89 88
90 } // namespace 89 } // namespace
91 } // namespace wallpaper 90 } // namespace wallpaper
92 } // namespace mash 91 } // namespace mash
93 92
94 MojoResult MojoMain(MojoHandle shell_handle) { 93 MojoResult MojoMain(MojoHandle shell_handle) {
95 mojo::ApplicationRunner runner( 94 mojo::ApplicationRunner runner(
96 new mash::wallpaper::WallpaperApplicationDelegate); 95 new mash::wallpaper::WallpaperApplicationDelegate);
97 return runner.Run(shell_handle); 96 return runner.Run(shell_handle);
98 } 97 }
OLDNEW
« no previous file with comments | « mash/task_viewer/task_viewer_application_delegate.cc ('k') | mash/wm/window_manager_application.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698