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

Side by Side Diff: content/browser/plugin_service.cc

Issue 7649026: Print Preview: Always enable the internal PDF plugin for print preview. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 9 years, 4 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 | « chrome/browser/printing/print_preview_tab_controller.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 "content/browser/plugin_service.h" 5 #include "content/browser/plugin_service.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
11 #include "base/path_service.h" 11 #include "base/path_service.h"
12 #include "base/string_util.h" 12 #include "base/string_util.h"
13 #include "base/synchronization/waitable_event.h" 13 #include "base/synchronization/waitable_event.h"
14 #include "base/threading/thread.h" 14 #include "base/threading/thread.h"
15 #include "base/utf_string_conversions.h" 15 #include "base/utf_string_conversions.h"
16 #include "base/values.h" 16 #include "base/values.h"
17 #include "content/browser/browser_thread.h" 17 #include "content/browser/browser_thread.h"
18 #include "content/browser/content_browser_client.h" 18 #include "content/browser/content_browser_client.h"
19 #include "content/browser/ppapi_plugin_process_host.h" 19 #include "content/browser/ppapi_plugin_process_host.h"
20 #include "content/browser/renderer_host/render_process_host.h" 20 #include "content/browser/renderer_host/render_process_host.h"
21 #include "content/browser/renderer_host/render_view_host.h" 21 #include "content/browser/renderer_host/render_view_host.h"
22 #include "content/browser/resource_context.h" 22 #include "content/browser/resource_context.h"
23 #include "content/common/content_notification_types.h" 23 #include "content/common/content_notification_types.h"
24 #include "content/common/content_switches.h" 24 #include "content/common/content_switches.h"
25 #include "content/common/notification_service.h" 25 #include "content/common/notification_service.h"
26 #include "content/common/pepper_plugin_registry.h" 26 #include "content/common/pepper_plugin_registry.h"
27 #include "content/common/plugin_messages.h" 27 #include "content/common/plugin_messages.h"
28 #include "content/common/url_constants.h"
28 #include "content/common/view_messages.h" 29 #include "content/common/view_messages.h"
29 #include "webkit/plugins/npapi/plugin_constants_win.h" 30 #include "webkit/plugins/npapi/plugin_constants_win.h"
30 #include "webkit/plugins/npapi/plugin_list.h" 31 #include "webkit/plugins/npapi/plugin_list.h"
31 #include "webkit/plugins/webplugininfo.h" 32 #include "webkit/plugins/webplugininfo.h"
32 33
33 #if defined(OS_POSIX) && !defined(OS_MACOSX) 34 #if defined(OS_POSIX) && !defined(OS_MACOSX)
34 using ::base::files::FilePathWatcher; 35 using ::base::files::FilePathWatcher;
35 #endif 36 #endif
36 37
37 #if defined(OS_MACOSX) 38 #if defined(OS_MACOSX)
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after
353 webkit::WebPluginInfo* info, 354 webkit::WebPluginInfo* info,
354 std::string* actual_mime_type) { 355 std::string* actual_mime_type) {
355 // GetPluginInfoArray may need to load the plugins, so we need to be 356 // GetPluginInfoArray may need to load the plugins, so we need to be
356 // on the FILE thread. 357 // on the FILE thread.
357 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); 358 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
358 { 359 {
359 base::AutoLock auto_lock(overridden_plugins_lock_); 360 base::AutoLock auto_lock(overridden_plugins_lock_);
360 for (size_t i = 0; i < overridden_plugins_.size(); ++i) { 361 for (size_t i = 0; i < overridden_plugins_.size(); ++i) {
361 if (overridden_plugins_[i].render_process_id == render_process_id && 362 if (overridden_plugins_[i].render_process_id == render_process_id &&
362 overridden_plugins_[i].render_view_id == render_view_id && 363 overridden_plugins_[i].render_view_id == render_view_id &&
363 overridden_plugins_[i].url == url) { 364 (overridden_plugins_[i].url == url ||
365 url.SchemeIs(chrome::kChromeUIScheme))) {
jam 2011/08/15 22:03:04 I believe you're doing this because the url for th
Lei Zhang 2011/08/16 00:16:41 Done
364 if (actual_mime_type) 366 if (actual_mime_type)
365 *actual_mime_type = mime_type; 367 *actual_mime_type = mime_type;
366 *info = overridden_plugins_[i].plugin; 368 *info = overridden_plugins_[i].plugin;
367 return true; 369 return true;
368 } 370 }
369 } 371 }
370 } 372 }
371 bool allow_wildcard = true; 373 bool allow_wildcard = true;
372 std::vector<webkit::WebPluginInfo> plugins; 374 std::vector<webkit::WebPluginInfo> plugins;
373 std::vector<std::string> mime_types; 375 std::vector<std::string> mime_types;
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
480 webkit::npapi::PluginList::Singleton()->RegisterInternalPlugin( 482 webkit::npapi::PluginList::Singleton()->RegisterInternalPlugin(
481 ppapi_plugins_[i].ToWebPluginInfo()); 483 ppapi_plugins_[i].ToWebPluginInfo());
482 } 484 }
483 } 485 }
484 486
485 // There should generally be very few plugins so a brute-force search is fine. 487 // There should generally be very few plugins so a brute-force search is fine.
486 PepperPluginInfo* PluginService::GetRegisteredPpapiPluginInfo( 488 PepperPluginInfo* PluginService::GetRegisteredPpapiPluginInfo(
487 const FilePath& plugin_path) { 489 const FilePath& plugin_path) {
488 PepperPluginInfo* info = NULL; 490 PepperPluginInfo* info = NULL;
489 for (size_t i = 0; i < ppapi_plugins_.size(); i++) { 491 for (size_t i = 0; i < ppapi_plugins_.size(); i++) {
490 if (ppapi_plugins_[i].path == plugin_path) { 492 if (ppapi_plugins_[i].path == plugin_path) {
491 info = &ppapi_plugins_[i]; 493 info = &ppapi_plugins_[i];
492 break; 494 break;
493 } 495 }
494 } 496 }
495 return info; 497 return info;
496 } 498 }
497 499
498 #if defined(OS_POSIX) && !defined(OS_MACOSX) 500 #if defined(OS_POSIX) && !defined(OS_MACOSX)
499 // static 501 // static
500 void PluginService::RegisterFilePathWatcher( 502 void PluginService::RegisterFilePathWatcher(
501 FilePathWatcher *watcher, 503 FilePathWatcher *watcher,
502 const FilePath& path, 504 const FilePath& path,
503 FilePathWatcher::Delegate* delegate) { 505 FilePathWatcher::Delegate* delegate) {
504 bool result = watcher->Watch(path, delegate); 506 bool result = watcher->Watch(path, delegate);
505 DCHECK(result); 507 DCHECK(result);
506 } 508 }
507 #endif 509 #endif
OLDNEW
« no previous file with comments | « chrome/browser/printing/print_preview_tab_controller.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698