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

Side by Side Diff: content/browser/renderer_host/render_view_host_delegate.h

Issue 10542092: Refactor the content interface for RequestMediaAccessPermission. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: actually remove typedef Created 8 years, 6 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 #ifndef CONTENT_BROWSER_RENDERER_HOST_RENDER_VIEW_HOST_DELEGATE_H_ 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_RENDER_VIEW_HOST_DELEGATE_H_
6 #define CONTENT_BROWSER_RENDERER_HOST_RENDER_VIEW_HOST_DELEGATE_H_ 6 #define CONTENT_BROWSER_RENDERER_HOST_RENDER_VIEW_HOST_DELEGATE_H_
7 #pragma once 7 #pragma once
8 8
9 #include <string> 9 #include <string>
10 10
11 #include "base/basictypes.h" 11 #include "base/basictypes.h"
12 #include "base/i18n/rtl.h" 12 #include "base/i18n/rtl.h"
13 #include "base/process_util.h" 13 #include "base/process_util.h"
14 #include "base/string16.h" 14 #include "base/string16.h"
15 #include "content/common/content_export.h" 15 #include "content/common/content_export.h"
16 #include "content/public/common/javascript_message_type.h" 16 #include "content/public/common/javascript_message_type.h"
17 #include "content/public/common/media_stream_request.h"
17 #include "ipc/ipc_channel.h" 18 #include "ipc/ipc_channel.h"
18 #include "net/base/load_states.h" 19 #include "net/base/load_states.h"
19 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPopupType.h" 20 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPopupType.h"
20 #include "webkit/glue/window_open_disposition.h" 21 #include "webkit/glue/window_open_disposition.h"
21 22
22 class GURL; 23 class GURL;
23 class SkBitmap; 24 class SkBitmap;
24 class WebContentsImpl; 25 class WebContentsImpl;
25 class WebKeyboardEvent; 26 class WebKeyboardEvent;
26 struct ViewHostMsg_CreateWindow_Params; 27 struct ViewHostMsg_CreateWindow_Params;
(...skipping 23 matching lines...) Expand all
50 class RenderViewHostDelegateView; 51 class RenderViewHostDelegateView;
51 class SessionStorageNamespace; 52 class SessionStorageNamespace;
52 class WebContents; 53 class WebContents;
53 struct ContextMenuParams; 54 struct ContextMenuParams;
54 struct FileChooserParams; 55 struct FileChooserParams;
55 struct GlobalRequestID; 56 struct GlobalRequestID;
56 struct NativeWebKeyboardEvent; 57 struct NativeWebKeyboardEvent;
57 struct Referrer; 58 struct Referrer;
58 struct RendererPreferences; 59 struct RendererPreferences;
59 60
61 typedef base::Callback< void(const MediaStreamDevices&) > MediaResponseCallback;
62
60 // 63 //
61 // RenderViewHostDelegate 64 // RenderViewHostDelegate
62 // 65 //
63 // An interface implemented by an object interested in knowing about the state 66 // An interface implemented by an object interested in knowing about the state
64 // of the RenderViewHost. 67 // of the RenderViewHost.
65 // 68 //
66 // This interface currently encompasses every type of message that was 69 // This interface currently encompasses every type of message that was
67 // previously being sent by WebContents itself. Some of these notifications 70 // previously being sent by WebContents itself. Some of these notifications
68 // may not be relevant to all users of RenderViewHost and we should consider 71 // may not be relevant to all users of RenderViewHost and we should consider
69 // exposing a more generic Send function on RenderViewHost and a response 72 // exposing a more generic Send function on RenderViewHost and a response
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 // IPC::Channel::Listener implementation. 110 // IPC::Channel::Listener implementation.
108 // This is used to give the delegate a chance to filter IPC messages. 111 // This is used to give the delegate a chance to filter IPC messages.
109 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; 112 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
110 113
111 // Gets the URL that is currently being displayed, if there is one. 114 // Gets the URL that is currently being displayed, if there is one.
112 virtual const GURL& GetURL() const; 115 virtual const GURL& GetURL() const;
113 116
114 // Return this object cast to a WebContents, if it is one. If the object is 117 // Return this object cast to a WebContents, if it is one. If the object is
115 // not a WebContents, returns NULL. DEPRECATED: Be sure to include brettw or 118 // not a WebContents, returns NULL. DEPRECATED: Be sure to include brettw or
116 // jam as reviewers before you use this method. http://crbug.com/82582 119 // jam as reviewers before you use this method. http://crbug.com/82582
117 virtual content::WebContents* GetAsWebContents(); 120 virtual WebContents* GetAsWebContents();
118 121
119 // Return the rect where to display the resize corner, if any, otherwise 122 // Return the rect where to display the resize corner, if any, otherwise
120 // an empty rect. 123 // an empty rect.
121 virtual gfx::Rect GetRootWindowResizerRect() const = 0; 124 virtual gfx::Rect GetRootWindowResizerRect() const = 0;
122 125
123 // The RenderView is being constructed (message sent to the renderer process 126 // The RenderView is being constructed (message sent to the renderer process
124 // to construct a RenderView). Now is a good time to send other setup events 127 // to construct a RenderView). Now is a good time to send other setup events
125 // to the RenderView. This precedes any other commands to the RenderView. 128 // to the RenderView. This precedes any other commands to the RenderView.
126 virtual void RenderViewCreated(RenderViewHost* render_view_host) {} 129 virtual void RenderViewCreated(RenderViewHost* render_view_host) {}
127 130
128 // The RenderView has been constructed. 131 // The RenderView has been constructed.
129 virtual void RenderViewReady(RenderViewHost* render_view_host) {} 132 virtual void RenderViewReady(RenderViewHost* render_view_host) {}
130 133
131 // The RenderView died somehow (crashed or was killed by the user). 134 // The RenderView died somehow (crashed or was killed by the user).
132 virtual void RenderViewGone(RenderViewHost* render_view_host, 135 virtual void RenderViewGone(RenderViewHost* render_view_host,
133 base::TerminationStatus status, 136 base::TerminationStatus status,
134 int error_code) {} 137 int error_code) {}
135 138
136 // The RenderView is going to be deleted. This is called when each 139 // The RenderView is going to be deleted. This is called when each
137 // RenderView is going to be destroyed 140 // RenderView is going to be destroyed
138 virtual void RenderViewDeleted(RenderViewHost* render_view_host) {} 141 virtual void RenderViewDeleted(RenderViewHost* render_view_host) {}
139 142
140 // The RenderView started a provisional load for a given frame. 143 // The RenderView started a provisional load for a given frame.
141 virtual void DidStartProvisionalLoadForFrame( 144 virtual void DidStartProvisionalLoadForFrame(
142 content::RenderViewHost* render_view_host, 145 RenderViewHost* render_view_host,
143 int64 frame_id, 146 int64 frame_id,
144 bool main_frame, 147 bool main_frame,
145 const GURL& opener_url, 148 const GURL& opener_url,
146 const GURL& url) {} 149 const GURL& url) {}
147 150
148 // The RenderView processed a redirect during a provisional load. 151 // The RenderView processed a redirect during a provisional load.
149 // 152 //
150 // TODO(creis): Remove this method and have the pre-rendering code listen to 153 // TODO(creis): Remove this method and have the pre-rendering code listen to
151 // the ResourceDispatcherHost's RESOURCE_RECEIVED_REDIRECT notification 154 // the ResourceDispatcherHost's RESOURCE_RECEIVED_REDIRECT notification
152 // instead. See http://crbug.com/78512. 155 // instead. See http://crbug.com/78512.
153 virtual void DidRedirectProvisionalLoad( 156 virtual void DidRedirectProvisionalLoad(
154 content::RenderViewHost* render_view_host, 157 RenderViewHost* render_view_host,
155 int32 page_id, 158 int32 page_id,
156 const GURL& opener_url, 159 const GURL& opener_url,
157 const GURL& source_url, 160 const GURL& source_url,
158 const GURL& target_url) {} 161 const GURL& target_url) {}
159 162
160 // A provisional load in the RenderView failed. 163 // A provisional load in the RenderView failed.
161 virtual void DidFailProvisionalLoadWithError( 164 virtual void DidFailProvisionalLoadWithError(
162 content::RenderViewHost* render_view_host, 165 RenderViewHost* render_view_host,
163 const ViewHostMsg_DidFailProvisionalLoadWithError_Params& params) {} 166 const ViewHostMsg_DidFailProvisionalLoadWithError_Params& params) {}
164 167
165 // The RenderView was navigated to a different page. 168 // The RenderView was navigated to a different page.
166 virtual void DidNavigate(RenderViewHost* render_view_host, 169 virtual void DidNavigate(RenderViewHost* render_view_host,
167 const ViewHostMsg_FrameNavigate_Params& params) {} 170 const ViewHostMsg_FrameNavigate_Params& params) {}
168 171
169 // The state for the page changed and should be updated. 172 // The state for the page changed and should be updated.
170 virtual void UpdateState(RenderViewHost* render_view_host, 173 virtual void UpdateState(RenderViewHost* render_view_host,
171 int32 page_id, 174 int32 page_id,
172 const std::string& state) {} 175 const std::string& state) {}
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 virtual void DocumentAvailableInMainFrame(RenderViewHost* render_view_host) {} 217 virtual void DocumentAvailableInMainFrame(RenderViewHost* render_view_host) {}
215 218
216 // The onload handler in the RenderView's main frame has completed. 219 // The onload handler in the RenderView's main frame has completed.
217 virtual void DocumentOnLoadCompletedInMainFrame( 220 virtual void DocumentOnLoadCompletedInMainFrame(
218 RenderViewHost* render_view_host, 221 RenderViewHost* render_view_host,
219 int32 page_id) {} 222 int32 page_id) {}
220 223
221 // The page wants to open a URL with the specified disposition. 224 // The page wants to open a URL with the specified disposition.
222 virtual void RequestOpenURL(RenderViewHost* rvh, 225 virtual void RequestOpenURL(RenderViewHost* rvh,
223 const GURL& url, 226 const GURL& url,
224 const content::Referrer& referrer, 227 const Referrer& referrer,
225 WindowOpenDisposition disposition, 228 WindowOpenDisposition disposition,
226 int64 source_frame_id) {} 229 int64 source_frame_id) {}
227 230
228 // The page wants to transfer the request to a new renderer. 231 // The page wants to transfer the request to a new renderer.
229 virtual void RequestTransferURL( 232 virtual void RequestTransferURL(
230 const GURL& url, 233 const GURL& url,
231 const content::Referrer& referrer, 234 const Referrer& referrer,
232 WindowOpenDisposition disposition, 235 WindowOpenDisposition disposition,
233 int64 source_frame_id, 236 int64 source_frame_id,
234 const content::GlobalRequestID& old_request_id) {} 237 const GlobalRequestID& old_request_id) {}
235 238
236 // The page wants to close the active view in this tab. 239 // The page wants to close the active view in this tab.
237 virtual void RouteCloseEvent(RenderViewHost* rvh) {} 240 virtual void RouteCloseEvent(RenderViewHost* rvh) {}
238 241
239 // The page wants to post a message to the active view in this tab. 242 // The page wants to post a message to the active view in this tab.
240 virtual void RouteMessageEvent( 243 virtual void RouteMessageEvent(
241 RenderViewHost* rvh, 244 RenderViewHost* rvh,
242 const ViewMsg_PostMessage_Params& params) {} 245 const ViewMsg_PostMessage_Params& params) {}
243 246
244 // A javascript message, confirmation or prompt should be shown. 247 // A javascript message, confirmation or prompt should be shown.
245 virtual void RunJavaScriptMessage(RenderViewHost* rvh, 248 virtual void RunJavaScriptMessage(RenderViewHost* rvh,
246 const string16& message, 249 const string16& message,
247 const string16& default_prompt, 250 const string16& default_prompt,
248 const GURL& frame_url, 251 const GURL& frame_url,
249 content::JavaScriptMessageType type, 252 JavaScriptMessageType type,
250 IPC::Message* reply_msg, 253 IPC::Message* reply_msg,
251 bool* did_suppress_message) {} 254 bool* did_suppress_message) {}
252 255
253 virtual void RunBeforeUnloadConfirm(RenderViewHost* rvh, 256 virtual void RunBeforeUnloadConfirm(RenderViewHost* rvh,
254 const string16& message, 257 const string16& message,
255 bool is_reload, 258 bool is_reload,
256 IPC::Message* reply_msg) {} 259 IPC::Message* reply_msg) {}
257 260
258 // A message was added to to the console. 261 // A message was added to to the console.
259 virtual bool AddMessageToConsole(int32 level, 262 virtual bool AddMessageToConsole(int32 level,
260 const string16& message, 263 const string16& message,
261 int32 line_no, 264 int32 line_no,
262 const string16& source_id); 265 const string16& source_id);
263 266
264 // Return a dummy RendererPreferences object that will be used by the renderer 267 // Return a dummy RendererPreferences object that will be used by the renderer
265 // associated with the owning RenderViewHost. 268 // associated with the owning RenderViewHost.
266 virtual content::RendererPreferences GetRendererPrefs( 269 virtual RendererPreferences GetRendererPrefs(
267 content::BrowserContext* browser_context) const = 0; 270 BrowserContext* browser_context) const = 0;
268 271
269 // Returns a WebPreferences object that will be used by the renderer 272 // Returns a WebPreferences object that will be used by the renderer
270 // associated with the owning render view host. 273 // associated with the owning render view host.
271 virtual webkit_glue::WebPreferences GetWebkitPrefs(); 274 virtual webkit_glue::WebPreferences GetWebkitPrefs();
272 275
273 // Notification the user has made a gesture while focus was on the 276 // Notification the user has made a gesture while focus was on the
274 // page. This is used to avoid uninitiated user downloads (aka carpet 277 // page. This is used to avoid uninitiated user downloads (aka carpet
275 // bombing), see DownloadRequestLimiter for details. 278 // bombing), see DownloadRequestLimiter for details.
276 virtual void OnUserGesture() {} 279 virtual void OnUserGesture() {}
277 280
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
312 // implementing global 'on hover' features external to the view. 315 // implementing global 'on hover' features external to the view.
313 virtual void HandleMouseMove() {} 316 virtual void HandleMouseMove() {}
314 virtual void HandleMouseDown() {} 317 virtual void HandleMouseDown() {}
315 virtual void HandleMouseLeave() {} 318 virtual void HandleMouseLeave() {}
316 virtual void HandleMouseUp() {} 319 virtual void HandleMouseUp() {}
317 virtual void HandleMouseActivate() {} 320 virtual void HandleMouseActivate() {}
318 321
319 // Called when a file selection is to be done. 322 // Called when a file selection is to be done.
320 virtual void RunFileChooser( 323 virtual void RunFileChooser(
321 RenderViewHost* render_view_host, 324 RenderViewHost* render_view_host,
322 const content::FileChooserParams& params) {} 325 const FileChooserParams& params) {}
323 326
324 // Notification that the page wants to go into or out of fullscreen mode. 327 // Notification that the page wants to go into or out of fullscreen mode.
325 virtual void ToggleFullscreenMode(bool enter_fullscreen) {} 328 virtual void ToggleFullscreenMode(bool enter_fullscreen) {}
326 virtual bool IsFullscreenForCurrentTab() const; 329 virtual bool IsFullscreenForCurrentTab() const;
327 330
328 // The contents' preferred size changed. 331 // The contents' preferred size changed.
329 virtual void UpdatePreferredSize(const gfx::Size& pref_size) {} 332 virtual void UpdatePreferredSize(const gfx::Size& pref_size) {}
330 333
331 // The contents auto-resized and the container should match it. 334 // The contents auto-resized and the container should match it.
332 virtual void ResizeDueToAutoResize(const gfx::Size& new_size) {} 335 virtual void ResizeDueToAutoResize(const gfx::Size& new_size) {}
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
381 // Show the newly created widget with the specified bounds. 384 // Show the newly created widget with the specified bounds.
382 // The widget is identified by the route_id passed to CreateNewWidget. 385 // The widget is identified by the route_id passed to CreateNewWidget.
383 virtual void ShowCreatedWidget(int route_id, 386 virtual void ShowCreatedWidget(int route_id,
384 const gfx::Rect& initial_pos) {} 387 const gfx::Rect& initial_pos) {}
385 388
386 // Show the newly created full screen widget. Similar to above. 389 // Show the newly created full screen widget. Similar to above.
387 virtual void ShowCreatedFullscreenWidget(int route_id) {} 390 virtual void ShowCreatedFullscreenWidget(int route_id) {}
388 391
389 // A context menu should be shown, to be built using the context information 392 // A context menu should be shown, to be built using the context information
390 // provided in the supplied params. 393 // provided in the supplied params.
391 virtual void ShowContextMenu(const content::ContextMenuParams& params) {} 394 virtual void ShowContextMenu(const ContextMenuParams& params) {}
395
396 // The render view has requested access to media devices listed in
397 // |request|, and the client should grant or deny that permission by
398 // calling |callback|.
399 virtual void RequestMediaAccessPermission(
400 const MediaStreamRequest* request,
401 const MediaResponseCallback& callback) {}
392 402
393 protected: 403 protected:
394 virtual ~RenderViewHostDelegate() {} 404 virtual ~RenderViewHostDelegate() {}
395 }; 405 };
396 406
397 } // namespace content 407 } // namespace content
398 408
399 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_VIEW_HOST_DELEGATE_H_ 409 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_VIEW_HOST_DELEGATE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698