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

Side by Side Diff: mojo/apps/js/content_handler_impl.cc

Issue 646943006: Remove mojo/apps/js, it is unused (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 1 month 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 | « mojo/apps/js/content_handler_impl.h ('k') | mojo/apps/js/content_handler_main.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "mojo/apps/js/content_handler_impl.h"
6
7 #include "mojo/apps/js/application_delegate_impl.h"
8 #include "mojo/apps/js/js_app.h"
9 #include "mojo/common/data_pipe_utils.h"
10
11 namespace mojo {
12 namespace apps {
13
14 class ContentHandlerJSApp : public JSApp {
15 public:
16 ContentHandlerJSApp(ApplicationDelegateImpl* app_delegate_impl,
17 URLResponsePtr content)
18 : JSApp(app_delegate_impl),
19 content_(content.Pass()) {
20 }
21
22 bool Load(std::string* source, std::string* file_name) override {
23 *file_name = content_->url;
24 if (content_.is_null())
25 return false;
26 return common::BlockingCopyToString(content_->body.Pass(), source);
27 }
28
29 private:
30 URLResponsePtr content_;
31 };
32
33
34 ContentHandlerImpl::ContentHandlerImpl(ApplicationDelegateImpl* app)
35 : app_delegate_impl_(app) {
36 }
37
38 ContentHandlerImpl::~ContentHandlerImpl() {
39 }
40
41 void ContentHandlerImpl::OnConnect(
42 const mojo::String& requestor_url,
43 URLResponsePtr content,
44 InterfaceRequest<ServiceProvider> service_provider) {
45 scoped_ptr<JSApp> js_app(
46 new ContentHandlerJSApp(app_delegate_impl_, content.Pass()));
47 app_delegate_impl_->StartJSApp(js_app.Pass());
48 }
49
50 } // namespace apps
51 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/apps/js/content_handler_impl.h ('k') | mojo/apps/js/content_handler_main.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698