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

Side by Side Diff: mojo/shell/context.cc

Issue 514063003: Update view_manager and window_manager to make use of content handling. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@viewman2
Patch Set: git cl format Created 6 years, 3 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "mojo/shell/context.h" 5 #include "mojo/shell/context.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/lazy_instance.h" 10 #include "base/lazy_instance.h"
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 } 65 }
66 66
67 private: 67 private:
68 DISALLOW_COPY_AND_ASSIGN(Setup); 68 DISALLOW_COPY_AND_ASSIGN(Setup);
69 }; 69 };
70 70
71 static base::LazyInstance<Setup>::Leaky setup = LAZY_INSTANCE_INITIALIZER; 71 static base::LazyInstance<Setup>::Leaky setup = LAZY_INSTANCE_INITIALIZER;
72 72
73 void InitContentHandlers(DynamicApplicationLoader* loader, 73 void InitContentHandlers(DynamicApplicationLoader* loader,
74 base::CommandLine* command_line) { 74 base::CommandLine* command_line) {
75 // Default content handlers.
76 loader->RegisterContentHandler("image/png", GURL("mojo://mojo_png_viewer/"));
77 loader->RegisterContentHandler("text/html", GURL("mojo://mojo_html_viewer/"));
78
79 // Command-line-specified content handlers.
75 std::string handlers_spec = command_line->GetSwitchValueASCII( 80 std::string handlers_spec = command_line->GetSwitchValueASCII(
76 switches::kContentHandlers); 81 switches::kContentHandlers);
77 if (handlers_spec.empty()) 82 if (handlers_spec.empty())
78 return; 83 return;
79 84
80 std::vector<std::string> parts; 85 std::vector<std::string> parts;
81 base::SplitString(handlers_spec, ',', &parts); 86 base::SplitString(handlers_spec, ',', &parts);
82 if (parts.size() % 2 != 0) { 87 if (parts.size() % 2 != 0) {
83 LOG(ERROR) << "Invalid value for switch " << switches::kContentHandlers 88 LOG(ERROR) << "Invalid value for switch " << switches::kContentHandlers
84 << ": must be a comma-separated list of mimetype/url pairs."; 89 << ": must be a comma-separated list of mimetype/url pairs.";
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
262 ScopedMessagePipeHandle Context::ConnectToServiceByName( 267 ScopedMessagePipeHandle Context::ConnectToServiceByName(
263 const GURL& application_url, 268 const GURL& application_url,
264 const std::string& service_name) { 269 const std::string& service_name) {
265 app_urls_.insert(application_url); 270 app_urls_.insert(application_url);
266 return application_manager_.ConnectToServiceByName( 271 return application_manager_.ConnectToServiceByName(
267 application_url, service_name).Pass(); 272 application_url, service_name).Pass();
268 } 273 }
269 274
270 } // namespace shell 275 } // namespace shell
271 } // namespace mojo 276 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/services/window_manager/window_manager_app.cc ('k') | mojo/shell/dynamic_application_loader.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698