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

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

Issue 10829186: Tabs API is usable without tabs permission. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: . Created 8 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
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 24 matching lines...) Expand all
35 } 35 }
36 36
37 // Provides various utility functions that help manipulate tabs. 37 // Provides various utility functions that help manipulate tabs.
38 class ExtensionTabUtil { 38 class ExtensionTabUtil {
39 public: 39 public:
40 static int GetWindowId(const Browser* browser); 40 static int GetWindowId(const Browser* browser);
41 static int GetWindowIdOfTabStripModel(const TabStripModel* tab_strip_model); 41 static int GetWindowIdOfTabStripModel(const TabStripModel* tab_strip_model);
42 static int GetTabId(const content::WebContents* web_contents); 42 static int GetTabId(const content::WebContents* web_contents);
43 static std::string GetTabStatusText(bool is_loading); 43 static std::string GetTabStatusText(bool is_loading);
44 static int GetWindowIdOfTab(const content::WebContents* web_contents); 44 static int GetWindowIdOfTab(const content::WebContents* web_contents);
45 static base::ListValue* CreateTabList(const Browser* browser); 45 static base::ListValue* CreateTabList(
46 const Browser* browser,
47 const extensions::Extension* extension);
46 static base::DictionaryValue* CreateTabValue( 48 static base::DictionaryValue* CreateTabValue(
47 const content::WebContents* web_contents); 49 const content::WebContents* web_contents,
50 const extensions::Extension* extension);
48 static base::DictionaryValue* CreateTabValue( 51 static base::DictionaryValue* CreateTabValue(
49 const content::WebContents* web_contents, 52 const content::WebContents* web_contents,
50 TabStripModel* tab_strip, 53 TabStripModel* tab_strip,
51 int tab_index); 54 int tab_index,
55 const extensions::Extension* extension);
52 // Create a tab value, overriding its kSelectedKey to the provided boolean. 56 // Create a tab value, overriding its kSelectedKey to the provided boolean.
53 static base::DictionaryValue* CreateTabValueActive( 57 static base::DictionaryValue* CreateTabValueActive(
54 const content::WebContents* web_contents, 58 const content::WebContents* web_contents,
55 bool active); 59 bool active,
60 const extensions::Extension* extension);
61
62 static void MaybeStripEventArgsOfSensitiveData(
63 const std::string& event_name,
64 const extensions::Extension* extension,
65 base::ListValue* event_args);
56 66
57 // Gets the |tab_strip_model| and |tab_index| for the given |web_contents|. 67 // Gets the |tab_strip_model| and |tab_index| for the given |web_contents|.
58 static bool GetTabStripModel(const content::WebContents* web_contents, 68 static bool GetTabStripModel(const content::WebContents* web_contents,
59 TabStripModel** tab_strip_model, 69 TabStripModel** tab_strip_model,
60 int* tab_index); 70 int* tab_index);
61 static bool GetDefaultTab(Browser* browser, 71 static bool GetDefaultTab(Browser* browser,
62 TabContents** contents, 72 TabContents** contents,
63 int* tab_id); 73 int* tab_id);
64 // Any out parameter (|browser|, |tab_strip|, |contents|, & |tab_index|) may 74 // Any out parameter (|browser|, |tab_strip|, |contents|, & |tab_index|) may
65 // be NULL and will not be set within the function. 75 // be NULL and will not be set within the function.
(...skipping 26 matching lines...) Expand all
92 102
93 // Executes the specified callback for all tabs in all browser windows. 103 // Executes the specified callback for all tabs in all browser windows.
94 static void ForEachTab( 104 static void ForEachTab(
95 const base::Callback<void(content::WebContents*)>& callback); 105 const base::Callback<void(content::WebContents*)>& callback);
96 106
97 static extensions::WindowController* GetWindowControllerOfTab( 107 static extensions::WindowController* GetWindowControllerOfTab(
98 const content::WebContents* web_contents); 108 const content::WebContents* web_contents);
99 }; 109 };
100 110
101 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_TAB_UTIL_H__ 111 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_TAB_UTIL_H__
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698