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

Side by Side Diff: chrome/browser/extensions/api/web_navigation/web_navigation_api.h

Issue 10835033: Only delete old frames when a new main frame navigation commits (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: updates 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 | Annotate | Revision Log
OLDNEW
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 // 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 the extension JSON API. 6 // intercepting navigation events, as specified in the extension JSON API.
7 7
8 #ifndef CHROME_BROWSER_EXTENSIONS_API_WEB_NAVIGATION_WEB_NAVIGATION_API_H_ 8 #ifndef CHROME_BROWSER_EXTENSIONS_API_WEB_NAVIGATION_WEB_NAVIGATION_API_H_
9 #define CHROME_BROWSER_EXTENSIONS_API_WEB_NAVIGATION_WEB_NAVIGATION_API_H_ 9 #define CHROME_BROWSER_EXTENSIONS_API_WEB_NAVIGATION_WEB_NAVIGATION_API_H_
10 10
(...skipping 22 matching lines...) Expand all
33 explicit WebNavigationTabObserver(content::WebContents* web_contents); 33 explicit WebNavigationTabObserver(content::WebContents* web_contents);
34 virtual ~WebNavigationTabObserver(); 34 virtual ~WebNavigationTabObserver();
35 35
36 // Returns the object for the given |tab_contents|. 36 // Returns the object for the given |tab_contents|.
37 static WebNavigationTabObserver* Get(content::WebContents* web_contents); 37 static WebNavigationTabObserver* Get(content::WebContents* web_contents);
38 38
39 const FrameNavigationState& frame_navigation_state() const { 39 const FrameNavigationState& frame_navigation_state() const {
40 return navigation_state_; 40 return navigation_state_;
41 } 41 }
42 42
43 content::RenderViewHost* GetRenderViewHostInProcess(int process_id) const;
44
43 // content::NotificationObserver implementation. 45 // content::NotificationObserver implementation.
44 virtual void Observe(int type, 46 virtual void Observe(int type,
45 const content::NotificationSource& source, 47 const content::NotificationSource& source,
46 const content::NotificationDetails& details) OVERRIDE; 48 const content::NotificationDetails& details) OVERRIDE;
47 49
48 50
49 // content::WebContentsObserver implementation. 51 // content::WebContentsObserver implementation.
50 virtual void AboutToNavigateRenderView( 52 virtual void AboutToNavigateRenderView(
51 content::RenderViewHost* render_view_host) OVERRIDE; 53 content::RenderViewHost* render_view_host) OVERRIDE;
52 virtual void DidStartProvisionalLoadForFrame( 54 virtual void DidStartProvisionalLoadForFrame(
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 content::PageTransition transition, 92 content::PageTransition transition,
91 int64 source_frame_num) OVERRIDE; 93 int64 source_frame_num) OVERRIDE;
92 virtual void WebContentsDestroyed(content::WebContents* tab) OVERRIDE; 94 virtual void WebContentsDestroyed(content::WebContents* tab) OVERRIDE;
93 95
94 private: 96 private:
95 // True if the transition and target url correspond to a reference fragment 97 // True if the transition and target url correspond to a reference fragment
96 // navigation. 98 // navigation.
97 bool IsReferenceFragmentNavigation(FrameNavigationState::FrameID frame_id, 99 bool IsReferenceFragmentNavigation(FrameNavigationState::FrameID frame_id,
98 const GURL& url); 100 const GURL& url);
99 101
102 // Creates and sends onErrorOccurred events for all on-going navigations. If
103 // |render_view_host| is non-NULL, only generates events for frames in this
104 // render view host.
105 void SendErrorEvents(content::WebContents* web_contents,
106 content::RenderViewHost* render_view_host);
107
100 // Tracks the state of the frames we are sending events for. 108 // Tracks the state of the frames we are sending events for.
101 FrameNavigationState navigation_state_; 109 FrameNavigationState navigation_state_;
102 110
103 // Used for tracking registrations to redirect notifications. 111 // Used for tracking registrations to redirect notifications.
104 content::NotificationRegistrar registrar_; 112 content::NotificationRegistrar registrar_;
105 113
106 content::RenderViewHost* render_view_host_; 114 content::RenderViewHost* render_view_host_;
107 content::RenderViewHost* pending_render_view_host_; 115 content::RenderViewHost* pending_render_view_host_;
108 116
109 DISALLOW_COPY_AND_ASSIGN(WebNavigationTabObserver); 117 DISALLOW_COPY_AND_ASSIGN(WebNavigationTabObserver);
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 // API function that returns the states of all frames in a given tab. 199 // API function that returns the states of all frames in a given tab.
192 class GetAllFramesFunction : public SyncExtensionFunction { 200 class GetAllFramesFunction : public SyncExtensionFunction {
193 virtual ~GetAllFramesFunction() {} 201 virtual ~GetAllFramesFunction() {}
194 virtual bool RunImpl() OVERRIDE; 202 virtual bool RunImpl() OVERRIDE;
195 DECLARE_EXTENSION_FUNCTION_NAME("webNavigation.getAllFrames") 203 DECLARE_EXTENSION_FUNCTION_NAME("webNavigation.getAllFrames")
196 }; 204 };
197 205
198 } // namespace extensions 206 } // namespace extensions
199 207
200 #endif // CHROME_BROWSER_EXTENSIONS_API_WEB_NAVIGATION_WEB_NAVIGATION_API_H_ 208 #endif // CHROME_BROWSER_EXTENSIONS_API_WEB_NAVIGATION_WEB_NAVIGATION_API_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698