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

Side by Side Diff: extensions/common/host_id.h

Issue 822453002: Introduce HostID and de-couple Extensions from "script injection System" [browser side] (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Introduce HostID for DeclarativeUserScriptMaser assignment, remove ConsumerID. Created 5 years, 11 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
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef EXTENSIONS_COMMON_HOST_ID_H_
6 #define EXTENSIONS_COMMON_HOST_ID_H_
7
8 #include <string>
9
10 #include "base/macros.h"
11
12 // IDs of hosts who own user scripts.
13 // A HostID is immutable after creation.
14 struct HostID {
15 enum HostType { EXTENSIONS, WEBUI };
16
17 HostID() {}
18 HostID(HostType host_type, const std::string& host_id)
19 : type(host_type), id(host_id) {}
20
21 bool operator<(const HostID& host_id) const {
22 if (type != host_id.Type())
23 return type < host_id.Type();
24 else if (id != host_id.ID())
25 return id < host_id.ID();
26 else
27 return false;
28 }
29
30 HostType Type() const { return type; }
Devlin 2015/01/26 20:12:09 nit: lowercase these -> type() and id()
Xi Han 2015/01/26 23:27:53 Done.
31 const std::string& ID() const { return id; }
32
33 private:
34 // The type of the host.
35 HostType type;
Devlin 2015/01/26 20:12:09 Since these are private, they should have a traili
Xi Han 2015/01/26 23:27:53 Oh, I thought the member variables of a struct wou
36
37 // Similar to extension_id, host_id is a unique indentifier for a host,
38 // e.g., an Extension or WebUI.
39 std::string id;
40 };
41
42 #endif // EXTENSIONS_COMMON_HOST_ID_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698