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

Side by Side Diff: chrome/browser/extensions/extension_tab_util.h

Issue 2830903003: PS - Scrub URL down to origin in Public Sessions (Closed)
Patch Set: Rebase Created 3 years, 8 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
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_BROWSER_EXTENSIONS_EXTENSION_TAB_UTIL_H_ 5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_TAB_UTIL_H_
6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_TAB_UTIL_H_ 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_TAB_UTIL_H_
7 7
8 #include <memory> 8 #include <memory>
9 #include <string> 9 #include <string>
10 10
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 46
47 bool create_browser_if_needed; 47 bool create_browser_if_needed;
48 std::unique_ptr<int> window_id; 48 std::unique_ptr<int> window_id;
49 std::unique_ptr<int> opener_tab_id; 49 std::unique_ptr<int> opener_tab_id;
50 std::unique_ptr<std::string> url; 50 std::unique_ptr<std::string> url;
51 std::unique_ptr<bool> active; 51 std::unique_ptr<bool> active;
52 std::unique_ptr<bool> pinned; 52 std::unique_ptr<bool> pinned;
53 std::unique_ptr<int> index; 53 std::unique_ptr<int> index;
54 }; 54 };
55 55
56 // Platform specific delegate.
57 class Delegate {
58 public:
59 virtual ~Delegate() {}
60 // Platform specific scrubbing of tab info for |extension|.
61 virtual void ScrubTabForExtension(const Extension* extension,
62 content::WebContents* contents,
63 api::tabs::Tab* tab) = 0;
64 };
65
56 // Opens a new tab given an extension function |function| and creation 66 // Opens a new tab given an extension function |function| and creation
57 // parameters |params|. Returns a Tab object if successful, or NULL and 67 // parameters |params|. Returns a Tab object if successful, or NULL and
58 // optionally sets |error| if an error occurs. 68 // optionally sets |error| if an error occurs.
59 static base::DictionaryValue* OpenTab(UIThreadExtensionFunction* function, 69 static base::DictionaryValue* OpenTab(UIThreadExtensionFunction* function,
60 const OpenTabParams& params, 70 const OpenTabParams& params,
61 bool user_gesture, 71 bool user_gesture,
62 std::string* error); 72 std::string* error);
63 73
64 static int GetWindowId(const Browser* browser); 74 static int GetWindowId(const Browser* browser);
65 static int GetWindowIdOfTabStripModel(const TabStripModel* tab_strip_model); 75 static int GetWindowIdOfTabStripModel(const TabStripModel* tab_strip_model);
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 static std::unique_ptr<api::tabs::Tab> CreateTabObject( 117 static std::unique_ptr<api::tabs::Tab> CreateTabObject(
108 content::WebContents* web_contents, 118 content::WebContents* web_contents,
109 TabStripModel* tab_strip, 119 TabStripModel* tab_strip,
110 int tab_index); 120 int tab_index);
111 121
112 // Creates a tab MutedInfo object (see chrome/common/extensions/api/tabs.json) 122 // Creates a tab MutedInfo object (see chrome/common/extensions/api/tabs.json)
113 // with information about the mute state of a browser tab. 123 // with information about the mute state of a browser tab.
114 static std::unique_ptr<api::tabs::MutedInfo> CreateMutedInfo( 124 static std::unique_ptr<api::tabs::MutedInfo> CreateMutedInfo(
115 content::WebContents* contents); 125 content::WebContents* contents);
116 126
127 // Platform specific logic moved to delegate. This should be set during
128 // startup.
129 // |delegate| is a singleton instance and is leaked.
130 static void SetPlatformDelegate(Delegate* delegate);
131
117 // Removes any privacy-sensitive fields from a Tab object if appropriate, 132 // Removes any privacy-sensitive fields from a Tab object if appropriate,
118 // given the permissions of the extension and the tab in question. The 133 // given the permissions of the extension and the tab in question. The
119 // tab object is modified in place. 134 // tab object is modified in place.
120 static void ScrubTabForExtension(const Extension* extension, 135 static void ScrubTabForExtension(const Extension* extension,
121 content::WebContents* contents, 136 content::WebContents* contents,
122 api::tabs::Tab* tab); 137 api::tabs::Tab* tab);
123 138
124 // Gets the |tab_strip_model| and |tab_index| for the given |web_contents|. 139 // Gets the |tab_strip_model| and |tab_index| for the given |web_contents|.
125 static bool GetTabStripModel(const content::WebContents* web_contents, 140 static bool GetTabStripModel(const content::WebContents* web_contents,
126 TabStripModel** tab_strip_model, 141 TabStripModel** tab_strip_model,
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 static bool OpenOptionsPage(const Extension* extension, Browser* browser); 196 static bool OpenOptionsPage(const Extension* extension, Browser* browser);
182 197
183 // Returns true if the given Browser can report tabs to extensions. 198 // Returns true if the given Browser can report tabs to extensions.
184 // Example of Browsers which don't support tabs include apps and devtools. 199 // Example of Browsers which don't support tabs include apps and devtools.
185 static bool BrowserSupportsTabs(Browser* browser); 200 static bool BrowserSupportsTabs(Browser* browser);
186 }; 201 };
187 202
188 } // namespace extensions 203 } // namespace extensions
189 204
190 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_TAB_UTIL_H_ 205 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_TAB_UTIL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698