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

Side by Side Diff: content/browser/mojo/mojo_shell_context.h

Issue 1343823002: Revert of Move fetching logic out of ApplicationManager, eliminate url mappings. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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
« no previous file with comments | « content/browser/BUILD.gn ('k') | content/browser/mojo/mojo_shell_context.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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 #ifndef CONTENT_BROWSER_MOJO_MOJO_SHELL_CONTEXT_H_ 5 #ifndef CONTENT_BROWSER_MOJO_MOJO_SHELL_CONTEXT_H_
6 #define CONTENT_BROWSER_MOJO_MOJO_SHELL_CONTEXT_H_ 6 #define CONTENT_BROWSER_MOJO_MOJO_SHELL_CONTEXT_H_
7 7
8 #include <map> 8 #include <map>
9 9
10 #include "base/callback_forward.h" 10 #include "base/callback_forward.h"
11 #include "base/compiler_specific.h" 11 #include "base/compiler_specific.h"
12 #include "base/lazy_instance.h" 12 #include "base/lazy_instance.h"
13 #include "base/macros.h" 13 #include "base/macros.h"
14 #include "base/memory/scoped_ptr.h" 14 #include "base/memory/scoped_ptr.h"
15 #include "content/common/content_export.h" 15 #include "content/common/content_export.h"
16 #include "mojo/application/public/interfaces/shell.mojom.h" 16 #include "mojo/application/public/interfaces/shell.mojom.h"
17 #include "mojo/shell/application_manager.h" 17 #include "mojo/shell/application_manager.h"
18 18
19 class GURL; 19 class GURL;
20 20
21 namespace mojo { 21 namespace mojo {
22 class ApplicationDelegate; 22 class ApplicationDelegate;
23 } 23 }
24 24
25 namespace content { 25 namespace content {
26 26
27 // MojoShellContext hosts the browser's ApplicationManager, coordinating 27 // MojoShellContext hosts the browser's ApplicationManager, coordinating
28 // app registration and interconnection. 28 // app registration and interconnection.
29 class CONTENT_EXPORT MojoShellContext { 29 class CONTENT_EXPORT MojoShellContext
30 : public NON_EXPORTED_BASE(mojo::shell::ApplicationManager::Delegate) {
30 public: 31 public:
31 using StaticApplicationMap = 32 using StaticApplicationMap =
32 std::map<GURL, base::Callback<scoped_ptr<mojo::ApplicationDelegate>()>>; 33 std::map<GURL, base::Callback<scoped_ptr<mojo::ApplicationDelegate>()>>;
33 34
34 MojoShellContext(); 35 MojoShellContext();
35 ~MojoShellContext(); 36 ~MojoShellContext() override;
36 37
37 // Connects an application at |url| and gets a handle to its exposed services. 38 // Connects an application at |url| and gets a handle to its exposed services.
38 // This is only intended for use in browser code that's not part of some Mojo 39 // This is only intended for use in browser code that's not part of some Mojo
39 // application. May be called from any thread. |requestor_url| is given to 40 // application. May be called from any thread. |requestor_url| is given to
40 // the target application as the requestor's URL upon connection. 41 // the target application as the requestor's URL upon connection.
41 static void ConnectToApplication( 42 static void ConnectToApplication(
42 const GURL& url, 43 const GURL& url,
43 const GURL& requestor_url, 44 const GURL& requestor_url,
44 mojo::InterfaceRequest<mojo::ServiceProvider> request, 45 mojo::InterfaceRequest<mojo::ServiceProvider> request,
45 mojo::ServiceProviderPtr exposed_services, 46 mojo::ServiceProviderPtr exposed_services,
46 const mojo::shell::CapabilityFilter& filter, 47 const mojo::shell::CapabilityFilter& filter,
47 const mojo::Shell::ConnectToApplicationCallback& callback); 48 const mojo::Shell::ConnectToApplicationCallback& callback);
48 49
49 static void SetApplicationsForTest(const StaticApplicationMap* apps); 50 static void SetApplicationsForTest(const StaticApplicationMap* apps);
50 51
51 private: 52 private:
52 class Proxy; 53 class Proxy;
53 friend class Proxy; 54 friend class Proxy;
54 55
55 void ConnectToApplicationOnOwnThread( 56 void ConnectToApplicationOnOwnThread(
56 const GURL& url, 57 const GURL& url,
57 const GURL& requestor_url, 58 const GURL& requestor_url,
58 mojo::InterfaceRequest<mojo::ServiceProvider> request, 59 mojo::InterfaceRequest<mojo::ServiceProvider> request,
59 mojo::ServiceProviderPtr exposed_services, 60 mojo::ServiceProviderPtr exposed_services,
60 const mojo::shell::CapabilityFilter& filter, 61 const mojo::shell::CapabilityFilter& filter,
61 const mojo::Shell::ConnectToApplicationCallback& callback); 62 const mojo::Shell::ConnectToApplicationCallback& callback);
62 63
64 // mojo::shell::ApplicationManager::Delegate:
65 GURL ResolveMappings(const GURL& url) override;
66 GURL ResolveMojoURL(const GURL& url) override;
67 bool CreateFetcher(
68 const GURL& url,
69 const mojo::shell::Fetcher::FetchCallback& loader_callback) override;
70
63 static base::LazyInstance<scoped_ptr<Proxy>> proxy_; 71 static base::LazyInstance<scoped_ptr<Proxy>> proxy_;
64 72
65 scoped_ptr<mojo::shell::ApplicationManager> application_manager_; 73 scoped_ptr<mojo::shell::ApplicationManager> application_manager_;
66 74
67 DISALLOW_COPY_AND_ASSIGN(MojoShellContext); 75 DISALLOW_COPY_AND_ASSIGN(MojoShellContext);
68 }; 76 };
69 77
70 } // namespace content 78 } // namespace content
71 79
72 #endif // CONTENT_BROWSER_MOJO_MOJO_SHELL_CONTEXT_H_ 80 #endif // CONTENT_BROWSER_MOJO_MOJO_SHELL_CONTEXT_H_
OLDNEW
« no previous file with comments | « content/browser/BUILD.gn ('k') | content/browser/mojo/mojo_shell_context.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698