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 <set> | 8 #include <set> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 16 matching lines...) Expand all Loading... |
27 // the extension. | 27 // the extension. |
28 class NavigationObserver : public ExtensionInstallPrompt::Delegate, | 28 class NavigationObserver : public ExtensionInstallPrompt::Delegate, |
29 public content::NotificationObserver { | 29 public content::NotificationObserver { |
30 public: | 30 public: |
31 explicit NavigationObserver(Profile* profile); | 31 explicit NavigationObserver(Profile* profile); |
32 virtual ~NavigationObserver(); | 32 virtual ~NavigationObserver(); |
33 | 33 |
34 // content::NotificationObserver | 34 // content::NotificationObserver |
35 virtual void Observe(int type, | 35 virtual void Observe(int type, |
36 const content::NotificationSource& source, | 36 const content::NotificationSource& source, |
37 const content::NotificationDetails& details) OVERRIDE; | 37 const content::NotificationDetails& details) override; |
38 private: | 38 private: |
39 // Registers for the NOTIFICATION_NAV_ENTRY_COMMITTED notification. | 39 // Registers for the NOTIFICATION_NAV_ENTRY_COMMITTED notification. |
40 void RegisterForNotifications(); | 40 void RegisterForNotifications(); |
41 | 41 |
42 // Checks if |nav_controller| has entered an extension's web extent. If it | 42 // Checks if |nav_controller| has entered an extension's web extent. If it |
43 // has and the extension is disabled due to a permissions increase, this | 43 // has and the extension is disabled due to a permissions increase, this |
44 // prompts the user to accept the new permissions and enables the extension. | 44 // prompts the user to accept the new permissions and enables the extension. |
45 void PromptToEnableExtensionIfNecessary( | 45 void PromptToEnableExtensionIfNecessary( |
46 content::NavigationController* nav_controller); | 46 content::NavigationController* nav_controller); |
47 | 47 |
48 // ExtensionInstallPrompt::Delegate callbacks used for the permissions prompt. | 48 // ExtensionInstallPrompt::Delegate callbacks used for the permissions prompt. |
49 virtual void InstallUIProceed() OVERRIDE; | 49 virtual void InstallUIProceed() override; |
50 virtual void InstallUIAbort(bool user_initiated) OVERRIDE; | 50 virtual void InstallUIAbort(bool user_initiated) override; |
51 | 51 |
52 content::NotificationRegistrar registrar_; | 52 content::NotificationRegistrar registrar_; |
53 | 53 |
54 Profile* profile_; | 54 Profile* profile_; |
55 | 55 |
56 // The UI used to confirm enabling extensions. | 56 // The UI used to confirm enabling extensions. |
57 scoped_ptr<ExtensionInstallPrompt> extension_install_prompt_; | 57 scoped_ptr<ExtensionInstallPrompt> extension_install_prompt_; |
58 | 58 |
59 // The data we keep track of when prompting to enable extensions. | 59 // The data we keep track of when prompting to enable extensions. |
60 std::string in_progress_prompt_extension_id_; | 60 std::string in_progress_prompt_extension_id_; |
61 content::NavigationController* in_progress_prompt_navigation_controller_; | 61 content::NavigationController* in_progress_prompt_navigation_controller_; |
62 | 62 |
63 // The extension ids we've already prompted the user about. | 63 // The extension ids we've already prompted the user about. |
64 std::set<std::string> prompted_extensions_; | 64 std::set<std::string> prompted_extensions_; |
65 | 65 |
66 DISALLOW_COPY_AND_ASSIGN(NavigationObserver); | 66 DISALLOW_COPY_AND_ASSIGN(NavigationObserver); |
67 }; | 67 }; |
68 | 68 |
69 } // namespace extensions | 69 } // namespace extensions |
70 | 70 |
71 #endif // CHROME_BROWSER_EXTENSIONS_NAVIGATION_OBSERVER_H_ | 71 #endif // CHROME_BROWSER_EXTENSIONS_NAVIGATION_OBSERVER_H_ |
OLD | NEW |