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

Side by Side Diff: extensions/browser/process_map.h

Issue 426593007: Refactor guest view availability to be API not permission based. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: MostLikelyContextType Created 6 years, 4 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
« no previous file with comments | « extensions/browser/extension_function_dispatcher.cc ('k') | extensions/browser/process_map.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 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 EXTENSIONS_BROWSER_PROCESS_MAP_H_ 5 #ifndef EXTENSIONS_BROWSER_PROCESS_MAP_H_
6 #define EXTENSIONS_BROWSER_PROCESS_MAP_H_ 6 #define EXTENSIONS_BROWSER_PROCESS_MAP_H_
7 7
8 #include <set> 8 #include <set>
9 #include <string> 9 #include <string>
10 10
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 88
89 bool Remove(const std::string& extension_id, int process_id, 89 bool Remove(const std::string& extension_id, int process_id,
90 int site_instance_id); 90 int site_instance_id);
91 int RemoveAllFromProcess(int process_id); 91 int RemoveAllFromProcess(int process_id);
92 92
93 bool Contains(const std::string& extension_id, int process_id) const; 93 bool Contains(const std::string& extension_id, int process_id) const;
94 bool Contains(int process_id) const; 94 bool Contains(int process_id) const;
95 95
96 std::set<std::string> GetExtensionsInProcess(int process_id) const; 96 std::set<std::string> GetExtensionsInProcess(int process_id) const;
97 97
98 // Guesses the most permissive context type for the process with ID 98 // Gets the most likely context type for the process with ID |process_id|
99 // |process_id|. Context types are renderer (JavaScript) concepts but the 99 // which hosts Extension |extension|, if any (may be NULL). Context types are
100 // browser can do a decent job in guessing what the process hosts. 100 // renderer (JavaScript) concepts but the browser can do a decent job in
101 // guessing what the process hosts.
101 // 102 //
103 // |extension| is the funky part - unfortunately we need to trust the
104 // caller of this method to be correct that indeed the context does feature
105 // an extension. This matters for iframes, where an extension could be
106 // hosted in another extension's process (privilege level needs to be
107 // downgraded) or in a web page's process (privilege level needs to be
108 // upgraded).
109 //
110 // The latter of these is slightly problematic from a security perspective;
111 // if a web page renderer gets owned it could try to pretend it's an
112 // extension and get access to some unprivileged APIs. Luckly, when OOP
113 // iframes lauch, it won't be an issue.
114 //
115 // Anyhow, the expected behaviour is:
102 // - For hosted app processes, this will be blessed_web_page. 116 // - For hosted app processes, this will be blessed_web_page.
103 // - For other extension processes, this will be blessed_extension. 117 // - For other extension processes, this will be blessed_extension.
104 // - For WebUI processes, this will be a webui. 118 // - For WebUI processes, this will be a webui.
105 // - For anything else we have the choice of unblessed_extension or 119 // - For any other extension we have the choice of unblessed_extension or
106 // content_script. Since content scripts are more common, guess that. 120 // content_script. Since content scripts are more common, guess that.
107 // We *could* in theory track which web processes have extension frames 121 // We *could* in theory track which web processes have extension frames
108 // in them, and those would be unblessed_extension, but we don't at the 122 // in them, and those would be unblessed_extension, but we don't at the
109 // moment, and once OOP iframes exist then there won't even be such a 123 // moment, and once OOP iframes exist then there won't even be such a
110 // thing as an unblessed_extension context. 124 // thing as an unblessed_extension context.
111 // 125 // - For anything else, web_page.
112 // |extension| isn't used to upgrade the process trust level, but rather used 126 Feature::Context GetMostLikelyContextType(const Extension* extension,
113 // as a tiebreaker if a process is found to contain multiple extensions. 127 int process_id) const;
114 Feature::Context GuessContextType(const Extension* extension,
115 int process_id) const;
116 128
117 private: 129 private:
118 struct Item; 130 struct Item;
119 131
120 typedef std::set<Item> ItemSet; 132 typedef std::set<Item> ItemSet;
121 ItemSet items_; 133 ItemSet items_;
122 134
123 DISALLOW_COPY_AND_ASSIGN(ProcessMap); 135 DISALLOW_COPY_AND_ASSIGN(ProcessMap);
124 }; 136 };
125 137
126 } // namespace extensions 138 } // namespace extensions
127 139
128 #endif // EXTENSIONS_BROWSER_PROCESS_MAP_H_ 140 #endif // EXTENSIONS_BROWSER_PROCESS_MAP_H_
OLDNEW
« no previous file with comments | « extensions/browser/extension_function_dispatcher.cc ('k') | extensions/browser/process_map.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698