Index: services/authentication/main.cc |
diff --git a/services/authentication/dummy_authentication_app.cc b/services/authentication/main.cc |
similarity index 50% |
copy from services/authentication/dummy_authentication_app.cc |
copy to services/authentication/main.cc |
index a829b74e936c1cba0f7543b8e5fe3142d9905917..ba819ab1f8b51eb4aef4b41cad921ea0f94595b9 100644 |
--- a/services/authentication/dummy_authentication_app.cc |
+++ b/services/authentication/main.cc |
@@ -2,64 +2,57 @@ |
// Use of this source code is governed by a BSD-style license that can be |
// found in the LICENSE file. |
-#include <memory> |
- |
#include "mojo/common/binding_set.h" |
#include "mojo/public/c/system/main.h" |
#include "mojo/public/cpp/application/application_connection.h" |
#include "mojo/public/cpp/application/application_delegate.h" |
+#include "mojo/public/cpp/application/application_impl.h" |
#include "mojo/public/cpp/application/application_runner.h" |
#include "mojo/public/cpp/application/interface_factory.h" |
+#include "mojo/public/cpp/bindings/strong_binding.h" |
#include "mojo/public/cpp/system/macros.h" |
#include "mojo/services/authentication/interfaces/authentication.mojom.h" |
+#include "mojo/services/network/interfaces/network_service.mojom.h" |
+#include "services/authentication/google_authentication_impl.h" |
namespace authentication { |
-namespace { |
-class DummyAuthenticationApplication |
+class GoogleAccountManagerApp |
: public mojo::ApplicationDelegate, |
- public mojo::InterfaceFactory<AuthenticationService>, |
- public AuthenticationService { |
+ public mojo::InterfaceFactory<AuthenticationService> { |
public: |
- DummyAuthenticationApplication() {} |
- ~DummyAuthenticationApplication() override {} |
+ GoogleAccountManagerApp() {} |
+ ~GoogleAccountManagerApp() override {} |
+ |
+ void Initialize(mojo::ApplicationImpl* app) override { |
+ app->ConnectToService("mojo:network_service", &network_service_); |
+ app->ConnectToService("mojo:files", &files_); |
+ } |
- private: |
- // ApplicationDelegate implementation. |
- void Initialize(mojo::ApplicationImpl* app) override{}; |
bool ConfigureIncomingConnection( |
mojo::ApplicationConnection* connection) override { |
connection->AddService<AuthenticationService>(this); |
return true; |
} |
- // InterfaceFactory<AuthenticationService> implementation. |
void Create(mojo::ApplicationConnection* connection, |
mojo::InterfaceRequest<AuthenticationService> request) override { |
- bindings_.AddBinding(this, request.Pass()); |
+ new authentication::GoogleAuthenticationServiceImpl( |
+ request.Pass(), network_service_, files_); |
} |
- // AuthenticationService implementation |
- void SelectAccount(bool return_last_selected, |
- const SelectAccountCallback& callback) override { |
- callback.Run(nullptr, "Not implemented"); |
- } |
- void GetOAuth2Token(const mojo::String& username, |
- mojo::Array<mojo::String> scopes, |
- const GetOAuth2TokenCallback& callback) override { |
- callback.Run(nullptr, "Not implemented"); |
- } |
- void ClearOAuth2Token(const mojo::String& token) override {} |
+ private: |
+ mojo::NetworkServicePtr network_service_; |
+ mojo::files::FilesPtr files_; |
- mojo::BindingSet<AuthenticationService> bindings_; |
+ DISALLOW_COPY_AND_ASSIGN(GoogleAccountManagerApp); |
}; |
-} // namespace |
} // namespace authentication |
MojoResult MojoMain(MojoHandle application_request) { |
mojo::ApplicationRunner runner( |
- std::unique_ptr<authentication::DummyAuthenticationApplication>( |
- new authentication::DummyAuthenticationApplication())); |
+ std::unique_ptr<authentication::GoogleAccountManagerApp>( |
+ new authentication::GoogleAccountManagerApp())); |
return runner.Run(application_request); |
} |