| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "base/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
| 8 #include "chrome/common/extensions/extension.h" | 8 #include "chrome/common/extensions/extension.h" |
| 9 #include "chrome/common/extensions/extension_builder.h" | 9 #include "chrome/common/extensions/extension_builder.h" |
| 10 #include "chrome/common/extensions/extension_manifest_constants.h" | 10 #include "chrome/common/extensions/extension_manifest_constants.h" |
| 11 #include "content/public/common/webplugininfo.h" |
| 11 #include "testing/gtest/include/gtest/gtest.h" | 12 #include "testing/gtest/include/gtest/gtest.h" |
| 12 #include "third_party/WebKit/public/platform/WebString.h" | 13 #include "third_party/WebKit/public/platform/WebString.h" |
| 13 #include "third_party/WebKit/public/platform/WebVector.h" | 14 #include "third_party/WebKit/public/platform/WebVector.h" |
| 14 #include "third_party/WebKit/public/web/WebPluginParams.h" | 15 #include "third_party/WebKit/public/web/WebPluginParams.h" |
| 15 #include "url/gurl.h" | 16 #include "url/gurl.h" |
| 16 #include "webkit/plugins/webplugininfo.h" | |
| 17 | 17 |
| 18 using WebKit::WebPluginParams; | 18 using WebKit::WebPluginParams; |
| 19 using WebKit::WebString; | 19 using WebKit::WebString; |
| 20 using WebKit::WebVector; | 20 using WebKit::WebVector; |
| 21 using chrome::ChromeContentRendererClient; | 21 using chrome::ChromeContentRendererClient; |
| 22 using webkit::WebPluginInfo; | 22 using content::WebPluginInfo; |
| 23 using webkit::WebPluginMimeType; | 23 using content::WebPluginMimeType; |
| 24 | 24 |
| 25 namespace chrome { | 25 namespace chrome { |
| 26 | 26 |
| 27 namespace { | 27 namespace { |
| 28 const bool kNaClRestricted = false; | 28 const bool kNaClRestricted = false; |
| 29 const bool kNaClUnrestricted = true; | 29 const bool kNaClUnrestricted = true; |
| 30 const bool kExtensionRestricted = false; | 30 const bool kExtensionRestricted = false; |
| 31 const bool kExtensionUnrestricted = true; | 31 const bool kExtensionUnrestricted = true; |
| 32 const bool kExtensionNotFromWebStore = false; | 32 const bool kExtensionNotFromWebStore = false; |
| 33 const bool kExtensionFromWebStore = true; | 33 const bool kExtensionFromWebStore = true; |
| (...skipping 17 matching lines...) Expand all Loading... |
| 51 | 51 |
| 52 void AddFakeDevAttribute(WebPluginParams* params) { | 52 void AddFakeDevAttribute(WebPluginParams* params) { |
| 53 WebVector<WebString> names(static_cast<size_t>(1)); | 53 WebVector<WebString> names(static_cast<size_t>(1)); |
| 54 WebVector<WebString> values(static_cast<size_t>(1)); | 54 WebVector<WebString> values(static_cast<size_t>(1)); |
| 55 names[0] = WebString::fromUTF8("@dev"); | 55 names[0] = WebString::fromUTF8("@dev"); |
| 56 values[0] = WebString(); | 56 values[0] = WebString(); |
| 57 params->attributeNames.swap(names); | 57 params->attributeNames.swap(names); |
| 58 params->attributeValues.swap(values); | 58 params->attributeValues.swap(values); |
| 59 } | 59 } |
| 60 | 60 |
| 61 void AddContentTypeHandler(WebPluginInfo* info, | 61 void AddContentTypeHandler(content::WebPluginInfo* info, |
| 62 const char* mime_type, | 62 const char* mime_type, |
| 63 const char* manifest_url) { | 63 const char* manifest_url) { |
| 64 WebPluginMimeType mime_type_info; | 64 content::WebPluginMimeType mime_type_info; |
| 65 mime_type_info.mime_type = mime_type; | 65 mime_type_info.mime_type = mime_type; |
| 66 mime_type_info.additional_param_names.push_back(UTF8ToUTF16("nacl")); | 66 mime_type_info.additional_param_names.push_back(UTF8ToUTF16("nacl")); |
| 67 mime_type_info.additional_param_values.push_back( | 67 mime_type_info.additional_param_values.push_back( |
| 68 UTF8ToUTF16(manifest_url)); | 68 UTF8ToUTF16(manifest_url)); |
| 69 info->mime_types.push_back(mime_type_info); | 69 info->mime_types.push_back(mime_type_info); |
| 70 } | 70 } |
| 71 } // namespace | 71 } // namespace |
| 72 | 72 |
| 73 typedef testing::Test ChromeContentRendererClientTest; | 73 typedef testing::Test ChromeContentRendererClientTest; |
| 74 | 74 |
| (...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 327 GURL("http://example.evil.com/test.html"), | 327 GURL("http://example.evil.com/test.html"), |
| 328 kNaClRestricted, | 328 kNaClRestricted, |
| 329 CreateHostedApp(kExtensionRestricted, | 329 CreateHostedApp(kExtensionRestricted, |
| 330 kExtensionNotFromWebStore, | 330 kExtensionNotFromWebStore, |
| 331 "http://example.com/").get(), | 331 "http://example.com/").get(), |
| 332 ¶ms)); | 332 ¶ms)); |
| 333 } | 333 } |
| 334 } | 334 } |
| 335 | 335 |
| 336 } // namespace chrome | 336 } // namespace chrome |
| OLD | NEW |