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

Side by Side Diff: content/browser/browser_plugin/browser_plugin_guest.h

Issue 13037003: permissionrequest API for guest Download. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Sync. Created 7 years, 9 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 // A BrowserPluginGuest is the browser side of a browser <--> embedder 5 // A BrowserPluginGuest is the browser side of a browser <--> embedder
6 // renderer channel. A BrowserPlugin (a WebPlugin) is on the embedder 6 // renderer channel. A BrowserPlugin (a WebPlugin) is on the embedder
7 // renderer side of browser <--> embedder renderer communication. 7 // renderer side of browser <--> embedder renderer communication.
8 // 8 //
9 // BrowserPluginGuest lives on the UI thread of the browser process. It has a 9 // BrowserPluginGuest lives on the UI thread of the browser process. It has a
10 // helper, BrowserPluginGuestHelper, which is a RenderViewHostObserver. The 10 // helper, BrowserPluginGuestHelper, which is a RenderViewHostObserver. The
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 // attached. 164 // attached.
165 virtual void AddNewContents(WebContents* source, 165 virtual void AddNewContents(WebContents* source,
166 WebContents* new_contents, 166 WebContents* new_contents,
167 WindowOpenDisposition disposition, 167 WindowOpenDisposition disposition,
168 const gfx::Rect& initial_pos, 168 const gfx::Rect& initial_pos,
169 bool user_gesture, 169 bool user_gesture,
170 bool* was_blocked) OVERRIDE; 170 bool* was_blocked) OVERRIDE;
171 virtual bool CanDownload(RenderViewHost* render_view_host, 171 virtual bool CanDownload(RenderViewHost* render_view_host,
172 int request_id, 172 int request_id,
173 const std::string& request_method) OVERRIDE; 173 const std::string& request_method) OVERRIDE;
174 virtual void CanDownloadAsync(RenderViewHost* render_view_host,
175 int download_request_id,
176 const std::string& request_method,
177 const base::Callback<void(bool)>& callback)
178 OVERRIDE;
174 virtual bool HandleContextMenu(const ContextMenuParams& params) OVERRIDE; 179 virtual bool HandleContextMenu(const ContextMenuParams& params) OVERRIDE;
175 virtual void WebContentsCreated(WebContents* source_contents, 180 virtual void WebContentsCreated(WebContents* source_contents,
176 int64 source_frame_id, 181 int64 source_frame_id,
177 const string16& frame_name, 182 const string16& frame_name,
178 const GURL& target_url, 183 const GURL& target_url,
179 WebContents* new_contents) OVERRIDE; 184 WebContents* new_contents) OVERRIDE;
180 virtual void RendererUnresponsive(WebContents* source) OVERRIDE; 185 virtual void RendererUnresponsive(WebContents* source) OVERRIDE;
181 virtual void RendererResponsive(WebContents* source) OVERRIDE; 186 virtual void RendererResponsive(WebContents* source) OVERRIDE;
182 virtual void RunFileChooser(WebContents* web_contents, 187 virtual void RunFileChooser(WebContents* web_contents,
183 const FileChooserParams& params) OVERRIDE; 188 const FileChooserParams& params) OVERRIDE;
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
372 void OnShowWidget(int route_id, const gfx::Rect& initial_pos); 377 void OnShowWidget(int route_id, const gfx::Rect& initial_pos);
373 // Overriden in tests. 378 // Overriden in tests.
374 virtual void OnTakeFocus(bool reverse); 379 virtual void OnTakeFocus(bool reverse);
375 void OnUpdateDragCursor(WebKit::WebDragOperation operation); 380 void OnUpdateDragCursor(WebKit::WebDragOperation operation);
376 void OnUpdateFrameName(int frame_id, 381 void OnUpdateFrameName(int frame_id,
377 bool is_top_level, 382 bool is_top_level,
378 const std::string& name); 383 const std::string& name);
379 void OnUpdateRect(const ViewHostMsg_UpdateRect_Params& params); 384 void OnUpdateRect(const ViewHostMsg_UpdateRect_Params& params);
380 385
381 // Helpers for |OnRespondPermission|. 386 // Helpers for |OnRespondPermission|.
387 void OnRespondPermissionDownload(int request_id, bool should_allow);
382 void OnRespondPermissionGeolocation(int request_id, bool should_allow); 388 void OnRespondPermissionGeolocation(int request_id, bool should_allow);
383 void OnRespondPermissionMedia(int request_id, bool should_allow); 389 void OnRespondPermissionMedia(int request_id, bool should_allow);
384 void OnRespondPermissionNewWindow(int request_id, bool should_allow); 390 void OnRespondPermissionNewWindow(int request_id, bool should_allow);
385 391
386 // Weak pointer used to ask GeolocationPermissionContext about geolocation 392 // Weak pointer used to ask GeolocationPermissionContext about geolocation
387 // permission. 393 // permission.
388 base::WeakPtrFactory<BrowserPluginGuest> weak_ptr_factory_; 394 base::WeakPtrFactory<BrowserPluginGuest> weak_ptr_factory_;
389 395
390 // Static factory instance (always NULL for non-test). 396 // Static factory instance (always NULL for non-test).
391 static BrowserPluginHostFactory* factory_; 397 static BrowserPluginHostFactory* factory_;
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
425 int next_permission_request_id_; 431 int next_permission_request_id_;
426 // A map to store WebContents's media request object and callback. 432 // A map to store WebContents's media request object and callback.
427 // We need to store these because we need a roundtrip to the embedder to know 433 // We need to store these because we need a roundtrip to the embedder to know
428 // if we allow or disallow the request. The key of the map is unique only for 434 // if we allow or disallow the request. The key of the map is unique only for
429 // a given BrowserPluginGuest. 435 // a given BrowserPluginGuest.
430 MediaStreamRequestsMap media_requests_map_; 436 MediaStreamRequestsMap media_requests_map_;
431 // A map from request ID to instance ID for use by the New Window API. 437 // A map from request ID to instance ID for use by the New Window API.
432 typedef std::map<int, int> NewWindowRequestMap; 438 typedef std::map<int, int> NewWindowRequestMap;
433 NewWindowRequestMap new_window_request_map_; 439 NewWindowRequestMap new_window_request_map_;
434 440
441 typedef std::map<int, base::Callback<void(bool)> > DownloadRequestMap;
442 DownloadRequestMap download_request_callback_map_;
443
435 DISALLOW_COPY_AND_ASSIGN(BrowserPluginGuest); 444 DISALLOW_COPY_AND_ASSIGN(BrowserPluginGuest);
436 }; 445 };
437 446
438 } // namespace content 447 } // namespace content
439 448
440 #endif // CONTENT_BROWSER_BROWSER_PLUGIN_BROWSER_PLUGIN_GUEST_H_ 449 #endif // CONTENT_BROWSER_BROWSER_PLUGIN_BROWSER_PLUGIN_GUEST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698