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

Side by Side Diff: chrome/common/extensions/manifest_handlers/externally_connectable.h

Issue 16174005: Implement externally_connectable! Web pages can now communicate directly with (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: jeffrey review Created 7 years, 6 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 | Annotate | Revision Log
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 #ifndef CHROME_COMMON_EXTENSIONS_MANIFEST_HANDLERS_EXTERNALLY_CONNECTABLE_H_ 5 #ifndef CHROME_COMMON_EXTENSIONS_MANIFEST_HANDLERS_EXTERNALLY_CONNECTABLE_H_
6 #define CHROME_COMMON_EXTENSIONS_MANIFEST_HANDLERS_EXTERNALLY_CONNECTABLE_H_ 6 #define CHROME_COMMON_EXTENSIONS_MANIFEST_HANDLERS_EXTERNALLY_CONNECTABLE_H_
7 7
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 53
54 // Tries to construct the info based on |value|, as it would have appeared in 54 // Tries to construct the info based on |value|, as it would have appeared in
55 // the manifest. Sets |error| and returns an empty scoped_ptr on failure. 55 // the manifest. Sets |error| and returns an empty scoped_ptr on failure.
56 static scoped_ptr<ExternallyConnectableInfo> FromValue( 56 static scoped_ptr<ExternallyConnectableInfo> FromValue(
57 const base::Value& value, 57 const base::Value& value,
58 string16* error); 58 string16* error);
59 59
60 virtual ~ExternallyConnectableInfo(); 60 virtual ~ExternallyConnectableInfo();
61 61
62 // The URL patterns that are allowed to connect/sendMessage. 62 // The URL patterns that are allowed to connect/sendMessage.
63 const URLPatternSet matches; 63 const URLPatternSet matches;
Jeffrey Yasskin 2013/06/08 02:27:47 "url_matches"?
not at google - send to devlin 2013/06/08 02:36:50 we use matches elsewhere to mean URLs (notably con
64 64
65 // The extension IDs that are allowed to connect/sendMessage. 65 // The extension IDs that are allowed to connect/sendMessage. Sorted.
66 const std::vector<std::string> ids; 66 const std::vector<std::string> ids;
67 67
68 // True if any extension is allowed to connect. This would have corresponded 68 // True if any extension is allowed to connect. This would have corresponded
69 // to an ID of "*" in |ids|. 69 // to an ID of "*" in |ids|.
70 const bool matches_all_ids; 70 const bool matches_all_ids;
71 71
72 private: 72 // Returns true if |ids| contains |id| or if |matches_all_ids| is true.
73 //
74 // More convenient for callers than checking each individually, and it makes
75 // use of the sortedness of |ids|.
76 bool MatchesIdOrAllIds(const std::string& id);
Jeffrey Yasskin 2013/06/08 02:27:47 I might just call this "MatchesId" since if it mat
not at google - send to devlin 2013/06/08 02:36:50 now you've inspired me to not use the term "matche
77
78 // Public only for testing. Use FromValue in production.
73 ExternallyConnectableInfo(const URLPatternSet& matches, 79 ExternallyConnectableInfo(const URLPatternSet& matches,
74 const std::vector<std::string>& ids, 80 const std::vector<std::string>& ids,
75 bool matches_all_ids); 81 bool matches_all_ids);
76 82
83 private:
77 DISALLOW_COPY_AND_ASSIGN(ExternallyConnectableInfo); 84 DISALLOW_COPY_AND_ASSIGN(ExternallyConnectableInfo);
78 }; 85 };
79 86
80 } // namespace extensions 87 } // namespace extensions
81 88
82 #endif // CHROME_COMMON_EXTENSIONS_MANIFEST_HANDLERS_EXTERNALLY_CONNECTABLE_H_ 89 #endif // CHROME_COMMON_EXTENSIONS_MANIFEST_HANDLERS_EXTERNALLY_CONNECTABLE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698