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_NAVIGATION_OBSERVER_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_NAVIGATION_OBSERVER_H_ |
6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_NAVIGATION_OBSERVER_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_NAVIGATION_OBSERVER_H_ |
7 | 7 |
8 #include <set> | 8 #include <set> |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
12 #include "chrome/browser/extensions/extension_install_prompt.h" | 12 #include "chrome/browser/extensions/extension_install_prompt.h" |
13 #include "content/public/browser/notification_registrar.h" | 13 #include "content/public/browser/notification_registrar.h" |
14 | 14 |
15 class Profile; | 15 class Profile; |
16 | 16 |
17 namespace content { | 17 namespace content { |
18 class NavigationController; | 18 class NavigationController; |
19 } | 19 } |
20 | 20 |
21 // The ExtensionNavigationObserver listens to navigation notifications. If the | 21 namespace extensions { |
22 // user navigates into an extension that has been disabled due to a permission | 22 |
| 23 // The NavigationObserver listens to navigation notifications. If the user |
| 24 // navigates into an extension that has been disabled due to a permission |
23 // increase, it prompts the user to accept the new permissions and re-enables | 25 // increase, it prompts the user to accept the new permissions and re-enables |
24 // the extension. | 26 // the extension. |
25 class ExtensionNavigationObserver : public ExtensionInstallPrompt::Delegate, | 27 class NavigationObserver : public ExtensionInstallPrompt::Delegate, |
26 public content::NotificationObserver { | 28 public content::NotificationObserver { |
27 public: | 29 public: |
28 explicit ExtensionNavigationObserver(Profile* profile); | 30 explicit NavigationObserver(Profile* profile); |
29 virtual ~ExtensionNavigationObserver(); | 31 virtual ~NavigationObserver(); |
30 | 32 |
31 // content::NotificationObserver | 33 // content::NotificationObserver |
32 virtual void Observe(int type, | 34 virtual void Observe(int type, |
33 const content::NotificationSource& source, | 35 const content::NotificationSource& source, |
34 const content::NotificationDetails& details) OVERRIDE; | 36 const content::NotificationDetails& details) OVERRIDE; |
35 private: | 37 private: |
36 // Registers for the NOTIFICATION_NAV_ENTRY_COMMITTED notification. | 38 // Registers for the NOTIFICATION_NAV_ENTRY_COMMITTED notification. |
37 void RegisterForNotifications(); | 39 void RegisterForNotifications(); |
38 | 40 |
39 // Checks if |nav_controller| has entered an extension's web extent. If it | 41 // Checks if |nav_controller| has entered an extension's web extent. If it |
(...skipping 12 matching lines...) Expand all Loading... |
52 | 54 |
53 // The UI used to confirm enabling extensions. | 55 // The UI used to confirm enabling extensions. |
54 scoped_ptr<ExtensionInstallPrompt> extension_install_prompt_; | 56 scoped_ptr<ExtensionInstallPrompt> extension_install_prompt_; |
55 | 57 |
56 // The data we keep track of when prompting to enable extensions. | 58 // The data we keep track of when prompting to enable extensions. |
57 std::string in_progress_prompt_extension_id_; | 59 std::string in_progress_prompt_extension_id_; |
58 content::NavigationController* in_progress_prompt_navigation_controller_; | 60 content::NavigationController* in_progress_prompt_navigation_controller_; |
59 | 61 |
60 // The extension ids we've already prompted the user about. | 62 // The extension ids we've already prompted the user about. |
61 std::set<std::string> prompted_extensions_; | 63 std::set<std::string> prompted_extensions_; |
| 64 |
| 65 DISALLOW_COPY_AND_ASSIGN(NavigationObserver); |
62 }; | 66 }; |
63 | 67 |
64 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_NAVIGATION_OBSERVER_H_ | 68 } // namespace extensions |
| 69 |
| 70 #endif // CHROME_BROWSER_EXTENSIONS_NAVIGATION_OBSERVER_H_ |
OLD | NEW |