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

Side by Side Diff: webkit/plugins/ppapi/ppb_pdf_impl.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.cc ('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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/ppb_pdf_impl.h" 5 #include "webkit/plugins/ppapi/ppb_pdf_impl.h"
6 6
7 #include "app/resource_bundle.h" 7 #include "app/resource_bundle.h"
8 #include "base/metrics/histogram.h" 8 #include "base/metrics/histogram.h"
9 #include "base/utf_string_conversions.h" 9 #include "base/utf_string_conversions.h"
10 #include "build/build_config.h" 10 #include "build/build_config.h"
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after
261 void HistogramPDFPageCount(int count) { 261 void HistogramPDFPageCount(int count) {
262 UMA_HISTOGRAM_COUNTS_10000("PDF.PageCount", count); 262 UMA_HISTOGRAM_COUNTS_10000("PDF.PageCount", count);
263 } 263 }
264 264
265 void UserMetricsRecordAction(PP_Var action) { 265 void UserMetricsRecordAction(PP_Var action) {
266 scoped_refptr<StringVar> action_str(StringVar::FromPPVar(action)); 266 scoped_refptr<StringVar> action_str(StringVar::FromPPVar(action));
267 if (action_str) 267 if (action_str)
268 webkit_glue::UserMetricsRecordAction(action_str->value()); 268 webkit_glue::UserMetricsRecordAction(action_str->value());
269 } 269 }
270 270
271 void HasUnsupportedFeature(PP_Instance instance_id) {
272 PluginInstance* instance = ResourceTracker::Get()->GetInstance(instance_id);
273 if (!instance)
274 return;
275
276 // Only want to show an info bar if the pdf is the whole tab.
277 if (!instance->IsFullPagePlugin())
278 return;
279
280 instance->delegate()->HasUnsupportedFeature();
281 }
282
271 const PPB_PDF ppb_pdf = { 283 const PPB_PDF ppb_pdf = {
272 &GetLocalizedString, 284 &GetLocalizedString,
273 &GetResourceImage, 285 &GetResourceImage,
274 &GetFontFileWithFallback, 286 &GetFontFileWithFallback,
275 &GetFontTableForPrivateFontFile, 287 &GetFontTableForPrivateFontFile,
276 &SearchString, 288 &SearchString,
277 &DidStartLoading, 289 &DidStartLoading,
278 &DidStopLoading, 290 &DidStopLoading,
279 &SetContentRestriction, 291 &SetContentRestriction,
280 &HistogramPDFPageCount, 292 &HistogramPDFPageCount,
281 &UserMetricsRecordAction 293 &UserMetricsRecordAction,
294 &HasUnsupportedFeature
282 }; 295 };
283 296
284 } // namespace 297 } // namespace
285 298
286 // static 299 // static
287 const PPB_PDF* PPB_PDF_Impl::GetInterface() { 300 const PPB_PDF* PPB_PDF_Impl::GetInterface() {
288 return &ppb_pdf; 301 return &ppb_pdf;
289 } 302 }
290 303
291 #if defined(OS_LINUX) 304 #if defined(OS_LINUX)
292 bool PrivateFontFile::GetFontTable(uint32_t table, 305 bool PrivateFontFile::GetFontTable(uint32_t table,
293 void* output, 306 void* output,
294 uint32_t* output_length) { 307 uint32_t* output_length) {
295 size_t temp_size = static_cast<size_t>(*output_length); 308 size_t temp_size = static_cast<size_t>(*output_length);
296 bool rv = webkit_glue::GetFontTable( 309 bool rv = webkit_glue::GetFontTable(
297 fd_, table, static_cast<uint8_t*>(output), &temp_size); 310 fd_, table, static_cast<uint8_t*>(output), &temp_size);
298 *output_length = static_cast<uint32_t>(temp_size); 311 *output_length = static_cast<uint32_t>(temp_size);
299 return rv; 312 return rv;
300 } 313 }
301 #endif 314 #endif
302 315
303 } // namespace ppapi 316 } // namespace ppapi
304 } // namespace webkit 317 } // namespace webkit
305 318
OLDNEW
« no previous file with comments | « webkit/plugins/ppapi/ppapi_plugin_instance.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698