OLD | NEW |
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/at_exit.h" | 5 #include "base/at_exit.h" |
6 #include "base/bind.h" | 6 #include "base/bind.h" |
7 #include "base/macros.h" | 7 #include "base/macros.h" |
8 #include "base/memory/scoped_vector.h" | 8 #include "base/memory/scoped_vector.h" |
9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
10 #include "mojo/public/cpp/application/application_connection.h" | 10 #include "mojo/public/cpp/application/application_connection.h" |
(...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
395 public: | 395 public: |
396 void AddMapping(const GURL& from, const GURL& to) { mappings_[from] = to; } | 396 void AddMapping(const GURL& from, const GURL& to) { mappings_[from] = to; } |
397 | 397 |
398 // ApplicationManager::Delegate | 398 // ApplicationManager::Delegate |
399 GURL ResolveMappings(const GURL& url) override { | 399 GURL ResolveMappings(const GURL& url) override { |
400 auto it = mappings_.find(url); | 400 auto it = mappings_.find(url); |
401 if (it != mappings_.end()) | 401 if (it != mappings_.end()) |
402 return it->second; | 402 return it->second; |
403 return url; | 403 return url; |
404 } | 404 } |
405 | 405 GURL ResolveMojoURL(const GURL& url) override { |
406 // ApplicationManager::Delegate | |
407 GURL ResolveURL(const GURL& url) override { | |
408 GURL mapped_url = ResolveMappings(url); | 406 GURL mapped_url = ResolveMappings(url); |
409 // The shell automatically map mojo URLs. | 407 // The shell automatically map mojo URLs. |
410 if (mapped_url.scheme() == "mojo") { | 408 if (mapped_url.scheme() == "mojo") { |
411 url::Replacements<char> replacements; | 409 url::Replacements<char> replacements; |
412 replacements.SetScheme("file", url::Component(0, 4)); | 410 replacements.SetScheme("file", url::Component(0, 4)); |
413 mapped_url = mapped_url.ReplaceComponents(replacements); | 411 mapped_url = mapped_url.ReplaceComponents(replacements); |
414 } | 412 } |
415 return mapped_url; | 413 return mapped_url; |
416 } | 414 } |
417 | 415 |
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
734 application_manager_->ConnectToApplication( | 732 application_manager_->ConnectToApplication( |
735 GURL("test:test"), GURL(), nullptr, nullptr, | 733 GURL("test:test"), GURL(), nullptr, nullptr, |
736 base::Bind(&QuitClosure, base::Unretained(&called))); | 734 base::Bind(&QuitClosure, base::Unretained(&called))); |
737 loop_.Run(); | 735 loop_.Run(); |
738 EXPECT_TRUE(called); | 736 EXPECT_TRUE(called); |
739 } | 737 } |
740 | 738 |
741 } // namespace | 739 } // namespace |
742 } // namespace shell | 740 } // namespace shell |
743 } // namespace mojo | 741 } // namespace mojo |
OLD | NEW |