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

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

Issue 1641513004: Update //base to chromium 9659b08ea5a34f889dc4166217f438095ddc10d2 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 4 years, 10 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
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/bind.h" 5 #include "base/bind.h"
6 #include "base/message_loop/message_loop.h" 6 #include "base/message_loop/message_loop.h"
7 #include "base/run_loop.h" 7 #include "base/run_loop.h"
8 #include "base/strings/string_util.h" 8 #include "base/strings/string_split.h"
9 #include "base/synchronization/waitable_event.h" 9 #include "base/synchronization/waitable_event.h"
10 #include "base/threading/platform_thread.h" 10 #include "base/threading/platform_thread.h"
11 #include "base/trace_event/trace_event.h" 11 #include "base/trace_event/trace_event.h"
12 #include "mojo/application/application_runner_chromium.h" 12 #include "mojo/application/application_runner_chromium.h"
13 #include "mojo/application/content_handler_factory.h" 13 #include "mojo/application/content_handler_factory.h"
14 #include "mojo/common/tracing_impl.h" 14 #include "mojo/common/tracing_impl.h"
15 #include "mojo/dart/embedder/dart_controller.h" 15 #include "mojo/dart/embedder/dart_controller.h"
16 #include "mojo/public/c/system/main.h" 16 #include "mojo/public/c/system/main.h"
17 #include "mojo/public/cpp/application/application_delegate.h" 17 #include "mojo/public/cpp/application/application_delegate.h"
18 #include "mojo/public/cpp/application/application_impl.h" 18 #include "mojo/public/cpp/application/application_impl.h"
(...skipping 10 matching lines...) Expand all
29 29
30 const char kCompleteTimeline[] = "--complete-timeline"; 30 const char kCompleteTimeline[] = "--complete-timeline";
31 const char kEnableStrictMode[] = "--enable-strict-mode"; 31 const char kEnableStrictMode[] = "--enable-strict-mode";
32 const char kDisableObservatory[] = "--disable-observatory"; 32 const char kDisableObservatory[] = "--disable-observatory";
33 const char kTraceStartup[] = "--trace-startup"; 33 const char kTraceStartup[] = "--trace-startup";
34 const char kRunOnMessageLoop[] = "--run-on-message-loop"; 34 const char kRunOnMessageLoop[] = "--run-on-message-loop";
35 35
36 static bool IsDartZip(std::string url) { 36 static bool IsDartZip(std::string url) {
37 // If the url doesn't end with ".dart" we assume it is a zipped up 37 // If the url doesn't end with ".dart" we assume it is a zipped up
38 // dart application. 38 // dart application.
39 return !EndsWith(url, ".dart", false); 39 return !base::EndsWith(url, ".dart", base::CompareCase::INSENSITIVE_ASCII);
40 } 40 }
41 41
42 class DartContentHandlerApp; 42 class DartContentHandlerApp;
43 43
44 class DartContentHandler : public mojo::ContentHandlerFactory::ManagedDelegate { 44 class DartContentHandler : public mojo::ContentHandlerFactory::ManagedDelegate {
45 public: 45 public:
46 DartContentHandler(DartContentHandlerApp* app, bool strict) 46 DartContentHandler(DartContentHandlerApp* app, bool strict)
47 : app_(app), strict_(strict) { 47 : app_(app), strict_(strict) {
48 } 48 }
49 49
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 } 151 }
152 if (!success) { 152 if (!success) {
153 LOG(ERROR) << "Dart VM Initialization failed"; 153 LOG(ERROR) << "Dart VM Initialization failed";
154 } 154 }
155 } 155 }
156 156
157 bool HasStrictQueryParam(const std::string& requestedUrl) { 157 bool HasStrictQueryParam(const std::string& requestedUrl) {
158 bool strict_compilation = false; 158 bool strict_compilation = false;
159 GURL url(requestedUrl); 159 GURL url(requestedUrl);
160 if (url.has_query()) { 160 if (url.has_query()) {
161 std::vector<std::string> query_parameters; 161 std::vector<std::string> query_parameters = base::SplitString(
162 Tokenize(url.query(), "&", &query_parameters); 162 url.query(), "&", base::KEEP_WHITESPACE, base::SPLIT_WANT_NONEMPTY);
163 strict_compilation = 163 strict_compilation =
164 std::find(query_parameters.begin(), query_parameters.end(), 164 std::find(query_parameters.begin(), query_parameters.end(),
165 "strict=true") != query_parameters.end(); 165 "strict=true") != query_parameters.end();
166 } 166 }
167 return strict_compilation; 167 return strict_compilation;
168 } 168 }
169 169
170 // Overridden from ApplicationDelegate: 170 // Overridden from ApplicationDelegate:
171 bool ConfigureIncomingConnection( 171 bool ConfigureIncomingConnection(
172 mojo::ApplicationConnection* connection) override { 172 mojo::ApplicationConnection* connection) override {
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
242 run_on_message_loop)); 242 run_on_message_loop));
243 } 243 }
244 } 244 }
245 245
246 } // namespace dart 246 } // namespace dart
247 247
248 MojoResult MojoMain(MojoHandle application_request) { 248 MojoResult MojoMain(MojoHandle application_request) {
249 mojo::ApplicationRunnerChromium runner(new dart::DartContentHandlerApp); 249 mojo::ApplicationRunnerChromium runner(new dart::DartContentHandlerApp);
250 return runner.Run(application_request); 250 return runner.Run(application_request);
251 } 251 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698