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

Side by Side Diff: mojo/shell/content_handler_connection.h

Issue 1311353005: Adds a way to determine id of content handler that created app (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: nuke comment 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 | « mojo/shell/capability_filter_unittest.cc ('k') | mojo/shell/content_handler_connection.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 MOJO_SHELL_CONTENT_HANDLER_CONNECTION_H_ 5 #ifndef MOJO_SHELL_CONTENT_HANDLER_CONNECTION_H_
6 #define MOJO_SHELL_CONTENT_HANDLER_CONNECTION_H_ 6 #define MOJO_SHELL_CONTENT_HANDLER_CONNECTION_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "mojo/application/public/interfaces/content_handler.mojom.h" 10 #include "mojo/application/public/interfaces/content_handler.mojom.h"
11 #include "mojo/shell/capability_filter.h" 11 #include "mojo/shell/capability_filter.h"
12 #include "url/gurl.h" 12 #include "url/gurl.h"
13 13
14 namespace mojo { 14 namespace mojo {
15 namespace shell { 15 namespace shell {
16 16
17 class ApplicationInstance; 17 class ApplicationInstance;
18 class ApplicationManager; 18 class ApplicationManager;
19 19
20 // A ContentHandlerConnection is responsible for creating and maintaining a 20 // A ContentHandlerConnection is responsible for creating and maintaining a
21 // connection to an app which provides the ContentHandler service. 21 // connection to an app which provides the ContentHandler service.
22 // A ContentHandlerConnection can only be destroyed via CloseConnection. 22 // A ContentHandlerConnection can only be destroyed via CloseConnection.
23 // A ContentHandlerConnection manages its own lifetime and cannot be used with 23 // A ContentHandlerConnection manages its own lifetime and cannot be used with
24 // a scoped_ptr to avoid reentrant calls into ApplicationManager late in 24 // a scoped_ptr to avoid reentrant calls into ApplicationManager late in
25 // destruction. 25 // destruction.
26 class ContentHandlerConnection { 26 class ContentHandlerConnection {
27 public: 27 public:
28 // |id| is a unique identifier for this content handler.
28 ContentHandlerConnection(ApplicationInstance* originator, 29 ContentHandlerConnection(ApplicationInstance* originator,
29 ApplicationManager* manager, 30 ApplicationManager* manager,
30 const GURL& content_handler_url, 31 const GURL& content_handler_url,
31 const GURL& requestor_url, 32 const GURL& requestor_url,
32 const std::string& qualifier, 33 const std::string& qualifier,
33 const CapabilityFilter& filter); 34 const CapabilityFilter& filter,
35 uint32_t id);
34 36
35 // Closes the connection and destroys |this| object. 37 // Closes the connection and destroys |this| object.
36 void CloseConnection(); 38 void CloseConnection();
37 39
38 ContentHandler* content_handler() { return content_handler_.get(); } 40 ContentHandler* content_handler() { return content_handler_.get(); }
39 const GURL& content_handler_url() { return content_handler_url_; } 41 const GURL& content_handler_url() { return content_handler_url_; }
40 const std::string& content_handler_qualifier() { 42 const std::string& content_handler_qualifier() {
41 return content_handler_qualifier_; 43 return content_handler_qualifier_;
42 } 44 }
45 uint32_t id() const { return id_; }
43 46
44 private: 47 private:
45 ~ContentHandlerConnection(); 48 ~ContentHandlerConnection();
46 49
47 ApplicationManager* manager_; 50 ApplicationManager* manager_;
48 GURL content_handler_url_; 51 GURL content_handler_url_;
49 std::string content_handler_qualifier_; 52 std::string content_handler_qualifier_;
50 ContentHandlerPtr content_handler_; 53 ContentHandlerPtr content_handler_;
51 bool connection_closed_; 54 bool connection_closed_;
55 // The id for this content handler.
56 const uint32_t id_;
52 57
53 DISALLOW_COPY_AND_ASSIGN(ContentHandlerConnection); 58 DISALLOW_COPY_AND_ASSIGN(ContentHandlerConnection);
54 }; 59 };
55 60
56 } // namespace shell 61 } // namespace shell
57 } // namespace mojo 62 } // namespace mojo
58 63
59 #endif // MOJO_SHELL_CONTENT_HANDLER_CONNECTION_H_ 64 #endif // MOJO_SHELL_CONTENT_HANDLER_CONNECTION_H_
OLDNEW
« no previous file with comments | « mojo/shell/capability_filter_unittest.cc ('k') | mojo/shell/content_handler_connection.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698