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

Side by Side Diff: webkit/glue/plugins/webview_plugin.cc

Issue 5639004: Implement a useful context menu for the blocked plug-in frame:... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 years 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 | « webkit/glue/plugins/webview_plugin.h ('k') | no next file » | 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 #include "webkit/glue/plugins/webview_plugin.h" 5 #include "webkit/glue/plugins/webview_plugin.h"
6 6
7 #include "base/message_loop.h" 7 #include "base/message_loop.h"
8 #include "base/metrics/histogram.h" 8 #include "base/metrics/histogram.h"
9 #include "third_party/WebKit/WebKit/chromium/public/WebCursorInfo.h" 9 #include "third_party/WebKit/WebKit/chromium/public/WebCursorInfo.h"
10 #include "third_party/WebKit/WebKit/chromium/public/WebElement.h" 10 #include "third_party/WebKit/WebKit/chromium/public/WebElement.h"
11 #include "third_party/WebKit/WebKit/chromium/public/WebFrame.h" 11 #include "third_party/WebKit/WebKit/chromium/public/WebFrame.h"
12 #include "third_party/WebKit/WebKit/chromium/public/WebInputEvent.h"
12 #include "third_party/WebKit/WebKit/chromium/public/WebPluginContainer.h" 13 #include "third_party/WebKit/WebKit/chromium/public/WebPluginContainer.h"
13 #include "third_party/WebKit/WebKit/chromium/public/WebSize.h" 14 #include "third_party/WebKit/WebKit/chromium/public/WebSize.h"
14 #include "third_party/WebKit/WebKit/chromium/public/WebURL.h" 15 #include "third_party/WebKit/WebKit/chromium/public/WebURL.h"
15 #include "third_party/WebKit/WebKit/chromium/public/WebURLRequest.h" 16 #include "third_party/WebKit/WebKit/chromium/public/WebURLRequest.h"
16 #include "third_party/WebKit/WebKit/chromium/public/WebURLResponse.h" 17 #include "third_party/WebKit/WebKit/chromium/public/WebURLResponse.h"
17 #include "third_party/WebKit/WebKit/chromium/public/WebView.h" 18 #include "third_party/WebKit/WebKit/chromium/public/WebView.h"
18 #include "webkit/glue/webpreferences.h" 19 #include "webkit/glue/webpreferences.h"
19 20
20 #if WEBKIT_USING_CG 21 #if WEBKIT_USING_CG
21 #include <CoreGraphics/CGContext.h> 22 #include <CoreGraphics/CGContext.h>
22 #elif WEBKIT_USING_SKIA 23 #elif WEBKIT_USING_SKIA
23 #include "skia/ext/platform_canvas.h" 24 #include "skia/ext/platform_canvas.h"
24 #endif 25 #endif
25 26
26 using WebKit::WebCanvas; 27 using WebKit::WebCanvas;
27 using WebKit::WebCursorInfo; 28 using WebKit::WebCursorInfo;
28 using WebKit::WebDragData; 29 using WebKit::WebDragData;
29 using WebKit::WebDragOperationsMask; 30 using WebKit::WebDragOperationsMask;
30 using WebKit::WebFrame; 31 using WebKit::WebFrame;
31 using WebKit::WebImage; 32 using WebKit::WebImage;
32 using WebKit::WebInputEvent; 33 using WebKit::WebInputEvent;
34 using WebKit::WebMouseEvent;
33 using WebKit::WebPlugin; 35 using WebKit::WebPlugin;
34 using WebKit::WebPluginContainer; 36 using WebKit::WebPluginContainer;
35 using WebKit::WebPoint; 37 using WebKit::WebPoint;
36 using WebKit::WebRect; 38 using WebKit::WebRect;
37 using WebKit::WebSize; 39 using WebKit::WebSize;
38 using WebKit::WebURLError; 40 using WebKit::WebURLError;
39 using WebKit::WebURLRequest; 41 using WebKit::WebURLRequest;
40 using WebKit::WebURLResponse; 42 using WebKit::WebURLResponse;
41 using WebKit::WebVector; 43 using WebKit::WebVector;
42 using WebKit::WebView; 44 using WebKit::WebView;
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 const WebRect& frame_rect, const WebRect& clip_rect, 138 const WebRect& frame_rect, const WebRect& clip_rect,
137 const WebVector<WebRect>& cut_out_rects, bool is_visible) { 139 const WebVector<WebRect>& cut_out_rects, bool is_visible) {
138 if (frame_rect != rect_) { 140 if (frame_rect != rect_) {
139 rect_ = frame_rect; 141 rect_ = frame_rect;
140 web_view_->resize(WebSize(frame_rect.width, frame_rect.height)); 142 web_view_->resize(WebSize(frame_rect.width, frame_rect.height));
141 } 143 }
142 } 144 }
143 145
144 bool WebViewPlugin::handleInputEvent(const WebInputEvent& event, 146 bool WebViewPlugin::handleInputEvent(const WebInputEvent& event,
145 WebCursorInfo& cursor) { 147 WebCursorInfo& cursor) {
148 if (event.type == WebInputEvent::ContextMenu) {
149 if (delegate_) {
150 const WebMouseEvent& mouse_event =
151 reinterpret_cast<const WebMouseEvent&>(event);
152 delegate_->ShowContextMenu(mouse_event);
153 }
154 return true;
155 }
146 current_cursor_ = cursor; 156 current_cursor_ = cursor;
147 bool handled = web_view_->handleInputEvent(event); 157 bool handled = web_view_->handleInputEvent(event);
148 cursor = current_cursor_; 158 cursor = current_cursor_;
149 return handled; 159 return handled;
150 } 160 }
151 161
152 void WebViewPlugin::didReceiveResponse(const WebURLResponse& response) { 162 void WebViewPlugin::didReceiveResponse(const WebURLResponse& response) {
153 DCHECK(response_.isNull()); 163 DCHECK(response_.isNull());
154 response_ = response; 164 response_ = response;
155 } 165 }
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 WebURLError WebViewPlugin::cancelledError(WebFrame* frame, 214 WebURLError WebViewPlugin::cancelledError(WebFrame* frame,
205 const WebURLRequest& request) { 215 const WebURLRequest& request) {
206 // Return an error with a non-zero reason so isNull() on the corresponding 216 // Return an error with a non-zero reason so isNull() on the corresponding
207 // ResourceError is false. 217 // ResourceError is false.
208 WebURLError error; 218 WebURLError error;
209 error.domain = "WebViewPlugin"; 219 error.domain = "WebViewPlugin";
210 error.reason = -1; 220 error.reason = -1;
211 error.unreachableURL = request.url(); 221 error.unreachableURL = request.url();
212 return error; 222 return error;
213 } 223 }
OLDNEW
« no previous file with comments | « webkit/glue/plugins/webview_plugin.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698