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

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

Issue 6363002: Implement the onBeforeRetarget event of the webNavigation API (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: updates Created 9 years, 11 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 <map> 13 #include <map>
14 14
15 #include "base/singleton.h" 15 #include "base/singleton.h"
16 #include "chrome/browser/extensions/extension_function.h" 16 #include "chrome/browser/extensions/extension_function.h"
17 #include "chrome/common/notification_observer.h" 17 #include "chrome/common/notification_observer.h"
18 #include "chrome/common/notification_registrar.h" 18 #include "chrome/common/notification_registrar.h"
19 #include "googleurl/src/gurl.h" 19 #include "googleurl/src/gurl.h"
20 20
21 class NavigationController; 21 class NavigationController;
22 class ProvisionalLoadDetails; 22 class ProvisionalLoadDetails;
23 class TabContents; 23 class TabContents;
24 struct ViewHostMsg_CreateWindow_Params;
24 25
25 // Tracks the navigation state of all frames currently known to the 26 // Tracks the navigation state of all frames currently known to the
26 // webNavigation API. It is mainly used to track in which frames an error 27 // webNavigation API. It is mainly used to track in which frames an error
27 // occurred so no further events for this frame are being sent. 28 // occurred so no further events for this frame are being sent.
28 class FrameNavigationState { 29 class FrameNavigationState {
29 public: 30 public:
30 FrameNavigationState(); 31 FrameNavigationState();
31 ~FrameNavigationState(); 32 ~FrameNavigationState();
32 33
33 // True if navigation events for the given frame can be sent. 34 // True if navigation events for the given frame can be sent.
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 // Handler for the FRAME_DID_FINISH_LOAD event. The method takes the frame 115 // Handler for the FRAME_DID_FINISH_LOAD event. The method takes the frame
115 // ID and constructs a suitable JSON formatted extension event from it. 116 // ID and constructs a suitable JSON formatted extension event from it.
116 void FrameDidFinishLoad(NavigationController* controller, int64 frame_id); 117 void FrameDidFinishLoad(NavigationController* controller, int64 frame_id);
117 118
118 // Handler for the FAIL_PROVISIONAL_LOAD_WITH_ERROR event. The method takes 119 // Handler for the FAIL_PROVISIONAL_LOAD_WITH_ERROR event. The method takes
119 // the details of such an event and constructs a suitable JSON formatted 120 // the details of such an event and constructs a suitable JSON formatted
120 // extension event from it. 121 // extension event from it.
121 void FailProvisionalLoadWithError(NavigationController* controller, 122 void FailProvisionalLoadWithError(NavigationController* controller,
122 ProvisionalLoadDetails* details); 123 ProvisionalLoadDetails* details);
123 124
125 // Handler for the CREATING_NEW_WINDOW event. The method takes the details of
126 // such an event and constructs a suitable JSON formatted extension event from
127 // it.
128 void CreatingNewWindow(TabContents* tab_content,
129 const ViewHostMsg_CreateWindow_Params* details);
130
124 // Dispatches events to the extension message service. 131 // Dispatches events to the extension message service.
125 void DispatchEvent(Profile* context, 132 void DispatchEvent(Profile* context,
126 const char* event_name, 133 const char* event_name,
127 const std::string& json_args); 134 const std::string& json_args);
128 135
129 // Tracks the state of the frames we are sending events for. 136 // Tracks the state of the frames we are sending events for.
130 FrameNavigationState navigation_state_; 137 FrameNavigationState navigation_state_;
131 138
132 // Used for tracking registrations to navigation notifications. 139 // Used for tracking registrations to navigation notifications.
133 NotificationRegistrar registrar_; 140 NotificationRegistrar registrar_;
134 141
135 DISALLOW_COPY_AND_ASSIGN(ExtensionWebNavigationEventRouter); 142 DISALLOW_COPY_AND_ASSIGN(ExtensionWebNavigationEventRouter);
136 }; 143 };
137 144
138 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_WEBNAVIGATION_API_H_ 145 #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