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

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

Issue 543873002: Add ChromeExtensionFunctionDetails (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 months 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_EXTENSIONS_CHROME_EXTENSION_FUNCTION_DETAILS_H_
6 #define CHROME_BROWSER_EXTENSIONS_CHROME_EXTENSION_FUNCTION_DETAILS_H_
7
8 #include "base/macros.h"
9
10 class Browser;
11 class Profile;
12 class UIThreadExtensionFunction;
13
14 namespace content {
15 class WebContents;
16 }
17
18 namespace extensions {
19 class WindowController;
20 } // namespace extensions
21
22 // Provides Chrome-specific details to UIThreadExtensionFunction
23 // implementations.
24 class ChromeExtensionFunctionDetails {
25 public:
26 // Constructs a new ChromeExtensionFunctionDetails instance for |function|.
27 // This instance does not own |function| and must outlive it.
28 explicit ChromeExtensionFunctionDetails(UIThreadExtensionFunction* function);
29 ~ChromeExtensionFunctionDetails();
30
31 Profile* GetProfile() const;
32
33 // Returns true if this function (and the profile and extension that it was
34 // invoked from) can operate on the window wrapped by |window_controller|.
35 bool CanOperateOnWindow(
36 const extensions::WindowController* window_controller) const;
37
38 // Gets the "current" browser, if any.
39 //
40 // Many extension APIs operate relative to the current browser, which is the
41 // browser the calling code is running inside of. For example, popups, tabs,
42 // and infobars all have a containing browser, but background pages and
43 // notification bubbles do not.
44 //
45 // If there is no containing window, the current browser defaults to the
46 // foremost one.
47 //
48 // Incognito browsers are not considered unless the calling extension has
49 // incognito access enabled.
50 //
51 // This method can return NULL if there is no matching browser, which can
52 // happen if only incognito windows are open, or early in startup or shutdown
53 // shutdown when there are no active windows.
54 //
55 // TODO(stevenjb): Replace this with GetExtensionWindowController().
56 Browser* GetCurrentBrowser() const;
57
58 // Same as above but uses WindowControllerList instead of BrowserList.
59 extensions::WindowController* GetExtensionWindowController() const;
60
61 // Gets the "current" web contents if any. If there is no associated web
62 // contents then defaults to the foremost one.
63 content::WebContents* GetAssociatedWebContents();
64
65 private:
66 // The function for which these details have been created. Must outlive the
67 // ChromeExtensionFunctionDetails instance.
68 UIThreadExtensionFunction* function_;
69
70 DISALLOW_COPY_AND_ASSIGN(ChromeExtensionFunctionDetails);
71 };
72
73 #endif // CHROME_BROWSER_EXTENSIONS_CHROME_EXTENSION_FUNCTION_DETAILS_H_
OLDNEW
« no previous file with comments | « chrome/browser/extensions/chrome_extension_function.cc ('k') | chrome/browser/extensions/chrome_extension_function_details.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698