OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 <stdio.h> | 5 #include <stdio.h> |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 | 8 |
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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 | 70 |
71 printf("\n>>> EOF <<<\n"); | 71 printf("\n>>> EOF <<<\n"); |
72 } | 72 } |
73 }; | 73 }; |
74 | 74 |
75 } // namespace | 75 } // namespace |
76 | 76 |
77 class WGetApp : public ApplicationDelegate { | 77 class WGetApp : public ApplicationDelegate { |
78 public: | 78 public: |
79 void Initialize(ApplicationImpl* app) override { | 79 void Initialize(ApplicationImpl* app) override { |
80 app->ConnectToService("mojo:network_service", &network_service_); | 80 app->ConnectToServiceDeprecated("mojo:network_service", &network_service_); |
81 Start(app->args()); | 81 Start(app->args()); |
82 } | 82 } |
83 | 83 |
84 private: | 84 private: |
85 void Start(const std::vector<std::string>& args) { | 85 void Start(const std::vector<std::string>& args) { |
86 std::string url((args.size() > 1) ? args[1] : PromptForURL()); | 86 std::string url((args.size() > 1) ? args[1] : PromptForURL()); |
87 printf("Loading: %s\n", url.c_str()); | 87 printf("Loading: %s\n", url.c_str()); |
88 | 88 |
89 network_service_->CreateURLLoader(GetProxy(&url_loader_)); | 89 network_service_->CreateURLLoader(GetProxy(&url_loader_)); |
90 | 90 |
(...skipping 18 matching lines...) Expand all Loading... |
109 }; | 109 }; |
110 | 110 |
111 } // namespace examples | 111 } // namespace examples |
112 } // namespace mojo | 112 } // namespace mojo |
113 | 113 |
114 MojoResult MojoMain(MojoHandle application_request) { | 114 MojoResult MojoMain(MojoHandle application_request) { |
115 mojo::ApplicationRunner runner( | 115 mojo::ApplicationRunner runner( |
116 std::unique_ptr<mojo::examples::WGetApp>(new mojo::examples::WGetApp())); | 116 std::unique_ptr<mojo::examples::WGetApp>(new mojo::examples::WGetApp())); |
117 return runner.Run(application_request); | 117 return runner.Run(application_request); |
118 } | 118 } |
OLD | NEW |