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

Side by Side Diff: services/js/content_handler_main.cc

Issue 780213002: Put code in //services/js in namespace js (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 | « no previous file | services/js/echo_apptest.cc » ('j') | services/js/js_app_runner_delegate.cc » ('J')
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 "base/i18n/icu_util.h" 5 #include "base/i18n/icu_util.h"
6 #include "gin/array_buffer.h" 6 #include "gin/array_buffer.h"
7 #include "gin/public/isolate_holder.h" 7 #include "gin/public/isolate_holder.h"
8 #include "mojo/application/application_runner_chromium.h" 8 #include "mojo/application/application_runner_chromium.h"
9 #include "mojo/application/content_handler_factory.h" 9 #include "mojo/application/content_handler_factory.h"
10 #include "mojo/public/c/system/main.h" 10 #include "mojo/public/c/system/main.h"
11 #include "mojo/public/cpp/application/application_delegate.h" 11 #include "mojo/public/cpp/application/application_delegate.h"
12 #include "mojo/public/cpp/application/application_impl.h" 12 #include "mojo/public/cpp/application/application_impl.h"
13 #include "services/js/js_app.h" 13 #include "services/js/js_app.h"
14 14
15 namespace mojo {
16 namespace js { 15 namespace js {
17 16
18 class JsContentHandler : public ApplicationDelegate, 17 class JsContentHandler : public mojo::ApplicationDelegate,
19 public ContentHandlerFactory::ManagedDelegate { 18 public mojo::ContentHandlerFactory::ManagedDelegate {
20 public: 19 public:
21 JsContentHandler() : content_handler_factory_(this) {} 20 JsContentHandler() : content_handler_factory_(this) {}
22 21
23 private: 22 private:
24 // Overridden from ApplicationDelegate: 23 // Overridden from mojo::ApplicationDelegate:
25 void Initialize(ApplicationImpl* app) override { 24 void Initialize(mojo::ApplicationImpl* app) override {
26 static const char v8Flags[] = "--harmony-classes"; 25 static const char v8Flags[] = "--harmony-classes";
27 v8::V8::SetFlagsFromString(v8Flags, sizeof(v8Flags) - 1); 26 v8::V8::SetFlagsFromString(v8Flags, sizeof(v8Flags) - 1);
28 base::i18n::InitializeICU(); 27 base::i18n::InitializeICU();
29 gin::IsolateHolder::Initialize(gin::IsolateHolder::kStrictMode, 28 gin::IsolateHolder::Initialize(gin::IsolateHolder::kStrictMode,
30 gin::ArrayBufferAllocator::SharedInstance()); 29 gin::ArrayBufferAllocator::SharedInstance());
31 } 30 }
32 31
33 // Overridden from ApplicationDelegate: 32 // Overridden from ApplicationDelegate:
34 bool ConfigureIncomingConnection(ApplicationConnection* connection) override { 33 bool ConfigureIncomingConnection(
34 mojo::ApplicationConnection* connection) override {
35 connection->AddService(&content_handler_factory_); 35 connection->AddService(&content_handler_factory_);
36 return true; 36 return true;
37 } 37 }
38 38
39 // Overridden from ContentHandlerFactory::ManagedDelegate: 39 // Overridden from ContentHandlerFactory::ManagedDelegate:
40 scoped_ptr<ContentHandlerFactory::HandledApplicationHolder> CreateApplication( 40 scoped_ptr<mojo::ContentHandlerFactory::HandledApplicationHolder>
41 ShellPtr shell, 41 CreateApplication(mojo::ShellPtr shell,
42 URLResponsePtr response) override { 42 mojo::URLResponsePtr response) override {
43 return make_scoped_ptr(new JSApp(shell.Pass(), response.Pass())); 43 return make_scoped_ptr(new JSApp(shell.Pass(), response.Pass()));
44 } 44 }
45 45
46 ContentHandlerFactory content_handler_factory_; 46 mojo::ContentHandlerFactory content_handler_factory_;
47 47
48 DISALLOW_COPY_AND_ASSIGN(JsContentHandler); 48 DISALLOW_COPY_AND_ASSIGN(JsContentHandler);
49 }; 49 };
50 50
51 } // namespace js 51 } // namespace js
52 } // namespace mojo
53 52
54 MojoResult MojoMain(MojoHandle shell_handle) { 53 MojoResult MojoMain(MojoHandle shell_handle) {
55 mojo::ApplicationRunnerChromium runner(new mojo::js::JsContentHandler); 54 mojo::ApplicationRunnerChromium runner(new js::JsContentHandler);
56 return runner.Run(shell_handle); 55 return runner.Run(shell_handle);
57 } 56 }
OLDNEW
« no previous file with comments | « no previous file | services/js/echo_apptest.cc » ('j') | services/js/js_app_runner_delegate.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698