| OLD | NEW |
| 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 "chrome/renderer/chrome_content_renderer_client.h" | 5 #include "chrome/renderer/chrome_content_renderer_client.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
| (...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 275 } | 275 } |
| 276 | 276 |
| 277 WebPlugin* ChromeContentRendererClient::CreatePluginImpl( | 277 WebPlugin* ChromeContentRendererClient::CreatePluginImpl( |
| 278 RenderView* render_view, | 278 RenderView* render_view, |
| 279 WebFrame* frame, | 279 WebFrame* frame, |
| 280 const WebPluginParams& original_params, | 280 const WebPluginParams& original_params, |
| 281 bool* is_default_plugin) { | 281 bool* is_default_plugin) { |
| 282 bool found = false; | 282 bool found = false; |
| 283 *is_default_plugin = false; | 283 *is_default_plugin = false; |
| 284 CommandLine* cmd = CommandLine::ForCurrentProcess(); | 284 CommandLine* cmd = CommandLine::ForCurrentProcess(); |
| 285 webkit::npapi::WebPluginInfo info; | 285 webkit::WebPluginInfo info; |
| 286 GURL url(original_params.url); | 286 GURL url(original_params.url); |
| 287 std::string orig_mime_type = original_params.mimeType.utf8(); | 287 std::string orig_mime_type = original_params.mimeType.utf8(); |
| 288 std::string actual_mime_type; | 288 std::string actual_mime_type; |
| 289 render_view->Send(new ViewHostMsg_GetPluginInfo( | 289 render_view->Send(new ViewHostMsg_GetPluginInfo( |
| 290 render_view->routing_id(), url, frame->top()->document().url(), | 290 render_view->routing_id(), url, frame->top()->document().url(), |
| 291 orig_mime_type, &found, &info, &actual_mime_type)); | 291 orig_mime_type, &found, &info, &actual_mime_type)); |
| 292 | 292 |
| 293 if (!found) | 293 if (!found) |
| 294 return NULL; | 294 return NULL; |
| 295 if (!webkit::npapi::IsPluginEnabled(info)) | 295 if (!webkit::IsPluginEnabled(info)) |
| 296 return NULL; | 296 return NULL; |
| 297 | 297 |
| 298 *is_default_plugin = | 298 *is_default_plugin = |
| 299 info.path.value() == webkit::npapi::kDefaultPluginLibraryName; | 299 info.path.value() == webkit::npapi::kDefaultPluginLibraryName; |
| 300 | 300 |
| 301 if (orig_mime_type == actual_mime_type) { | 301 if (orig_mime_type == actual_mime_type) { |
| 302 UMA_HISTOGRAM_ENUMERATION(kPluginTypeMismatch, | 302 UMA_HISTOGRAM_ENUMERATION(kPluginTypeMismatch, |
| 303 PLUGIN_TYPE_MISMATCH_NONE, | 303 PLUGIN_TYPE_MISMATCH_NONE, |
| 304 PLUGIN_TYPE_MISMATCH_NUM_EVENTS); | 304 PLUGIN_TYPE_MISMATCH_NUM_EVENTS); |
| 305 } else if (orig_mime_type.empty()) { | 305 } else if (orig_mime_type.empty()) { |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 403 if (!allow_nacl) { | 403 if (!allow_nacl) { |
| 404 GURL nexe_url; | 404 GURL nexe_url; |
| 405 if (actual_mime_type == kNaClPluginMimeType) { | 405 if (actual_mime_type == kNaClPluginMimeType) { |
| 406 nexe_url = url; // Normal embedded NaCl plugin. | 406 nexe_url = url; // Normal embedded NaCl plugin. |
| 407 } else { | 407 } else { |
| 408 // Content type handling NaCl plugin; the "nacl" param on the | 408 // Content type handling NaCl plugin; the "nacl" param on the |
| 409 // MIME type holds the nexe URL. | 409 // MIME type holds the nexe URL. |
| 410 string16 nacl_attr = ASCIIToUTF16(kNaClPluginManifestAttribute); | 410 string16 nacl_attr = ASCIIToUTF16(kNaClPluginManifestAttribute); |
| 411 for (size_t i = 0; i < info.mime_types.size(); ++i) { | 411 for (size_t i = 0; i < info.mime_types.size(); ++i) { |
| 412 if (info.mime_types[i].mime_type == actual_mime_type) { | 412 if (info.mime_types[i].mime_type == actual_mime_type) { |
| 413 const webkit::npapi::WebPluginMimeType& content_type = | 413 const webkit::WebPluginMimeType& content_type = |
| 414 info.mime_types[i]; | 414 info.mime_types[i]; |
| 415 for (size_t i = 0; | 415 for (size_t i = 0; |
| 416 i < content_type.additional_param_names.size(); ++i) { | 416 i < content_type.additional_param_names.size(); ++i) { |
| 417 if (content_type.additional_param_names[i] == nacl_attr) { | 417 if (content_type.additional_param_names[i] == nacl_attr) { |
| 418 nexe_url = GURL(content_type.additional_param_values[i]); | 418 nexe_url = GURL(content_type.additional_param_values[i]); |
| 419 break; | 419 break; |
| 420 } | 420 } |
| 421 } | 421 } |
| 422 break; | 422 break; |
| 423 } | 423 } |
| (...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 703 if (spellcheck_.get()) | 703 if (spellcheck_.get()) |
| 704 thread->RemoveObserver(spellcheck_.get()); | 704 thread->RemoveObserver(spellcheck_.get()); |
| 705 SpellCheck* new_spellcheck = new SpellCheck(); | 705 SpellCheck* new_spellcheck = new SpellCheck(); |
| 706 if (spellcheck_provider_) | 706 if (spellcheck_provider_) |
| 707 spellcheck_provider_->SetSpellCheck(new_spellcheck); | 707 spellcheck_provider_->SetSpellCheck(new_spellcheck); |
| 708 spellcheck_.reset(new_spellcheck); | 708 spellcheck_.reset(new_spellcheck); |
| 709 thread->AddObserver(new_spellcheck); | 709 thread->AddObserver(new_spellcheck); |
| 710 } | 710 } |
| 711 | 711 |
| 712 } // namespace chrome | 712 } // namespace chrome |
| OLD | NEW |