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

Unified Diff: chrome/browser/extensions/extension_webnavigation_api.h

Issue 3307013: Implement the webNavigation.onCommitted event. (Closed)
Patch Set: updates 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/browser/extensions/extension_webnavigation_api.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/extension_webnavigation_api.h
diff --git a/chrome/browser/extensions/extension_webnavigation_api.h b/chrome/browser/extensions/extension_webnavigation_api.h
new file mode 100644
index 0000000000000000000000000000000000000000..77182e1590e6c72ca0f9dfd0e02059ef53f6f56e
--- /dev/null
+++ b/chrome/browser/extensions/extension_webnavigation_api.h
@@ -0,0 +1,56 @@
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Defines the Chrome Extensions WebNavigation API functions for observing and
+// intercepting navigation events, as specified in
+// chrome/common/extensions/api/extension_api.json.
+
+#ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_WEBNAVIGATION_API_H_
+#define CHROME_BROWSER_EXTENSIONS_EXTENSION_WEBNAVIGATION_API_H_
+#pragma once
+
+#include "base/singleton.h"
+#include "chrome/browser/extensions/extension_function.h"
+#include "chrome/browser/tab_contents/navigation_controller.h"
+#include "chrome/common/notification_registrar.h"
+#include "googleurl/src/gurl.h"
+
+// Observes navigation notifications and routes them as events to the extension
+// system.
+class ExtensionWebNavigationEventRouter : public NotificationObserver {
+ public:
+ // Single instance of the event router.
+ static ExtensionWebNavigationEventRouter* GetInstance();
+
+ void Init();
+
+ private:
+ friend struct DefaultSingletonTraits<ExtensionWebNavigationEventRouter>;
+
+ ExtensionWebNavigationEventRouter() {}
+ virtual ~ExtensionWebNavigationEventRouter() {}
+
+ // NotificationObserver implementation.
+ virtual void Observe(NotificationType type,
+ const NotificationSource& source,
+ const NotificationDetails& details);
+
+ // Handler for the NAV_ENTRY_COMMITTED event. The method takes the details of
+ // such an event and constructs a suitable JSON formatted extension event
+ // from it.
+ void NavEntryCommitted(NavigationController* controller,
+ NavigationController::LoadCommittedDetails* details);
+
+ // This method dispatches events to the extension message service.
+ void DispatchEvent(Profile* context,
+ const char* event_name,
+ const std::string& json_args);
+
+ // Used for tracking registrations to navigation notifications.
+ NotificationRegistrar registrar_;
+
+ DISALLOW_COPY_AND_ASSIGN(ExtensionWebNavigationEventRouter);
+};
+
+#endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_WEBNAVIGATION_API_H_
« 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