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

Side by Side Diff: sky/viewer/content_handler_impl.cc

Issue 752683002: Break Sky's dependency on cc (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years 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 | « sky/viewer/content_handler_impl.h ('k') | sky/viewer/document_view.h » ('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 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 "sky/viewer/content_handler_impl.h" 5 #include "sky/viewer/content_handler_impl.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "mojo/public/cpp/application/connect.h" 8 #include "mojo/public/cpp/application/connect.h"
9 #include "mojo/services/public/interfaces/network/network_service.mojom.h" 9 #include "mojo/services/public/interfaces/network/network_service.mojom.h"
10 #include "sky/viewer/document_view.h" 10 #include "sky/viewer/document_view.h"
11 11
12 namespace sky { 12 namespace sky {
13 13
14 class SkyApplication : public mojo::Application { 14 class SkyApplication : public mojo::Application {
15 public: 15 public:
16 SkyApplication(scoped_refptr<base::MessageLoopProxy> compositor_thread, 16 SkyApplication(mojo::ShellPtr shell,
17 mojo::ShellPtr shell,
18 mojo::URLResponsePtr response) 17 mojo::URLResponsePtr response)
19 : compositor_thread_(compositor_thread), 18 : url_(response->url),
20 url_(response->url),
21 shell_(shell.Pass()), 19 shell_(shell.Pass()),
22 initial_response_(response.Pass()), 20 initial_response_(response.Pass()),
23 view_count_(0) { 21 view_count_(0) {
24 shell_.set_client(this); 22 shell_.set_client(this);
25 mojo::ServiceProviderPtr service_provider; 23 mojo::ServiceProviderPtr service_provider;
26 shell_->ConnectToApplication("mojo:network_service", 24 shell_->ConnectToApplication("mojo:network_service",
27 mojo::GetProxy(&service_provider)); 25 mojo::GetProxy(&service_provider));
28 mojo::ConnectToService(service_provider.get(), &network_service_); 26 mojo::ConnectToService(service_provider.get(), &network_service_);
29 } 27 }
30 28
(...skipping 30 matching lines...) Expand all
61 if (view_count_ == 0) { 59 if (view_count_ == 0) {
62 delete this; 60 delete this;
63 } 61 }
64 } 62 }
65 63
66 void OnResponseReceived(mojo::URLLoaderPtr loader, 64 void OnResponseReceived(mojo::URLLoaderPtr loader,
67 mojo::ServiceProviderPtr provider, 65 mojo::ServiceProviderPtr provider,
68 mojo::URLResponsePtr response) { 66 mojo::URLResponsePtr response) {
69 new DocumentView( 67 new DocumentView(
70 base::Bind(&SkyApplication::OnViewDestroyed, base::Unretained(this)), 68 base::Bind(&SkyApplication::OnViewDestroyed, base::Unretained(this)),
71 provider.Pass(), response.Pass(), shell_.get(), compositor_thread_); 69 provider.Pass(), response.Pass(), shell_.get());
72 } 70 }
73 71
74 scoped_refptr<base::MessageLoopProxy> compositor_thread_;
75 mojo::String url_; 72 mojo::String url_;
76 mojo::ShellPtr shell_; 73 mojo::ShellPtr shell_;
77 mojo::NetworkServicePtr network_service_; 74 mojo::NetworkServicePtr network_service_;
78 mojo::URLResponsePtr initial_response_; 75 mojo::URLResponsePtr initial_response_;
79 uint32_t view_count_; 76 uint32_t view_count_;
80 }; 77 };
81 78
82 ContentHandlerImpl::ContentHandlerImpl( 79 ContentHandlerImpl::ContentHandlerImpl() {
83 scoped_refptr<base::MessageLoopProxy> compositor_thread)
84 : compositor_thread_(compositor_thread) {
85 } 80 }
86 81
87 ContentHandlerImpl::~ContentHandlerImpl() { 82 ContentHandlerImpl::~ContentHandlerImpl() {
88 } 83 }
89 84
90 void ContentHandlerImpl::StartApplication(mojo::ShellPtr shell, 85 void ContentHandlerImpl::StartApplication(mojo::ShellPtr shell,
91 mojo::URLResponsePtr response) { 86 mojo::URLResponsePtr response) {
92 new SkyApplication(compositor_thread_, shell.Pass(), response.Pass()); 87 new SkyApplication(shell.Pass(), response.Pass());
93 } 88 }
94 89
95 } // namespace sky 90 } // namespace sky
OLDNEW
« no previous file with comments | « sky/viewer/content_handler_impl.h ('k') | sky/viewer/document_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698