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 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 class Browser; | 11 class Browser; |
12 class Extension; | |
13 class GURL; | 12 class GURL; |
14 class Profile; | 13 class Profile; |
15 class TabContentsWrapper; | 14 class TabContentsWrapper; |
16 class TabStripModel; | 15 class TabStripModel; |
17 | 16 |
18 namespace base { | 17 namespace base { |
19 class DictionaryValue; | 18 class DictionaryValue; |
20 class ListValue; | 19 class ListValue; |
21 } | 20 } |
22 | 21 |
23 namespace content { | 22 namespace content { |
24 class WebContents; | 23 class WebContents; |
25 } | 24 } |
26 | 25 |
| 26 namespace extensions { |
| 27 class Extension; |
| 28 } |
| 29 |
27 // Provides various utility functions that help manipulate tabs. | 30 // Provides various utility functions that help manipulate tabs. |
28 class ExtensionTabUtil { | 31 class ExtensionTabUtil { |
29 public: | 32 public: |
30 static int GetWindowId(const Browser* browser); | 33 static int GetWindowId(const Browser* browser); |
31 static int GetWindowIdOfTabStripModel(const TabStripModel* tab_strip_model); | 34 static int GetWindowIdOfTabStripModel(const TabStripModel* tab_strip_model); |
32 static int GetTabId(const content::WebContents* web_contents); | 35 static int GetTabId(const content::WebContents* web_contents); |
33 static bool GetTabIdFromArgument(const base::ListValue &args, | 36 static bool GetTabIdFromArgument(const base::ListValue &args, |
34 int argument_index, | 37 int argument_index, |
35 int *tab_id, std::string* error_message); | 38 int *tab_id, std::string* error_message); |
36 static std::string GetTabStatusText(bool is_loading); | 39 static std::string GetTabStatusText(bool is_loading); |
(...skipping 27 matching lines...) Expand all Loading... |
64 | 67 |
65 // Takes |url_string| and returns a GURL which is either valid and absolute | 68 // Takes |url_string| and returns a GURL which is either valid and absolute |
66 // or invalid. If |url_string| is not directly interpretable as a valid (it is | 69 // or invalid. If |url_string| is not directly interpretable as a valid (it is |
67 // likely a relative URL) an attempt is made to resolve it. |extension| is | 70 // likely a relative URL) an attempt is made to resolve it. |extension| is |
68 // provided so it can be resolved relative to its extension base | 71 // provided so it can be resolved relative to its extension base |
69 // (chrome-extension://<id>/). Using the source frame url would be more | 72 // (chrome-extension://<id>/). Using the source frame url would be more |
70 // correct, but because the api shipped with urls resolved relative to their | 73 // correct, but because the api shipped with urls resolved relative to their |
71 // extension base, we decided it wasn't worth breaking existing extensions to | 74 // extension base, we decided it wasn't worth breaking existing extensions to |
72 // fix. | 75 // fix. |
73 static GURL ResolvePossiblyRelativeURL(const std::string& url_string, | 76 static GURL ResolvePossiblyRelativeURL(const std::string& url_string, |
74 const Extension* extension); | 77 const extensions::Extension* extension); |
75 | 78 |
76 // Returns true if |url| is used for testing crashes. | 79 // Returns true if |url| is used for testing crashes. |
77 static bool IsCrashURL(const GURL& url); | 80 static bool IsCrashURL(const GURL& url); |
78 }; | 81 }; |
79 | 82 |
80 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_TAB_UTIL_H__ | 83 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_TAB_UTIL_H__ |
OLD | NEW |