| 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 "base/bind.h" | 5 #include "base/bind.h" |
| 6 #include "base/macros.h" | 6 #include "base/macros.h" |
| 7 #include "mojo/application/application_runner_chromium.h" | 7 #include "mojo/application/application_runner_chromium.h" |
| 8 #include "mojo/common/binding_set.h" | 8 #include "mojo/common/binding_set.h" |
| 9 #include "mojo/public/c/system/main.h" | 9 #include "mojo/public/c/system/main.h" |
| 10 #include "mojo/public/cpp/application/application_delegate.h" | 10 #include "mojo/public/cpp/application/application_delegate.h" |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 base::Unretained(this))); | 56 base::Unretained(this))); |
| 57 } | 57 } |
| 58 | 58 |
| 59 void PostNotification(const char* title, | 59 void PostNotification(const char* title, |
| 60 const char* text, | 60 const char* text, |
| 61 notifications::NotificationPtr* notification) { | 61 notifications::NotificationPtr* notification) { |
| 62 notifications::NotificationClientPtr notification_client; | 62 notifications::NotificationClientPtr notification_client; |
| 63 auto request = mojo::GetProxy(¬ification_client); | 63 auto request = mojo::GetProxy(¬ification_client); |
| 64 client_bindings_.AddBinding(this, request.Pass()); | 64 client_bindings_.AddBinding(this, request.Pass()); |
| 65 notification_service_->Post(CreateNotificationData(title, text).Pass(), | 65 notification_service_->Post(CreateNotificationData(title, text).Pass(), |
| 66 notification_client.Pass(), | 66 notification_client.PassInterfaceHandle(), |
| 67 GetProxy(notification)); | 67 GetProxy(notification)); |
| 68 } | 68 } |
| 69 | 69 |
| 70 void UpdateFirstNotification() { | 70 void UpdateFirstNotification() { |
| 71 first_notification_->Update( | 71 first_notification_->Update( |
| 72 CreateNotificationData("First notification updated", | 72 CreateNotificationData("First notification updated", |
| 73 "Next: both cancelled; repeat").Pass()); | 73 "Next: both cancelled; repeat").Pass()); |
| 74 PostDelayed( | 74 PostDelayed( |
| 75 base::Bind(&NotificationGeneratorDelegate::CancelSecondNotification, | 75 base::Bind(&NotificationGeneratorDelegate::CancelSecondNotification, |
| 76 base::Unretained(this))); | 76 base::Unretained(this))); |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 DISALLOW_COPY_AND_ASSIGN(NotificationGeneratorDelegate); | 115 DISALLOW_COPY_AND_ASSIGN(NotificationGeneratorDelegate); |
| 116 }; | 116 }; |
| 117 | 117 |
| 118 } // namespace examples | 118 } // namespace examples |
| 119 | 119 |
| 120 MojoResult MojoMain(MojoHandle application_request) { | 120 MojoResult MojoMain(MojoHandle application_request) { |
| 121 mojo::ApplicationRunnerChromium runner( | 121 mojo::ApplicationRunnerChromium runner( |
| 122 new examples::NotificationGeneratorDelegate); | 122 new examples::NotificationGeneratorDelegate); |
| 123 return runner.Run(application_request); | 123 return runner.Run(application_request); |
| 124 } | 124 } |
| OLD | NEW |