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

Side by Side Diff: services/java_handler/java_handler.cc

Issue 1993053002: Simplify ContentHandlerFactory a bit. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 4 years, 7 months 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 | « services/java_handler/java_handler.h ('k') | services/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
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 "services/java_handler/java_handler.h" 5 #include "services/java_handler/java_handler.h"
6 6
7 #include "base/android/base_jni_onload.h" 7 #include "base/android/base_jni_onload.h"
8 #include "base/android/base_jni_registrar.h" 8 #include "base/android/base_jni_registrar.h"
9 #include "base/android/jni_android.h" 9 #include "base/android/jni_android.h"
10 #include "base/android/jni_string.h" 10 #include "base/android/jni_string.h"
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 return false; 46 return false;
47 47
48 return true; 48 return true;
49 } 49 }
50 50
51 } // namespace 51 } // namespace
52 52
53 namespace services { 53 namespace services {
54 namespace android { 54 namespace android {
55 55
56 JavaHandler::JavaHandler() : content_handler_factory_(this) {} 56 JavaHandler::JavaHandler() {}
57 57
58 JavaHandler::~JavaHandler() {} 58 JavaHandler::~JavaHandler() {}
59 59
60 void JavaHandler::RunApplication( 60 void JavaHandler::RunApplication(
61 mojo::InterfaceRequest<mojo::Application> application_request, 61 mojo::InterfaceRequest<mojo::Application> application_request,
62 mojo::URLResponsePtr response) { 62 mojo::URLResponsePtr response) {
63 TRACE_EVENT_BEGIN1("java_handler", "JavaHandler::RunApplication", "url", 63 TRACE_EVENT_BEGIN1("java_handler", "JavaHandler::RunApplication", "url",
64 std::string(response->url)); 64 std::string(response->url));
65 JNIEnv* env = base::android::AttachCurrentThread(); 65 JNIEnv* env = base::android::AttachCurrentThread();
66 base::FilePath archive_path; 66 base::FilePath archive_path;
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 *cache_dir = base::FilePath(std::string( 114 *cache_dir = base::FilePath(std::string(
115 reinterpret_cast<char*>(&cache_path.front()), cache_path.size())); 115 reinterpret_cast<char*>(&cache_path.front()), cache_path.size()));
116 } 116 }
117 callback.Run(); 117 callback.Run();
118 }); 118 });
119 } 119 }
120 120
121 bool JavaHandler::ConfigureIncomingConnection( 121 bool JavaHandler::ConfigureIncomingConnection(
122 mojo::ServiceProviderImpl* service_provider_impl) { 122 mojo::ServiceProviderImpl* service_provider_impl) {
123 service_provider_impl->AddService<mojo::ContentHandler>( 123 service_provider_impl->AddService<mojo::ContentHandler>(
124 content_handler_factory_.GetInterfaceRequestHandler()); 124 mojo::ContentHandlerFactory::GetInterfaceRequestHandler(this));
125 return true; 125 return true;
126 } 126 }
127 127
128 void PreInvokeEvent(JNIEnv* env, jclass jcaller) { 128 void PreInvokeEvent(JNIEnv* env, jclass jcaller) {
129 TRACE_EVENT_END0("java_handler", "JavaHandler::RunApplication"); 129 TRACE_EVENT_END0("java_handler", "JavaHandler::RunApplication");
130 } 130 }
131 131
132 } // namespace android 132 } // namespace android
133 } // namespace services 133 } // namespace services
134 134
(...skipping 18 matching lines...) Expand all
153 return JNI_VERSION_1_4; 153 return JNI_VERSION_1_4;
154 } 154 }
155 155
156 // This is needed because the application needs to access the application 156 // This is needed because the application needs to access the application
157 // context. 157 // context.
158 extern "C" JNI_EXPORT void InitApplicationContext( 158 extern "C" JNI_EXPORT void InitApplicationContext(
159 const base::android::JavaRef<jobject>& context) { 159 const base::android::JavaRef<jobject>& context) {
160 JNIEnv* env = base::android::AttachCurrentThread(); 160 JNIEnv* env = base::android::AttachCurrentThread();
161 base::android::InitApplicationContext(env, context); 161 base::android::InitApplicationContext(env, context);
162 } 162 }
OLDNEW
« no previous file with comments | « services/java_handler/java_handler.h ('k') | services/js/content_handler_main.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698