OLD | NEW |
---|---|
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_CHROME_EXTENSION_FUNCTION_DETAILS_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_CHROME_EXTENSION_FUNCTION_DETAILS_H_ |
6 #define CHROME_BROWSER_EXTENSIONS_CHROME_EXTENSION_FUNCTION_DETAILS_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_CHROME_EXTENSION_FUNCTION_DETAILS_H_ |
7 | 7 |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "ui/gfx/native_widget_types.h" | |
9 | 10 |
10 class Browser; | 11 class Browser; |
11 class Profile; | 12 class Profile; |
12 class UIThreadExtensionFunction; | 13 class UIThreadExtensionFunction; |
13 | 14 |
14 namespace content { | 15 namespace content { |
15 class WebContents; | 16 class WebContents; |
16 } | 17 } |
17 | 18 |
18 namespace extensions { | 19 namespace extensions { |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
50 // TODO(stevenjb): Replace this with GetExtensionWindowController(). | 51 // TODO(stevenjb): Replace this with GetExtensionWindowController(). |
51 Browser* GetCurrentBrowser() const; | 52 Browser* GetCurrentBrowser() const; |
52 | 53 |
53 // Same as above but uses WindowControllerList instead of BrowserList. | 54 // Same as above but uses WindowControllerList instead of BrowserList. |
54 extensions::WindowController* GetExtensionWindowController() const; | 55 extensions::WindowController* GetExtensionWindowController() const; |
55 | 56 |
56 // Gets the "current" web contents if any. If there is no associated web | 57 // Gets the "current" web contents if any. If there is no associated web |
57 // contents then defaults to the foremost one. | 58 // contents then defaults to the foremost one. |
58 content::WebContents* GetAssociatedWebContents(); | 59 content::WebContents* GetAssociatedWebContents(); |
59 | 60 |
61 // Gets the web contents where the function is originated. This will return | |
62 // the sender's web contents if it's not from a background page. Otherwise | |
63 // this method will try to find the web contents from source_tab_id if it's | |
64 // not TabStripModel::kNoTab, or find the app's web contents by the extension | |
65 // id. If the web contents still can't be found, NULL will be returned. | |
66 content::WebContents* GetOriginWebContents(); | |
not at google - send to devlin
2015/07/10 22:52:48
I like it.
| |
67 | |
68 // Find a UI surface to display any UI (like a permission prompt) for the | |
69 // extension calling this function. If the origin's window can't be found, | |
70 // the browser's window will be returned. | |
71 gfx::NativeWindow GetNativeWindowForUI(); | |
72 | |
60 // Returns a pointer to the associated UIThreadExtensionFunction | 73 // Returns a pointer to the associated UIThreadExtensionFunction |
61 UIThreadExtensionFunction* function() { return function_; } | 74 UIThreadExtensionFunction* function() { return function_; } |
62 const UIThreadExtensionFunction* function() const { return function_; } | 75 const UIThreadExtensionFunction* function() const { return function_; } |
63 | 76 |
64 private: | 77 private: |
65 // The function for which these details have been created. Must outlive the | 78 // The function for which these details have been created. Must outlive the |
66 // ChromeExtensionFunctionDetails instance. | 79 // ChromeExtensionFunctionDetails instance. |
67 UIThreadExtensionFunction* function_; | 80 UIThreadExtensionFunction* function_; |
68 | 81 |
69 DISALLOW_COPY_AND_ASSIGN(ChromeExtensionFunctionDetails); | 82 DISALLOW_COPY_AND_ASSIGN(ChromeExtensionFunctionDetails); |
70 }; | 83 }; |
71 | 84 |
72 #endif // CHROME_BROWSER_EXTENSIONS_CHROME_EXTENSION_FUNCTION_DETAILS_H_ | 85 #endif // CHROME_BROWSER_EXTENSIONS_CHROME_EXTENSION_FUNCTION_DETAILS_H_ |
OLD | NEW |