| 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_NAVIGATION_OBSERVER_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_NAVIGATION_OBSERVER_H_ |
| 6 #define CHROME_BROWSER_EXTENSIONS_NAVIGATION_OBSERVER_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_NAVIGATION_OBSERVER_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <set> | 9 #include <set> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 public ExtensionRegistryObserver { | 33 public ExtensionRegistryObserver { |
| 34 public: | 34 public: |
| 35 explicit NavigationObserver(Profile* profile); | 35 explicit NavigationObserver(Profile* profile); |
| 36 ~NavigationObserver() override; | 36 ~NavigationObserver() override; |
| 37 | 37 |
| 38 // content::NotificationObserver | 38 // content::NotificationObserver |
| 39 void Observe(int type, | 39 void Observe(int type, |
| 40 const content::NotificationSource& source, | 40 const content::NotificationSource& source, |
| 41 const content::NotificationDetails& details) override; | 41 const content::NotificationDetails& details) override; |
| 42 | 42 |
| 43 // Allows showing the prompt for the same extensions multiple times in a |
| 44 // session. |
| 45 static void SetAllowedRepeatedPromptingForTesting(bool allowed); |
| 46 |
| 43 private: | 47 private: |
| 44 // Registers for the NOTIFICATION_NAV_ENTRY_COMMITTED notification. | 48 // Registers for the NOTIFICATION_NAV_ENTRY_COMMITTED notification. |
| 45 void RegisterForNotifications(); | 49 void RegisterForNotifications(); |
| 46 | 50 |
| 47 // Checks if |nav_controller| has entered an extension's web extent. If it | 51 // Checks if |nav_controller| has entered an extension's web extent. If it |
| 48 // has and the extension is disabled due to a permissions increase, this | 52 // has and the extension is disabled due to a permissions increase, this |
| 49 // prompts the user to accept the new permissions and enables the extension. | 53 // prompts the user to accept the new permissions and enables the extension. |
| 50 void PromptToEnableExtensionIfNecessary( | 54 void PromptToEnableExtensionIfNecessary( |
| 51 content::NavigationController* nav_controller); | 55 content::NavigationController* nav_controller); |
| 52 | 56 |
| (...skipping 22 matching lines...) Expand all Loading... |
| 75 extension_registry_observer_; | 79 extension_registry_observer_; |
| 76 | 80 |
| 77 base::WeakPtrFactory<NavigationObserver> weak_factory_; | 81 base::WeakPtrFactory<NavigationObserver> weak_factory_; |
| 78 | 82 |
| 79 DISALLOW_COPY_AND_ASSIGN(NavigationObserver); | 83 DISALLOW_COPY_AND_ASSIGN(NavigationObserver); |
| 80 }; | 84 }; |
| 81 | 85 |
| 82 } // namespace extensions | 86 } // namespace extensions |
| 83 | 87 |
| 84 #endif // CHROME_BROWSER_EXTENSIONS_NAVIGATION_OBSERVER_H_ | 88 #endif // CHROME_BROWSER_EXTENSIONS_NAVIGATION_OBSERVER_H_ |
| OLD | NEW |