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

Side by Side Diff: examples/authentication_demo/google_authentication_demo.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/audio_play_test/play_wav.cc ('k') | examples/bank_app/bank.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 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/bind.h" 5 #include "base/bind.h"
6 #include "base/logging.h" 6 #include "base/logging.h"
7 #include "mojo/public/c/system/main.h" 7 #include "mojo/public/c/system/main.h"
8 #include "mojo/public/cpp/application/application_connection.h" 8 #include "mojo/public/cpp/application/application_connection.h"
9 #include "mojo/public/cpp/application/application_delegate.h" 9 #include "mojo/public/cpp/application/application_delegate.h"
10 #include "mojo/public/cpp/application/application_impl.h" 10 #include "mojo/public/cpp/application/application_impl.h"
11 #include "mojo/public/cpp/application/application_runner.h" 11 #include "mojo/public/cpp/application/application_runner.h"
12 #include "mojo/public/cpp/utility/run_loop.h" 12 #include "mojo/public/cpp/utility/run_loop.h"
13 #include "mojo/services/authentication/interfaces/authentication.mojom.h" 13 #include "mojo/services/authentication/interfaces/authentication.mojom.h"
14 14
15 namespace examples { 15 namespace examples {
16 namespace authentication { 16 namespace authentication {
17 17
18 class GoogleAuthApp : public mojo::ApplicationDelegate { 18 class GoogleAuthApp : public mojo::ApplicationDelegate {
19 public: 19 public:
20 GoogleAuthApp() {} 20 GoogleAuthApp() {}
21 21
22 ~GoogleAuthApp() override {} 22 ~GoogleAuthApp() override {}
23 23
24 void Initialize(mojo::ApplicationImpl* app) override { 24 void Initialize(mojo::ApplicationImpl* app) override {
25 DLOG(INFO) << "Connecting to authentication service..."; 25 DLOG(INFO) << "Connecting to authentication service...";
26 app->ConnectToService("mojo:authentication", &authentication_service_); 26 app->ConnectToServiceDeprecated("mojo:authentication",
27 &authentication_service_);
27 28
28 mojo::Array<mojo::String> scopes; 29 mojo::Array<mojo::String> scopes;
29 scopes.push_back("profile"); 30 scopes.push_back("profile");
30 scopes.push_back("email"); 31 scopes.push_back("email");
31 32
32 DLOG(INFO) << "Starting the device flow handshake..."; 33 DLOG(INFO) << "Starting the device flow handshake...";
33 authentication_service_->GetOAuth2DeviceCode( 34 authentication_service_->GetOAuth2DeviceCode(
34 scopes.Pass(), 35 scopes.Pass(),
35 base::Bind(&GoogleAuthApp::OnDeviceCode, base::Unretained(this))); 36 base::Bind(&GoogleAuthApp::OnDeviceCode, base::Unretained(this)));
36 } 37 }
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 126
126 } // namespace authentication 127 } // namespace authentication
127 } // namespace examples 128 } // namespace examples
128 129
129 MojoResult MojoMain(MojoHandle application_request) { 130 MojoResult MojoMain(MojoHandle application_request) {
130 mojo::ApplicationRunner runner( 131 mojo::ApplicationRunner runner(
131 std::unique_ptr<examples::authentication::GoogleAuthApp>( 132 std::unique_ptr<examples::authentication::GoogleAuthApp>(
132 new examples::authentication::GoogleAuthApp())); 133 new examples::authentication::GoogleAuthApp()));
133 return runner.Run(application_request); 134 return runner.Run(application_request);
134 } 135 }
OLDNEW
« no previous file with comments | « examples/audio_play_test/play_wav.cc ('k') | examples/bank_app/bank.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698