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

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

Issue 11824004: Do not pass URLs in onUpdated events to extensions unless they have the (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Revised to address review comments Created 7 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
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 <string> 8 #include <string>
9 9
10 #include "base/callback.h" 10 #include "base/callback.h"
(...skipping 27 matching lines...) Expand all
38 public: 38 public:
39 static int GetWindowId(const Browser* browser); 39 static int GetWindowId(const Browser* browser);
40 static int GetWindowIdOfTabStripModel(const TabStripModel* tab_strip_model); 40 static int GetWindowIdOfTabStripModel(const TabStripModel* tab_strip_model);
41 static int GetTabId(const content::WebContents* web_contents); 41 static int GetTabId(const content::WebContents* web_contents);
42 static std::string GetTabStatusText(bool is_loading); 42 static std::string GetTabStatusText(bool is_loading);
43 static int GetWindowIdOfTab(const content::WebContents* web_contents); 43 static int GetWindowIdOfTab(const content::WebContents* web_contents);
44 static base::ListValue* CreateTabList( 44 static base::ListValue* CreateTabList(
45 const Browser* browser, 45 const Browser* browser,
46 const extensions::Extension* extension); 46 const extensions::Extension* extension);
47 47
48 // Creates a Tab object (a Javascript dictionary with information about the
49 // status of a browser tab). Depending on the permissions of the extension,
not at google - send to devlin 2013/01/09 02:04:29 "A Javascript dictionary..." is a bit misleading,
mvrable 2013/01/09 19:25:35 Done.
50 // the object may or may not include sensitive data such as the tab's URL.
48 static base::DictionaryValue* CreateTabValue( 51 static base::DictionaryValue* CreateTabValue(
49 const content::WebContents* web_contents, 52 const content::WebContents* web_contents,
50 const extensions::Extension* extension) { 53 const extensions::Extension* extension) {
51 return CreateTabValue(web_contents, NULL, -1, extension); 54 return CreateTabValue(web_contents, NULL, -1, extension);
52 } 55 }
53 static base::DictionaryValue* CreateTabValue( 56 static base::DictionaryValue* CreateTabValue(
54 const content::WebContents* web_contents, 57 const content::WebContents* web_contents,
55 TabStripModel* tab_strip, 58 TabStripModel* tab_strip,
56 int tab_index, 59 int tab_index,
57 const extensions::Extension* extension); 60 const extensions::Extension* extension);
58 61
59 enum IncludePrivacySensitiveFields { 62 // Creates a Tab object but performs no extension permissions checks; the
60 INCLUDE_PRIVACY_SENSITIVE_FIELDS, 63 // returned object will contain privacy-sensitive data.
61 OMIT_PRIVACY_SENSITIVE_FIELDS
62 };
63 static base::DictionaryValue* CreateTabValue( 64 static base::DictionaryValue* CreateTabValue(
64 const content::WebContents* web_contents, 65 const content::WebContents* web_contents) {
65 IncludePrivacySensitiveFields include_privacy_sensitive_fields) { 66 return CreateTabValue(web_contents, NULL, -1);
66 return CreateTabValue(web_contents, NULL, -1,
67 include_privacy_sensitive_fields);
68 } 67 }
69 static base::DictionaryValue* CreateTabValue( 68 static base::DictionaryValue* CreateTabValue(
70 const content::WebContents* web_contents, 69 const content::WebContents* web_contents,
71 TabStripModel* tab_strip, 70 TabStripModel* tab_strip,
72 int tab_index, 71 int tab_index);
73 IncludePrivacySensitiveFields include_privacy_sensitive_fields); 72
73 // Removes any privacy-sensitive fields from a Tab object if appropriate,
74 // given the permissions of the extension and the tab in question. The
75 // tab_info object is modified in place.
76 static base::DictionaryValue* ScrubTabValueForExtension(
77 const content::WebContents* contents,
78 const extensions::Extension* extension,
79 base::DictionaryValue* tab_info);
74 80
75 // Gets the |tab_strip_model| and |tab_index| for the given |web_contents|. 81 // Gets the |tab_strip_model| and |tab_index| for the given |web_contents|.
76 static bool GetTabStripModel(const content::WebContents* web_contents, 82 static bool GetTabStripModel(const content::WebContents* web_contents,
77 TabStripModel** tab_strip_model, 83 TabStripModel** tab_strip_model,
78 int* tab_index); 84 int* tab_index);
79 static bool GetDefaultTab(Browser* browser, 85 static bool GetDefaultTab(Browser* browser,
80 content::WebContents** contents, 86 content::WebContents** contents,
81 int* tab_id); 87 int* tab_id);
82 // Any out parameter (|browser|, |tab_strip|, |contents|, & |tab_index|) may 88 // Any out parameter (|browser|, |tab_strip|, |contents|, & |tab_index|) may
83 // be NULL and will not be set within the function. 89 // be NULL and will not be set within the function.
(...skipping 26 matching lines...) Expand all
110 116
111 // Executes the specified callback for all tabs in all browser windows. 117 // Executes the specified callback for all tabs in all browser windows.
112 static void ForEachTab( 118 static void ForEachTab(
113 const base::Callback<void(content::WebContents*)>& callback); 119 const base::Callback<void(content::WebContents*)>& callback);
114 120
115 static extensions::WindowController* GetWindowControllerOfTab( 121 static extensions::WindowController* GetWindowControllerOfTab(
116 const content::WebContents* web_contents); 122 const content::WebContents* web_contents);
117 }; 123 };
118 124
119 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_TAB_UTIL_H__ 125 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_TAB_UTIL_H__
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698