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

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

Issue 3389012: Revert 59641 - Add the onBeforeNavigate and onErrorOccured events to the webN... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 10 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/extensions/extension_webnavigation_api.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 // Defines the Chrome Extensions WebNavigation API functions for observing and 5 // Defines the Chrome Extensions WebNavigation API functions for observing and
6 // intercepting navigation events, as specified in 6 // intercepting navigation events, as specified in
7 // chrome/common/extensions/api/extension_api.json. 7 // chrome/common/extensions/api/extension_api.json.
8 8
9 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_WEBNAVIGATION_API_H_ 9 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_WEBNAVIGATION_API_H_
10 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_WEBNAVIGATION_API_H_ 10 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_WEBNAVIGATION_API_H_
11 #pragma once 11 #pragma once
12 12
13 #include "base/singleton.h" 13 #include "base/singleton.h"
14 #include "chrome/browser/extensions/extension_function.h" 14 #include "chrome/browser/extensions/extension_function.h"
15 #include "chrome/common/notification_observer.h" 15 #include "chrome/browser/tab_contents/navigation_controller.h"
16 #include "chrome/common/notification_registrar.h" 16 #include "chrome/common/notification_registrar.h"
17 #include "googleurl/src/gurl.h" 17 #include "googleurl/src/gurl.h"
18 18
19 class NavigationController;
20 class ProvisionalLoadDetails;
21
22 // Observes navigation notifications and routes them as events to the extension 19 // Observes navigation notifications and routes them as events to the extension
23 // system. 20 // system.
24 class ExtensionWebNavigationEventRouter : public NotificationObserver { 21 class ExtensionWebNavigationEventRouter : public NotificationObserver {
25 public: 22 public:
26 // Single instance of the event router. 23 // Single instance of the event router.
27 static ExtensionWebNavigationEventRouter* GetInstance(); 24 static ExtensionWebNavigationEventRouter* GetInstance();
28 25
29 void Init(); 26 void Init();
30 27
31 private: 28 private:
32 friend struct DefaultSingletonTraits<ExtensionWebNavigationEventRouter>; 29 friend struct DefaultSingletonTraits<ExtensionWebNavigationEventRouter>;
33 30
34 ExtensionWebNavigationEventRouter() {} 31 ExtensionWebNavigationEventRouter() {}
35 virtual ~ExtensionWebNavigationEventRouter() {} 32 virtual ~ExtensionWebNavigationEventRouter() {}
36 33
37 // NotificationObserver implementation. 34 // NotificationObserver implementation.
38 virtual void Observe(NotificationType type, 35 virtual void Observe(NotificationType type,
39 const NotificationSource& source, 36 const NotificationSource& source,
40 const NotificationDetails& details); 37 const NotificationDetails& details);
41 38
42 // Handler for the FRAME_PROVISIONAL_LOAD_START event. The method takes the 39 // Handler for the NAV_ENTRY_COMMITTED event. The method takes the details of
43 // details of such an event and constructs a suitable JSON formatted extension 40 // such an event and constructs a suitable JSON formatted extension event
44 // event from it. 41 // from it.
45 void FrameProvisionalLoadStart(NavigationController* controller, 42 void NavEntryCommitted(NavigationController* controller,
46 ProvisionalLoadDetails* details); 43 NavigationController::LoadCommittedDetails* details);
47
48 // Handler for the FRAME_PROVISIONAL_LOAD_COMMITTED event. The method takes
49 // the details of such an event and constructs a suitable JSON formatted
50 // extension event from it.
51 void FrameProvisionalLoadCommitted(NavigationController* controller,
52 ProvisionalLoadDetails* details);
53
54 // Handler for the FAIL_PROVISIONAL_LOAD_WITH_ERROR event. The method takes
55 // the details of such an event and constructs a suitable JSON formatted
56 // extension event from it.
57 void FailProvisionalLoadWithError(NavigationController* controller,
58 ProvisionalLoadDetails* details);
59 44
60 // This method dispatches events to the extension message service. 45 // This method dispatches events to the extension message service.
61 void DispatchEvent(Profile* context, 46 void DispatchEvent(Profile* context,
62 const char* event_name, 47 const char* event_name,
63 const std::string& json_args); 48 const std::string& json_args);
64 49
65 // Used for tracking registrations to navigation notifications. 50 // Used for tracking registrations to navigation notifications.
66 NotificationRegistrar registrar_; 51 NotificationRegistrar registrar_;
67 52
68 DISALLOW_COPY_AND_ASSIGN(ExtensionWebNavigationEventRouter); 53 DISALLOW_COPY_AND_ASSIGN(ExtensionWebNavigationEventRouter);
69 }; 54 };
70 55
71 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_WEBNAVIGATION_API_H_ 56 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_WEBNAVIGATION_API_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/extensions/extension_webnavigation_api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698