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

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

Issue 2521363002: [Extensions] Remove ChromeExtensionFunctionDetails::GetOriginWebContents (Closed)
Patch Set: lazyboy's Created 4 years 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 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 #include "ui/gfx/native_widget_types.h"
10 10
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 // TODO(stevenjb): Replace this with GetExtensionWindowController(). 51 // TODO(stevenjb): Replace this with GetExtensionWindowController().
52 Browser* GetCurrentBrowser() const; 52 Browser* GetCurrentBrowser() const;
53 53
54 // Same as above but uses WindowControllerList instead of BrowserList. 54 // Same as above but uses WindowControllerList instead of BrowserList.
55 extensions::WindowController* GetExtensionWindowController() const; 55 extensions::WindowController* GetExtensionWindowController() const;
56 56
57 // 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
58 // contents then defaults to the foremost one. 58 // contents then defaults to the foremost one.
59 content::WebContents* GetAssociatedWebContents(); 59 content::WebContents* GetAssociatedWebContents();
60 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();
67
68 // Find a UI surface to display any UI (like a permission prompt) for the 61 // 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, 62 // extension calling this function. This will check, in order of preference,
70 // the browser's window will be returned. 63 // - The current window for the function (as defined by
64 // WindowControllerList::CurrentWindowForFunction()),
65 // - The sender web contents
66 // - Open app windows
67 // - A browser with the same profile
71 gfx::NativeWindow GetNativeWindowForUI(); 68 gfx::NativeWindow GetNativeWindowForUI();
72 69
73 // Returns a pointer to the associated UIThreadExtensionFunction 70 // Returns a pointer to the associated UIThreadExtensionFunction
74 UIThreadExtensionFunction* function() { return function_; } 71 UIThreadExtensionFunction* function() { return function_; }
75 const UIThreadExtensionFunction* function() const { return function_; } 72 const UIThreadExtensionFunction* function() const { return function_; }
76 73
77 private: 74 private:
78 // The function for which these details have been created. Must outlive the 75 // The function for which these details have been created. Must outlive the
79 // ChromeExtensionFunctionDetails instance. 76 // ChromeExtensionFunctionDetails instance.
80 UIThreadExtensionFunction* function_; 77 UIThreadExtensionFunction* function_;
81 78
82 DISALLOW_COPY_AND_ASSIGN(ChromeExtensionFunctionDetails); 79 DISALLOW_COPY_AND_ASSIGN(ChromeExtensionFunctionDetails);
83 }; 80 };
84 81
85 #endif // CHROME_BROWSER_EXTENSIONS_CHROME_EXTENSION_FUNCTION_DETAILS_H_ 82 #endif // CHROME_BROWSER_EXTENSIONS_CHROME_EXTENSION_FUNCTION_DETAILS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698