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

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

Issue 10824204: Move small c/b/extensions classes into extensions namespace no.2 (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Latest master for cq + nitfix Created 8 years, 4 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 (c) 2012 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_EXTENSION_NAVIGATION_OBSERVER_H_
6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_NAVIGATION_OBSERVER_H_
7
8 #include <set>
9 #include <string>
10
11 #include "base/memory/scoped_ptr.h"
12 #include "chrome/browser/extensions/extension_install_prompt.h"
13 #include "content/public/browser/notification_registrar.h"
14
15 class Profile;
16
17 namespace content {
18 class NavigationController;
19 }
20
21 // The ExtensionNavigationObserver listens to navigation notifications. If the
22 // user 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
24 // the extension.
25 class ExtensionNavigationObserver : public ExtensionInstallPrompt::Delegate,
26 public content::NotificationObserver {
27 public:
28 explicit ExtensionNavigationObserver(Profile* profile);
29 virtual ~ExtensionNavigationObserver();
30
31 // content::NotificationObserver
32 virtual void Observe(int type,
33 const content::NotificationSource& source,
34 const content::NotificationDetails& details) OVERRIDE;
35 private:
36 // Registers for the NOTIFICATION_NAV_ENTRY_COMMITTED notification.
37 void RegisterForNotifications();
38
39 // Checks if |nav_controller| has entered an extension's web extent. If it
40 // has and the extension is disabled due to a permissions increase, this
41 // prompts the user to accept the new permissions and enables the extension.
42 void PromptToEnableExtensionIfNecessary(
43 content::NavigationController* nav_controller);
44
45 // ExtensionInstallPrompt::Delegate callbacks used for the permissions prompt.
46 virtual void InstallUIProceed() OVERRIDE;
47 virtual void InstallUIAbort(bool user_initiated) OVERRIDE;
48
49 content::NotificationRegistrar registrar_;
50
51 Profile* profile_;
52
53 // The UI used to confirm enabling extensions.
54 scoped_ptr<ExtensionInstallPrompt> extension_install_prompt_;
55
56 // The data we keep track of when prompting to enable extensions.
57 std::string in_progress_prompt_extension_id_;
58 content::NavigationController* in_progress_prompt_navigation_controller_;
59
60 // The extension ids we've already prompted the user about.
61 std::set<std::string> prompted_extensions_;
62 };
63
64 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_NAVIGATION_OBSERVER_H_
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_data_deleter.cc ('k') | chrome/browser/extensions/extension_navigation_observer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698