OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/plugins/chrome_plugin_placeholder.h" | 5 #include "chrome/renderer/plugins/chrome_plugin_placeholder.h" |
6 | 6 |
7 #include "base/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
8 #include "base/values.h" | 8 #include "base/values.h" |
9 #include "chrome/common/prerender_messages.h" | 9 #include "chrome/common/prerender_messages.h" |
10 #include "chrome/common/render_messages.h" | 10 #include "chrome/common/render_messages.h" |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 // static | 91 // static |
92 ChromePluginPlaceholder* ChromePluginPlaceholder::CreateMissingPlugin( | 92 ChromePluginPlaceholder* ChromePluginPlaceholder::CreateMissingPlugin( |
93 content::RenderFrame* render_frame, | 93 content::RenderFrame* render_frame, |
94 WebLocalFrame* frame, | 94 WebLocalFrame* frame, |
95 const WebPluginParams& params) { | 95 const WebPluginParams& params) { |
96 const base::StringPiece template_html( | 96 const base::StringPiece template_html( |
97 ResourceBundle::GetSharedInstance().GetRawDataResource( | 97 ResourceBundle::GetSharedInstance().GetRawDataResource( |
98 IDR_BLOCKED_PLUGIN_HTML)); | 98 IDR_BLOCKED_PLUGIN_HTML)); |
99 | 99 |
100 base::DictionaryValue values; | 100 base::DictionaryValue values; |
101 #if defined(ENABLE_PLUGIN_INSTALLATION) | |
102 values.SetString("message", l10n_util::GetStringUTF8(IDS_PLUGIN_SEARCHING)); | |
103 #else | |
104 values.SetString("message", | 101 values.SetString("message", |
105 l10n_util::GetStringUTF8(IDS_PLUGIN_NOT_SUPPORTED)); | 102 l10n_util::GetStringUTF8(IDS_PLUGIN_NOT_SUPPORTED)); |
106 #endif | |
107 | 103 |
108 std::string html_data = webui::GetI18nTemplateHtml(template_html, &values); | 104 std::string html_data = webui::GetI18nTemplateHtml(template_html, &values); |
109 | 105 |
110 // |missing_plugin| will destroy itself when its WebViewPlugin is going away. | 106 // |missing_plugin| will destroy itself when its WebViewPlugin is going away. |
111 ChromePluginPlaceholder* missing_plugin = new ChromePluginPlaceholder( | 107 ChromePluginPlaceholder* missing_plugin = new ChromePluginPlaceholder( |
112 render_frame, frame, params, html_data, params.mimeType); | 108 render_frame, frame, params, html_data, params.mimeType); |
113 missing_plugin->set_allow_loading(true); | 109 missing_plugin->set_allow_loading(true); |
114 #if defined(ENABLE_PLUGIN_INSTALLATION) | |
115 RenderThread::Get()->Send( | |
116 new ChromeViewHostMsg_FindMissingPlugin(missing_plugin->routing_id(), | |
117 missing_plugin->CreateRoutingId(), | |
118 params.mimeType.utf8())); | |
119 #endif | |
120 return missing_plugin; | 110 return missing_plugin; |
121 } | 111 } |
122 | 112 |
123 // static | 113 // static |
124 ChromePluginPlaceholder* ChromePluginPlaceholder::CreateErrorPlugin( | 114 ChromePluginPlaceholder* ChromePluginPlaceholder::CreateErrorPlugin( |
125 content::RenderFrame* render_frame, | 115 content::RenderFrame* render_frame, |
126 const base::FilePath& file_path) { | 116 const base::FilePath& file_path) { |
127 base::DictionaryValue values; | 117 base::DictionaryValue values; |
128 values.SetString("message", | 118 values.SetString("message", |
129 l10n_util::GetStringUTF8(IDS_PLUGIN_INITIALIZATION_ERROR)); | 119 l10n_util::GetStringUTF8(IDS_PLUGIN_INITIALIZATION_ERROR)); |
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
377 v8::Handle<v8::Object> global = context->Global(); | 367 v8::Handle<v8::Object> global = context->Global(); |
378 global->Set(gin::StringToV8(isolate, "plugin"), | 368 global->Set(gin::StringToV8(isolate, "plugin"), |
379 gin::CreateHandle(isolate, this).ToV8()); | 369 gin::CreateHandle(isolate, this).ToV8()); |
380 } | 370 } |
381 | 371 |
382 gin::ObjectTemplateBuilder ChromePluginPlaceholder::GetObjectTemplateBuilder( | 372 gin::ObjectTemplateBuilder ChromePluginPlaceholder::GetObjectTemplateBuilder( |
383 v8::Isolate* isolate) { | 373 v8::Isolate* isolate) { |
384 return LoadablePluginPlaceholder::GetObjectTemplateBuilder(isolate).SetMethod( | 374 return LoadablePluginPlaceholder::GetObjectTemplateBuilder(isolate).SetMethod( |
385 "openAboutPlugins", &ChromePluginPlaceholder::OpenAboutPluginsCallback); | 375 "openAboutPlugins", &ChromePluginPlaceholder::OpenAboutPluginsCallback); |
386 } | 376 } |
OLD | NEW |