OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_API_MESSAGING_INCOGNITO_CONNECTABILITY_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_MESSAGING_INCOGNITO_CONNECTABILITY_H_ |
6 #define CHROME_BROWSER_EXTENSIONS_API_MESSAGING_INCOGNITO_CONNECTABILITY_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_API_MESSAGING_INCOGNITO_CONNECTABILITY_H_ |
7 | 7 |
8 #include <set> | 8 #include <set> |
9 | 9 |
10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
11 #include "extensions/browser/browser_context_keyed_api_factory.h" | 11 #include "extensions/browser/browser_context_keyed_api_factory.h" |
12 #include "url/gurl.h" | 12 #include "url/gurl.h" |
13 | 13 |
14 namespace content { | 14 namespace content { |
15 class BrowserContext; | 15 class BrowserContext; |
16 class WebContents; | 16 class WebContents; |
17 } | 17 } |
18 | 18 |
19 namespace infobars { | 19 namespace infobars { |
20 class InfoBar; | 20 class InfoBar; |
21 class InfoBarManager; | 21 class InfoBarManager; |
22 } | 22 } |
23 | 23 |
24 namespace extensions { | 24 namespace extensions { |
25 class Extension; | 25 class Extension; |
26 | 26 |
27 // Tracks the web connectability of domains to extensions in incognito mode. | 27 // Tracks the web connectability of domains to extensions in incognito mode. |
28 // | 28 // |
29 // The most important functionality is prompting the user to allow or disallow | 29 // The most important functionality is prompting the user to allow or disallow |
30 // connections from incognito tabs to extensions or apps. Even if an extension | 30 // connections from incognito tabs to extensions or apps. Users are not prompted |
31 // hasn't been enabled in incognito mode, it's still useful for web sites to be | 31 // for extensions which can be enabled in incognito mode. However for apps, it's |
32 // able to send messages to them, with user constent. For apps, it's essential | 32 // essential we have this functionality because there is no way for them to be |
33 // we have this functionality because there is no way for them to be enabled in | 33 // enabled in incognito. |
34 // incognito. | |
35 class IncognitoConnectability : public BrowserContextKeyedAPI { | 34 class IncognitoConnectability : public BrowserContextKeyedAPI { |
36 public: | 35 public: |
37 // While in scope, immediately either accepts or denies the alerts that show | 36 // While in scope, immediately either accepts or denies the alerts that show |
38 // up, and counts the number of times it was invoked. | 37 // up, and counts the number of times it was invoked. |
39 class ScopedAlertTracker { | 38 class ScopedAlertTracker { |
40 public: | 39 public: |
41 enum Mode { | 40 enum Mode { |
42 INTERACTIVE, | 41 INTERACTIVE, |
43 ALWAYS_ALLOW, | 42 ALWAYS_ALLOW, |
44 ALWAYS_DENY, | 43 ALWAYS_DENY, |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 // infobar and the set of callbacks (passed to Query) that will be called when | 124 // infobar and the set of callbacks (passed to Query) that will be called when |
126 // the query is resolved. | 125 // the query is resolved. |
127 PendingOriginMap pending_origins_; | 126 PendingOriginMap pending_origins_; |
128 | 127 |
129 base::WeakPtrFactory<IncognitoConnectability> weak_factory_; | 128 base::WeakPtrFactory<IncognitoConnectability> weak_factory_; |
130 }; | 129 }; |
131 | 130 |
132 } // namespace extensions | 131 } // namespace extensions |
133 | 132 |
134 #endif // CHROME_BROWSER_EXTENSIONS_API_MESSAGING_INCOGNITO_CONNECTABILITY_H_ | 133 #endif // CHROME_BROWSER_EXTENSIONS_API_MESSAGING_INCOGNITO_CONNECTABILITY_H_ |
OLD | NEW |