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

Side by Side Diff: webkit/plugins/ppapi/ppapi_plugin_instance.cc

Issue 6259008: When we detect a PDF with an unsupported feature, ask the user if they want t... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' 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 | « webkit/plugins/ppapi/ppapi_plugin_instance.h ('k') | webkit/plugins/ppapi/ppb_pdf_impl.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 #include "webkit/plugins/ppapi/ppapi_plugin_instance.h" 5 #include "webkit/plugins/ppapi/ppapi_plugin_instance.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/metrics/histogram.h" 8 #include "base/metrics/histogram.h"
9 #include "base/scoped_ptr.h" 9 #include "base/scoped_ptr.h"
10 #include "base/utf_string_conversions.h" 10 #include "base/utf_string_conversions.h"
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after
243 &IsFullscreen, 243 &IsFullscreen,
244 &SetFullscreen, 244 &SetFullscreen,
245 }; 245 };
246 246
247 void ZoomChanged(PP_Instance instance_id, double factor) { 247 void ZoomChanged(PP_Instance instance_id, double factor) {
248 PluginInstance* instance = ResourceTracker::Get()->GetInstance(instance_id); 248 PluginInstance* instance = ResourceTracker::Get()->GetInstance(instance_id);
249 if (!instance) 249 if (!instance)
250 return; 250 return;
251 251
252 // We only want to tell the page to change its zoom if the whole page is the 252 // We only want to tell the page to change its zoom if the whole page is the
253 // PDF. If we're in an iframe, then don't do anything. 253 // plugin. If we're in an iframe, then don't do anything.
254 WebFrame* frame = instance->container()->element().document().frame(); 254 if (!instance->IsFullPagePlugin())
255 if (!frame->view()->mainFrame()->document().isPluginDocument())
256 return; 255 return;
257 256
258 double zoom_level = WebView::zoomFactorToZoomLevel(factor); 257 double zoom_level = WebView::zoomFactorToZoomLevel(factor);
259 // The conversino from zoom level to factor, and back, can introduce rounding 258 // The conversino from zoom level to factor, and back, can introduce rounding
260 // errors. i.e. WebKit originally tells us 3.0, but by the time we tell the 259 // errors. i.e. WebKit originally tells us 3.0, but by the time we tell the
261 // plugin and it tells us back, the level becomes 3.000000000004. Need to 260 // plugin and it tells us back, the level becomes 3.000000000004. Need to
262 // round or else otherwise if the user zooms out, it will go to 3.0 instead of 261 // round or else otherwise if the user zooms out, it will go to 3.0 instead of
263 // 2.0. 262 // 2.0.
264 int rounded = 263 int rounded =
265 static_cast<int>(zoom_level + (zoom_level > 0 ? 0.001 : -0.001)); 264 static_cast<int>(zoom_level + (zoom_level > 0 ? 0.001 : -0.001));
(...skipping 958 matching lines...) Expand 10 before | Expand all | Expand 10 after
1224 } 1223 }
1225 1224
1226 ObjectVar* PluginInstance::ObjectVarForNPObject(NPObject* np_object) const { 1225 ObjectVar* PluginInstance::ObjectVarForNPObject(NPObject* np_object) const {
1227 NPObjectToObjectVarMap::const_iterator found = 1226 NPObjectToObjectVarMap::const_iterator found =
1228 np_object_to_object_var_.find(np_object); 1227 np_object_to_object_var_.find(np_object);
1229 if (found == np_object_to_object_var_.end()) 1228 if (found == np_object_to_object_var_.end())
1230 return NULL; 1229 return NULL;
1231 return found->second; 1230 return found->second;
1232 } 1231 }
1233 1232
1233 bool PluginInstance::IsFullPagePlugin() const {
1234 WebFrame* frame = container()->element().document().frame();
1235 return frame->view()->mainFrame()->document().isPluginDocument();
1236 }
1237
1234 } // namespace ppapi 1238 } // namespace ppapi
1235 } // namespace webkit 1239 } // namespace webkit
OLDNEW
« no previous file with comments | « webkit/plugins/ppapi/ppapi_plugin_instance.h ('k') | webkit/plugins/ppapi/ppb_pdf_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698