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

Side by Side Diff: examples/notification_generator/notification_generator.cc

Issue 1916233002: Mark ApplicationImpl::ConnectTo{Application,Service}() as deprecated. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 4 years, 7 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
« no previous file with comments | « examples/native_run_app/native_run_app.cc ('k') | examples/spinning_cube/spinning_cube_app.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <utility> 5 #include <utility>
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "mojo/application/application_runner_chromium.h" 9 #include "mojo/application/application_runner_chromium.h"
10 #include "mojo/common/binding_set.h" 10 #include "mojo/common/binding_set.h"
11 #include "mojo/public/c/system/main.h" 11 #include "mojo/public/c/system/main.h"
12 #include "mojo/public/cpp/application/application_delegate.h" 12 #include "mojo/public/cpp/application/application_delegate.h"
13 #include "mojo/public/cpp/application/application_impl.h" 13 #include "mojo/public/cpp/application/application_impl.h"
14 #include "mojo/services/notifications/interfaces/notifications.mojom.h" 14 #include "mojo/services/notifications/interfaces/notifications.mojom.h"
15 15
16 namespace examples { 16 namespace examples {
17 17
18 static const base::TimeDelta kDefaultMessageDelay = 18 static const base::TimeDelta kDefaultMessageDelay =
19 base::TimeDelta::FromMilliseconds(3000); 19 base::TimeDelta::FromMilliseconds(3000);
20 20
21 class NotificationGeneratorDelegate : public mojo::ApplicationDelegate, 21 class NotificationGeneratorDelegate : public mojo::ApplicationDelegate,
22 public notifications::NotificationClient { 22 public notifications::NotificationClient {
23 public: 23 public:
24 NotificationGeneratorDelegate() {} 24 NotificationGeneratorDelegate() {}
25 25
26 ~NotificationGeneratorDelegate() override {} 26 ~NotificationGeneratorDelegate() override {}
27 27
28 // mojo::ApplicationDelegate implementation. 28 // mojo::ApplicationDelegate implementation.
29 void Initialize(mojo::ApplicationImpl* app) override { 29 void Initialize(mojo::ApplicationImpl* app) override {
30 app->ConnectToService("mojo:notifications", &notification_service_); 30 app->ConnectToServiceDeprecated("mojo:notifications",
31 &notification_service_);
31 PostFirstNotification(); 32 PostFirstNotification();
32 } 33 }
33 34
34 // notifications::NotificationClient implementation. 35 // notifications::NotificationClient implementation.
35 void OnSelected() override { 36 void OnSelected() override {
36 PostNotification("You selected a notification!", 37 PostNotification("You selected a notification!",
37 "Have you dismissed one yet?", &select_notification_); 38 "Have you dismissed one yet?", &select_notification_);
38 } 39 }
39 40
40 void OnDismissed() override { 41 void OnDismissed() override {
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 DISALLOW_COPY_AND_ASSIGN(NotificationGeneratorDelegate); 119 DISALLOW_COPY_AND_ASSIGN(NotificationGeneratorDelegate);
119 }; 120 };
120 121
121 } // namespace examples 122 } // namespace examples
122 123
123 MojoResult MojoMain(MojoHandle application_request) { 124 MojoResult MojoMain(MojoHandle application_request) {
124 mojo::ApplicationRunnerChromium runner( 125 mojo::ApplicationRunnerChromium runner(
125 new examples::NotificationGeneratorDelegate); 126 new examples::NotificationGeneratorDelegate);
126 return runner.Run(application_request); 127 return runner.Run(application_request);
127 } 128 }
OLDNEW
« no previous file with comments | « examples/native_run_app/native_run_app.cc ('k') | examples/spinning_cube/spinning_cube_app.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698