| 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 GURL; | 12 class GURL; |
| 13 class Profile; | 13 class Profile; |
| 14 class TabContents; | 14 class TabContents; |
| 15 typedef TabContents 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 } |
| (...skipping 23 matching lines...) Expand all Loading... |
| 49 // Create a tab value, overriding its kSelectedKey to the provided boolean. | 48 // Create a tab value, overriding its kSelectedKey to the provided boolean. |
| 50 static base::DictionaryValue* CreateTabValueActive( | 49 static base::DictionaryValue* CreateTabValueActive( |
| 51 const content::WebContents* web_contents, | 50 const content::WebContents* web_contents, |
| 52 bool active); | 51 bool active); |
| 53 | 52 |
| 54 // Gets the |tab_strip_model| and |tab_index| for the given |web_contents|. | 53 // Gets the |tab_strip_model| and |tab_index| for the given |web_contents|. |
| 55 static bool GetTabStripModel(const content::WebContents* web_contents, | 54 static bool GetTabStripModel(const content::WebContents* web_contents, |
| 56 TabStripModel** tab_strip_model, | 55 TabStripModel** tab_strip_model, |
| 57 int* tab_index); | 56 int* tab_index); |
| 58 static bool GetDefaultTab(Browser* browser, | 57 static bool GetDefaultTab(Browser* browser, |
| 59 TabContentsWrapper** contents, | 58 TabContents** contents, |
| 60 int* tab_id); | 59 int* tab_id); |
| 61 // Any out parameter (|browser|, |tab_strip|, |contents|, & |tab_index|) may | 60 // Any out parameter (|browser|, |tab_strip|, |contents|, & |tab_index|) may |
| 62 // be NULL and will not be set within the function. | 61 // be NULL and will not be set within the function. |
| 63 static bool GetTabById(int tab_id, Profile* profile, bool incognito_enabled, | 62 static bool GetTabById(int tab_id, Profile* profile, bool incognito_enabled, |
| 64 Browser** browser, | 63 Browser** browser, |
| 65 TabStripModel** tab_strip, | 64 TabStripModel** tab_strip, |
| 66 TabContentsWrapper** contents, | 65 TabContents** contents, |
| 67 int* tab_index); | 66 int* tab_index); |
| 68 | 67 |
| 69 // 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 |
| 70 // 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 |
| 71 // 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 |
| 72 // provided so it can be resolved relative to its extension base | 71 // provided so it can be resolved relative to its extension base |
| 73 // (chrome-extension://<id>/). Using the source frame url would be more | 72 // (chrome-extension://<id>/). Using the source frame url would be more |
| 74 // 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 |
| 75 // 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 |
| 76 // fix. | 75 // fix. |
| 77 static GURL ResolvePossiblyRelativeURL(const std::string& url_string, | 76 static GURL ResolvePossiblyRelativeURL(const std::string& url_string, |
| 78 const extensions::Extension* extension); | 77 const extensions::Extension* extension); |
| 79 | 78 |
| 80 // Returns true if |url| is used for testing crashes. | 79 // Returns true if |url| is used for testing crashes. |
| 81 static bool IsCrashURL(const GURL& url); | 80 static bool IsCrashURL(const GURL& url); |
| 82 }; | 81 }; |
| 83 | 82 |
| 84 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_TAB_UTIL_H__ | 83 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_TAB_UTIL_H__ |
| OLD | NEW |