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

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

Issue 885493007: Refactoring: de-couple Extensions from "script injection System" [render side] : 1 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 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 | « extensions/browser/guest_view/web_view/web_view_guest.h ('k') | extensions/common/host_id.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 EXTENSIONS_COMMON_HOST_ID_H_ 5 #ifndef EXTENSIONS_COMMON_HOST_ID_H_
6 #define EXTENSIONS_COMMON_HOST_ID_H_ 6 #define EXTENSIONS_COMMON_HOST_ID_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 // IDs of hosts who own user scripts. 10 // IDs of hosts who own user scripts.
11 // A HostID is immutable after creation. 11 // A HostID is immutable after creation.
12 struct HostID { 12 struct HostID {
13 enum HostType { EXTENSIONS, WEBUI }; 13 enum HostType { EXTENSIONS, WEBUI };
14 14
15 HostID() {} 15 HostID();
16 HostID(HostType type, const std::string& id) 16 HostID(HostType type, const std::string& id);
17 : type_(type), id_(id) {} 17 HostID(const HostID& host_id);
18 ~HostID();
18 19
19 bool operator<(const HostID& host_id) const { 20 bool operator<(const HostID& host_id) const;
20 if (type_ != host_id.type()) 21 bool operator==(const HostID& host_id) const;
21 return type_ < host_id.type();
22 else if (id_ != host_id.id())
23 return id_ < host_id.id();
24 return false;
25 }
26 22
27 HostType type() const { return type_; } 23 HostType type() const { return type_; }
28 const std::string& id() const { return id_; } 24 const std::string& id() const { return id_; }
29 25
30 private: 26 private:
31 // The type of the host. 27 // The type of the host.
32 HostType type_; 28 HostType type_;
33 29
34 // Similar to extension_id, host_id is a unique indentifier for a host, 30 // Similar to extension_id, host_id is a unique indentifier for a host,
35 // e.g., an Extension or WebUI. 31 // e.g., an Extension or WebUI.
36 std::string id_; 32 std::string id_;
37 }; 33 };
38 34
39 #endif // EXTENSIONS_COMMON_HOST_ID_H_ 35 #endif // EXTENSIONS_COMMON_HOST_ID_H_
OLDNEW
« no previous file with comments | « extensions/browser/guest_view/web_view/web_view_guest.h ('k') | extensions/common/host_id.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698