| OLD | NEW |
| 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 "chrome/renderer/render_view.h" | 5 #include "chrome/renderer/render_view.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "app/l10n_util.h" | 11 #include "app/l10n_util.h" |
| 12 #include "app/message_box_flags.h" | 12 #include "app/message_box_flags.h" |
| 13 #include "app/resource_bundle.h" | 13 #include "app/resource_bundle.h" |
| 14 #include "base/callback.h" | 14 #include "base/callback.h" |
| 15 #include "base/command_line.h" | 15 #include "base/command_line.h" |
| 16 #include "base/compiler_specific.h" | 16 #include "base/compiler_specific.h" |
| 17 #include "base/field_trial.h" | 17 #include "base/field_trial.h" |
| 18 #include "base/histogram.h" | 18 #include "base/histogram.h" |
| 19 #include "base/path_service.h" |
| 19 #include "base/process_util.h" | 20 #include "base/process_util.h" |
| 20 #include "base/singleton.h" | 21 #include "base/singleton.h" |
| 21 #include "base/string_piece.h" | 22 #include "base/string_piece.h" |
| 22 #include "base/string_util.h" | 23 #include "base/string_util.h" |
| 23 #include "base/time.h" | 24 #include "base/time.h" |
| 24 #include "build/build_config.h" | 25 #include "build/build_config.h" |
| 25 #include "chrome/common/appcache/appcache_dispatcher.h" | 26 #include "chrome/common/appcache/appcache_dispatcher.h" |
| 26 #include "chrome/common/bindings_policy.h" | 27 #include "chrome/common/bindings_policy.h" |
| 27 #include "chrome/common/child_process_logging.h" | 28 #include "chrome/common/child_process_logging.h" |
| 29 #include "chrome/common/chrome_constants.h" |
| 30 #include "chrome/common/chrome_paths.h" |
| 28 #include "chrome/common/chrome_switches.h" | 31 #include "chrome/common/chrome_switches.h" |
| 29 #include "chrome/common/chrome_constants.h" | |
| 30 #include "chrome/common/extensions/extension_constants.h" | 32 #include "chrome/common/extensions/extension_constants.h" |
| 31 #include "chrome/common/jstemplate_builder.h" | 33 #include "chrome/common/jstemplate_builder.h" |
| 32 #include "chrome/common/page_zoom.h" | 34 #include "chrome/common/page_zoom.h" |
| 33 #include "chrome/common/render_messages.h" | 35 #include "chrome/common/render_messages.h" |
| 34 #include "chrome/common/renderer_preferences.h" | 36 #include "chrome/common/renderer_preferences.h" |
| 35 #include "chrome/common/thumbnail_score.h" | 37 #include "chrome/common/thumbnail_score.h" |
| 36 #include "chrome/common/url_constants.h" | 38 #include "chrome/common/url_constants.h" |
| 37 #include "chrome/common/window_container_type.h" | 39 #include "chrome/common/window_container_type.h" |
| 38 #include "chrome/renderer/about_handler.h" | 40 #include "chrome/renderer/about_handler.h" |
| 39 #include "chrome/renderer/audio_message_filter.h" | 41 #include "chrome/renderer/audio_message_filter.h" |
| (...skipping 3059 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3099 WebFrame* main_frame = webview()->mainFrame(); | 3101 WebFrame* main_frame = webview()->mainFrame(); |
| 3100 if (main_frame) | 3102 if (main_frame) |
| 3101 policy_url = main_frame->url(); | 3103 policy_url = main_frame->url(); |
| 3102 | 3104 |
| 3103 FilePath path; | 3105 FilePath path; |
| 3104 render_thread_->Send(new ViewHostMsg_GetPluginPath( | 3106 render_thread_->Send(new ViewHostMsg_GetPluginPath( |
| 3105 url, policy_url, mime_type, &path, actual_mime_type)); | 3107 url, policy_url, mime_type, &path, actual_mime_type)); |
| 3106 if (path.value().empty()) | 3108 if (path.value().empty()) |
| 3107 return NULL; | 3109 return NULL; |
| 3108 | 3110 |
| 3111 FilePath internal_pdf_path; |
| 3112 PathService::Get(chrome::FILE_PDF_PLUGIN, &internal_pdf_path); |
| 3113 |
| 3109 const std::string* mime_type_to_use; | 3114 const std::string* mime_type_to_use; |
| 3110 if (!actual_mime_type->empty()) | 3115 if (!actual_mime_type->empty()) |
| 3111 mime_type_to_use = actual_mime_type; | 3116 mime_type_to_use = actual_mime_type; |
| 3112 else | 3117 else |
| 3113 mime_type_to_use = &mime_type; | 3118 mime_type_to_use = &mime_type; |
| 3114 | 3119 |
| 3115 bool use_pepper_host = false; | 3120 bool use_pepper_host = false; |
| 3116 bool in_process_plugin = RenderProcess::current()->UseInProcessPlugins(); | 3121 bool in_process_plugin = RenderProcess::current()->UseInProcessPlugins(); |
| 3117 // Check for trusted Pepper plugins. | 3122 // Check for trusted Pepper plugins. |
| 3118 const char kPepperPrefix[] = "pepper-"; | 3123 const char kPepperPrefix[] = "pepper-"; |
| 3119 if (StartsWithASCII(*mime_type_to_use, kPepperPrefix, true)) { | 3124 if (StartsWithASCII(*mime_type_to_use, kPepperPrefix, true)) { |
| 3120 if (CommandLine::ForCurrentProcess()-> | 3125 if (CommandLine::ForCurrentProcess()-> |
| 3121 HasSwitch(switches::kInternalPepper)) { | 3126 HasSwitch(switches::kInternalPepper)) { |
| 3122 in_process_plugin = true; | 3127 in_process_plugin = true; |
| 3123 use_pepper_host = true; | 3128 use_pepper_host = true; |
| 3124 } else { | 3129 } else { |
| 3125 // In process Pepper plugins must be explicitly enabled. | 3130 // In process Pepper plugins must be explicitly enabled. |
| 3126 return NULL; | 3131 return NULL; |
| 3127 } | 3132 } |
| 3128 } else if (CommandLine::ForCurrentProcess()-> | 3133 } else if (path == internal_pdf_path) { |
| 3129 HasSwitch(switches::kInternalPDF) && | |
| 3130 StartsWithASCII(*mime_type_to_use, "application/pdf", true)) { | |
| 3131 in_process_plugin = true; | 3134 in_process_plugin = true; |
| 3132 use_pepper_host = true; | 3135 use_pepper_host = true; |
| 3133 } | 3136 } |
| 3134 // Check for Native Client modules. | 3137 // Check for Native Client modules. |
| 3135 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kInternalNaCl)) { | 3138 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kInternalNaCl)) { |
| 3136 if (mime_type == "application/x-nacl-srpc") { | 3139 if (mime_type == "application/x-nacl-srpc") { |
| 3137 in_process_plugin = true; | 3140 in_process_plugin = true; |
| 3138 use_pepper_host = true; | 3141 use_pepper_host = true; |
| 3139 } | 3142 } |
| 3140 } | 3143 } |
| (...skipping 1823 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4964 | 4967 |
| 4965 if (last_top_level_navigation_page_id_ != page_id_ && | 4968 if (last_top_level_navigation_page_id_ != page_id_ && |
| 4966 // Not interested in reloads. | 4969 // Not interested in reloads. |
| 4967 type != WebKit::WebNavigationTypeReload && | 4970 type != WebKit::WebNavigationTypeReload && |
| 4968 type != WebKit::WebNavigationTypeFormSubmitted) { | 4971 type != WebKit::WebNavigationTypeFormSubmitted) { |
| 4969 return true; | 4972 return true; |
| 4970 } | 4973 } |
| 4971 } | 4974 } |
| 4972 return false; | 4975 return false; |
| 4973 } | 4976 } |
| OLD | NEW |