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

Unified 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: absolute path... 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 side-by-side diff with in-line comments
Download patch
Index: chrome/common/extensions/manifest_handlers/externally_connectable.h
diff --git a/chrome/common/extensions/manifest_handlers/externally_connectable.h b/chrome/common/extensions/manifest_handlers/externally_connectable.h
index 7a8ff61830d6f67e8e21203239b84ea428e8a88b..595cef00b9d0c6b282173c2bfae0dd63c76bcbfb 100644
--- a/chrome/common/extensions/manifest_handlers/externally_connectable.h
+++ b/chrome/common/extensions/manifest_handlers/externally_connectable.h
@@ -62,18 +62,25 @@ struct ExternallyConnectableInfo : public Extension::ManifestData {
// The URL patterns that are allowed to connect/sendMessage.
const URLPatternSet matches;
- // The extension IDs that are allowed to connect/sendMessage.
+ // The extension IDs that are allowed to connect/sendMessage. Sorted.
const std::vector<std::string> ids;
// True if any extension is allowed to connect. This would have corresponded
// to an ID of "*" in |ids|.
- const bool matches_all_ids;
+ const bool all_ids;
- private:
+ // Returns true if |ids| contains |id| or if |all_ids| is true.
+ //
+ // More convenient for callers than checking each individually, and it makes
+ // use of the sortedness of |ids|.
+ bool IdCanConnect(const std::string& id);
+
+ // Public only for testing. Use FromValue in production.
ExternallyConnectableInfo(const URLPatternSet& matches,
const std::vector<std::string>& ids,
- bool matches_all_ids);
+ bool all_ids);
+ private:
DISALLOW_COPY_AND_ASSIGN(ExternallyConnectableInfo);
};

Powered by Google App Engine
This is Rietveld 408576698