OLD | NEW |
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" |
11 #include "webkit/glue/window_open_disposition.h" | 11 #include "webkit/glue/window_open_disposition.h" |
12 | 12 |
13 class Browser; | 13 class Browser; |
14 class GURL; | 14 class GURL; |
15 class Profile; | 15 class Profile; |
16 class TabContents; | |
17 class TabStripModel; | 16 class TabStripModel; |
18 | 17 |
19 namespace base { | 18 namespace base { |
20 class DictionaryValue; | 19 class DictionaryValue; |
21 class ListValue; | 20 class ListValue; |
22 } | 21 } |
23 | 22 |
24 namespace content { | 23 namespace content { |
25 class WebContents; | 24 class WebContents; |
26 } | 25 } |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 const content::WebContents* web_contents, | 70 const content::WebContents* web_contents, |
72 TabStripModel* tab_strip, | 71 TabStripModel* tab_strip, |
73 int tab_index, | 72 int tab_index, |
74 IncludePrivacySensitiveFields include_privacy_sensitive_fields); | 73 IncludePrivacySensitiveFields include_privacy_sensitive_fields); |
75 | 74 |
76 // Gets the |tab_strip_model| and |tab_index| for the given |web_contents|. | 75 // Gets the |tab_strip_model| and |tab_index| for the given |web_contents|. |
77 static bool GetTabStripModel(const content::WebContents* web_contents, | 76 static bool GetTabStripModel(const content::WebContents* web_contents, |
78 TabStripModel** tab_strip_model, | 77 TabStripModel** tab_strip_model, |
79 int* tab_index); | 78 int* tab_index); |
80 static bool GetDefaultTab(Browser* browser, | 79 static bool GetDefaultTab(Browser* browser, |
81 TabContents** contents, | 80 content::WebContents** contents, |
82 int* tab_id); | 81 int* tab_id); |
83 // Any out parameter (|browser|, |tab_strip|, |contents|, & |tab_index|) may | 82 // Any out parameter (|browser|, |tab_strip|, |contents|, & |tab_index|) may |
84 // be NULL and will not be set within the function. | 83 // be NULL and will not be set within the function. |
85 static bool GetTabById(int tab_id, Profile* profile, bool incognito_enabled, | 84 static bool GetTabById(int tab_id, Profile* profile, bool incognito_enabled, |
86 Browser** browser, | 85 Browser** browser, |
87 TabStripModel** tab_strip, | 86 TabStripModel** tab_strip, |
88 TabContents** contents, | 87 content::WebContents** contents, |
89 int* tab_index); | 88 int* tab_index); |
90 | 89 |
91 // Takes |url_string| and returns a GURL which is either valid and absolute | 90 // Takes |url_string| and returns a GURL which is either valid and absolute |
92 // or invalid. If |url_string| is not directly interpretable as a valid (it is | 91 // or invalid. If |url_string| is not directly interpretable as a valid (it is |
93 // likely a relative URL) an attempt is made to resolve it. |extension| is | 92 // likely a relative URL) an attempt is made to resolve it. |extension| is |
94 // provided so it can be resolved relative to its extension base | 93 // provided so it can be resolved relative to its extension base |
95 // (chrome-extension://<id>/). Using the source frame url would be more | 94 // (chrome-extension://<id>/). Using the source frame url would be more |
96 // correct, but because the api shipped with urls resolved relative to their | 95 // correct, but because the api shipped with urls resolved relative to their |
97 // extension base, we decided it wasn't worth breaking existing extensions to | 96 // extension base, we decided it wasn't worth breaking existing extensions to |
98 // fix. | 97 // fix. |
(...skipping 12 matching lines...) Expand all Loading... |
111 | 110 |
112 // Executes the specified callback for all tabs in all browser windows. | 111 // Executes the specified callback for all tabs in all browser windows. |
113 static void ForEachTab( | 112 static void ForEachTab( |
114 const base::Callback<void(content::WebContents*)>& callback); | 113 const base::Callback<void(content::WebContents*)>& callback); |
115 | 114 |
116 static extensions::WindowController* GetWindowControllerOfTab( | 115 static extensions::WindowController* GetWindowControllerOfTab( |
117 const content::WebContents* web_contents); | 116 const content::WebContents* web_contents); |
118 }; | 117 }; |
119 | 118 |
120 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_TAB_UTIL_H__ | 119 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_TAB_UTIL_H__ |
OLD | NEW |